Author: adietish
Date: 2011-05-23 03:28:29 -0400 (Mon, 23 May 2011)
New Revision: 31420
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java
Removed:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/job/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/ui/preferences/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/test/core/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/test/ui/
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/META-INF/MANIFEST.MF
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientIntegrationTestSuite.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientTestSuite.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/APIResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ImageResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/KeyResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerFake.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java
Log:
[JBIDE-8975] corrected package structure in Deltacloud client tests
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/META-INF/MANIFEST.MF 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/META-INF/MANIFEST.MF 2011-05-23
07:28:29 UTC (rev 31420)
@@ -5,7 +5,6 @@
Bundle-Version: 1.0.1.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.jboss.tools.deltacloud.client;bundle-version="0.1.0",
- org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
org.junit;bundle-version="[4.8.0,5.0.0)"
Bundle-ClassPath: jruby-complete-1.5.3.jar,
.
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientIntegrationTestSuite.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientIntegrationTestSuite.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientIntegrationTestSuite.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,19 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.ImageMockIntegrationTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.InstanceMockIntegrationTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.KeyMockIntegrationTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.ServerTypeMockIntegrationTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.ImageMockIntegrationTest;
+import
org.jboss.tools.internal.deltacloud.client.test.client.InstanceMockIntegrationTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.KeyMockIntegrationTest;
+import
org.jboss.tools.internal.deltacloud.client.test.client.ServerTypeMockIntegrationTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientTestSuite.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientTestSuite.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/DeltaCloudClientTestSuite.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,21 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.APIDomUnmarshallingTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.HardwareProfileDomUnmarshallingTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.ImageDomUnmarshallingTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.InstanceDomUnmarshallingTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.KeyDomUnmarshallingTest;
-import
org.jboss.tools.internal.deltacloud.client.test.core.client.RealmDomUnmarshallingTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.APIDomUnmarshallingTest;
+import
org.jboss.tools.internal.deltacloud.client.test.client.HardwareProfileDomUnmarshallingTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.ImageDomUnmarshallingTest;
+import
org.jboss.tools.internal.deltacloud.client.test.client.InstanceDomUnmarshallingTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.KeyDomUnmarshallingTest;
+import org.jboss.tools.internal.deltacloud.client.test.client.RealmDomUnmarshallingTest;
import org.jboss.tools.internal.deltacloud.client.utils.test.UrlBuilderTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.net.MalformedURLException;
-
-import org.jboss.tools.deltacloud.core.client.API;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.unmarshal.APIUnmarshaller;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.APIResponseFakes.APIResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class APIDomUnmarshallingTest {
-
- @Test
- public void ec2DriverIsUnmarshalled() throws MalformedURLException,
DeltaCloudClientException {
- API api = new API();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(APIResponse.apiResponse.getBytes());
- new APIUnmarshaller().unmarshall(inputStream, api);
- assertNotNull(api);
- assertEquals(APIResponse.driver, api.getDriver().name().toLowerCase());
- }
-
- @Test
- public void invalidDriverUnmarshalledToUnknown() throws MalformedURLException,
DeltaCloudClientException {
- API api = new API();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(APIResponse.invalidDriverApiResponse.getBytes());
- new APIUnmarshaller().unmarshall(inputStream, api);
- assertNotNull(api);
- assertEquals(Driver.UNKNOWN, api.getDriver());
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/APIDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/APIDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
+
+import org.jboss.tools.deltacloud.client.API;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.API.Driver;
+import org.jboss.tools.deltacloud.client.unmarshal.APIUnmarshaller;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.APIResponseFakes.APIResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class APIDomUnmarshallingTest {
+
+ @Test
+ public void ec2DriverIsUnmarshalled() throws MalformedURLException,
DeltaCloudClientException {
+ API api = new API();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(APIResponse.apiResponse.getBytes());
+ new APIUnmarshaller().unmarshall(inputStream, api);
+ assertNotNull(api);
+ assertEquals(APIResponse.driver, api.getDriver().name().toLowerCase());
+ }
+
+ @Test
+ public void invalidDriverUnmarshalledToUnknown() throws MalformedURLException,
DeltaCloudClientException {
+ API api = new API();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(APIResponse.invalidDriverApiResponse.getBytes());
+ new APIUnmarshaller().unmarshall(inputStream, api);
+ assertNotNull(api);
+ assertEquals(Driver.UNKNOWN, api.getDriver());
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBException;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
-import org.jboss.tools.deltacloud.core.client.Property;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfileUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfilesUnmarshaller;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile1Response;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile2Response;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfilesResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class HardwareProfileDomUnmarshallingTest {
-
- @Test
- public void HardwareProfilesCanBeUnmarshalled() throws MalformedURLException,
JAXBException,
- DeltaCloudClientException {
- List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfilesResponse.response.getBytes());
- new HardwareProfilesUnmarshaller().unmarshall(inputStream, profiles);
- assertEquals(2, profiles.size());
- }
-
- @Test
- public void fixedPropertyHardwareProfileMayBeUnmarshalled() throws
MalformedURLException, JAXBException,
- DeltaCloudClientException {
- HardwareProfile profile = new HardwareProfile();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfile1Response.response.getBytes());
- new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
- assertNotNull(profile);
- assertEquals(HardwareProfile1Response.id, profile.getId());
- assertEquals(HardwareProfile1Response.propMemValue + ' ' +
HardwareProfile1Response.propMemUnit,
- profile.getMemory());
- assertEquals(HardwareProfile1Response.propStorageValue + ' ' +
HardwareProfile1Response.propStorageUnit,
- profile.getStorage());
- assertEquals(HardwareProfile1Response.propCPUValue, profile.getCPU());
- assertEquals(HardwareProfile1Response.propArchValue, profile.getArchitecture());
- }
-
- @Test
- public void mixedPropertiesHardwareProfileMayBeUnmarshalled() throws
MalformedURLException, JAXBException,
- DeltaCloudClientException {
- HardwareProfile profile = new HardwareProfile();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfile2Response.response.getBytes());
- new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
- assertNotNull(profile);
- assertEquals(HardwareProfile2Response.id, profile.getId());
- assertEquals(HardwareProfile2Response.propMemValue + ' ' +
HardwareProfile2Response.propMemUnit,
- profile.getMemory());
- Property property = profile.getNamedProperty(Property.Names.MEMORY);
- assertNotNull(property);
- assertEquals(HardwareProfile2Response.propMemRangeFirst,
property.getRange().getFirst());
- assertEquals(HardwareProfile2Response.propMemRangeLast,
property.getRange().getLast());
- assertEquals(HardwareProfile2Response.propStorageValue + ' ' +
HardwareProfile2Response.propStorageUnit,
- profile.getStorage());
- property = profile.getNamedProperty(Property.Names.STORAGE);
- assertNotNull(property);
- assertNotNull(property.getEnums());
- assertEquals(2, property.getEnums().size());
- assertEquals(HardwareProfile2Response.propStorageEnum1, property.getEnums().get(0));
- assertEquals(HardwareProfile2Response.propStorageEnum2, property.getEnums().get(1));
- assertEquals(HardwareProfile2Response.propCPUValue, profile.getCPU());
- assertEquals(HardwareProfile2Response.propArchValue, profile.getArchitecture());
- }
-
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/HardwareProfileDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/HardwareProfileDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import org.jboss.tools.deltacloud.client.Property;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfileUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.HardwareProfilesUnmarshaller;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile1Response;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfile2Response;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.HardwareProfileResponseFakes.HardwareProfilesResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfileDomUnmarshallingTest {
+
+ @Test
+ public void HardwareProfilesCanBeUnmarshalled() throws MalformedURLException,
JAXBException,
+ DeltaCloudClientException {
+ List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfilesResponse.response.getBytes());
+ new HardwareProfilesUnmarshaller().unmarshall(inputStream, profiles);
+ assertEquals(2, profiles.size());
+ }
+
+ @Test
+ public void fixedPropertyHardwareProfileMayBeUnmarshalled() throws
MalformedURLException, JAXBException,
+ DeltaCloudClientException {
+ HardwareProfile profile = new HardwareProfile();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfile1Response.response.getBytes());
+ new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
+ assertNotNull(profile);
+ assertEquals(HardwareProfile1Response.id, profile.getId());
+ assertEquals(HardwareProfile1Response.propMemValue + ' ' +
HardwareProfile1Response.propMemUnit,
+ profile.getMemory());
+ assertEquals(HardwareProfile1Response.propStorageValue + ' ' +
HardwareProfile1Response.propStorageUnit,
+ profile.getStorage());
+ assertEquals(HardwareProfile1Response.propCPUValue, profile.getCPU());
+ assertEquals(HardwareProfile1Response.propArchValue, profile.getArchitecture());
+ }
+
+ @Test
+ public void mixedPropertiesHardwareProfileMayBeUnmarshalled() throws
MalformedURLException, JAXBException,
+ DeltaCloudClientException {
+ HardwareProfile profile = new HardwareProfile();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(HardwareProfile2Response.response.getBytes());
+ new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
+ assertNotNull(profile);
+ assertEquals(HardwareProfile2Response.id, profile.getId());
+ assertEquals(HardwareProfile2Response.propMemValue + ' ' +
HardwareProfile2Response.propMemUnit,
+ profile.getMemory());
+ Property property = profile.getNamedProperty(Property.Names.MEMORY);
+ assertNotNull(property);
+ assertEquals(HardwareProfile2Response.propMemRangeFirst,
property.getRange().getFirst());
+ assertEquals(HardwareProfile2Response.propMemRangeLast,
property.getRange().getLast());
+ assertEquals(HardwareProfile2Response.propStorageValue + ' ' +
HardwareProfile2Response.propStorageUnit,
+ profile.getStorage());
+ property = profile.getNamedProperty(Property.Names.STORAGE);
+ assertNotNull(property);
+ assertNotNull(property.getEnums());
+ assertEquals(2, property.getEnums().size());
+ assertEquals(HardwareProfile2Response.propStorageEnum1, property.getEnums().get(0));
+ assertEquals(HardwareProfile2Response.propStorageEnum2, property.getEnums().get(1));
+ assertEquals(HardwareProfile2Response.propCPUValue, profile.getCPU());
+ assertEquals(HardwareProfile2Response.propArchValue, profile.getArchitecture());
+ }
+
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImageUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ImagesUnmarshaller;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImageResponse;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImagesResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class ImageDomUnmarshallingTest {
-
- @Test
- public void imageMayBeUnmarshalled() throws DeltaCloudClientException {
- Image image = new Image();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(ImageResponse.response.getBytes());
- new ImageUnmarshaller().unmarshall(inputStream, image);
- assertNotNull(image);
- assertEquals(ImageResponse.id, image.getId());
- assertEquals(ImageResponse.name, image.getName());
- assertEquals(ImageResponse.ownerId, image.getOwnerId());
- assertEquals(ImageResponse.description, image.getDescription());
- assertEquals(ImageResponse.architecture, image.getArchitecture());
- }
-
- @Test
- public void imagesMayBeUnmarshalled() throws DeltaCloudClientException {
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(ImagesResponse.response.getBytes());
- List<Image> images = new ArrayList<Image>();
- new ImagesUnmarshaller().unmarshall(inputStream, images);
- assertEquals(2, images.size());
-
- Image image = images.get(0);
- assertEquals(ImagesResponse.id1, image.getId());
- assertEquals(ImagesResponse.name1, image.getName());
-
- image = images.get(1);
- assertEquals(ImagesResponse.id2, image.getId());
- assertEquals(ImagesResponse.name2, image.getName());
- }
-
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.unmarshal.ImageUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.ImagesUnmarshaller;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImageResponse;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.ImageResponseFakes.ImagesResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ImageDomUnmarshallingTest {
+
+ @Test
+ public void imageMayBeUnmarshalled() throws DeltaCloudClientException {
+ Image image = new Image();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(ImageResponse.response.getBytes());
+ new ImageUnmarshaller().unmarshall(inputStream, image);
+ assertNotNull(image);
+ assertEquals(ImageResponse.id, image.getId());
+ assertEquals(ImageResponse.name, image.getName());
+ assertEquals(ImageResponse.ownerId, image.getOwnerId());
+ assertEquals(ImageResponse.description, image.getDescription());
+ assertEquals(ImageResponse.architecture, image.getArchitecture());
+ }
+
+ @Test
+ public void imagesMayBeUnmarshalled() throws DeltaCloudClientException {
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(ImagesResponse.response.getBytes());
+ List<Image> images = new ArrayList<Image>();
+ new ImagesUnmarshaller().unmarshall(inputStream, images);
+ assertEquals(2, images.size());
+
+ Image image = images.get(0);
+ assertEquals(ImagesResponse.id1, image.getId());
+ assertEquals(ImagesResponse.name1, image.getName());
+
+ image = images.get(1);
+ assertEquals(ImagesResponse.id2, image.getId());
+ assertEquals(ImagesResponse.name2, image.getName());
+ }
+
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.Image;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * An integration test that test various image related operations in DeltaCloudClient
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#listImages()
- * @see DeltaCloudClientImpl#listImages(String)
- *
- */
-public class ImageMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void cannotListIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
- DeltaCloudClientImpl client = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL, "badUser",
"badPassword");
- client.listImages();
- }
-
- @Test
- public void assertDefaultImages() throws DeltaCloudClientException {
- List<Image> images = testSetup.getClient().listImages();
- assertEquals(3, images.size());
- assertImage("img1", "Fedora 10", "fedoraproject",
"Fedora 10", "x86_64", getImage("img1", images));
- assertImage("img2", "Fedora 10", "fedoraproject",
"Fedora 10", "i386", getImage("img2", images) );
- assertImage("img3", "JBoss", "mockuser",
"JBoss", "i386", getImage("img3", images));
- }
-
- private Image getImage(String id, Collection<Image> images) {
- for (Image image : images) {
- if (id.equals(image.getId())) {
- return image;
- }
- }
- fail("image " + id + " was not found");
- return null;
- }
-
- private void assertImage(String id, String name, String owner, String description,
String architecture, Image image) {
- assertEquals(id, image.getId());
- assertEquals(name, image.getName());
- assertEquals(owner, image.getOwnerId());
- assertEquals(architecture, image.getArchitecture());
- assertEquals(description, image.getDescription());
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ImageMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ImageMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.Image;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * An integration test that test various image related operations in DeltaCloudClient
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#listImages()
+ * @see DeltaCloudClientImpl#listImages(String)
+ *
+ */
+public class ImageMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void cannotListIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
+ DeltaCloudClientImpl client = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL, "badUser",
"badPassword");
+ client.listImages();
+ }
+
+ @Test
+ public void assertDefaultImages() throws DeltaCloudClientException {
+ List<Image> images = testSetup.getClient().listImages();
+ assertEquals(3, images.size());
+ assertImage("img1", "Fedora 10", "fedoraproject",
"Fedora 10", "x86_64", getImage("img1", images));
+ assertImage("img2", "Fedora 10", "fedoraproject",
"Fedora 10", "i386", getImage("img2", images) );
+ assertImage("img3", "JBoss", "mockuser",
"JBoss", "i386", getImage("img3", images));
+ }
+
+ private Image getImage(String id, Collection<Image> images) {
+ for (Image image : images) {
+ if (id.equals(image.getId())) {
+ return image;
+ }
+ }
+ fail("image " + id + " was not found");
+ return null;
+ }
+
+ private void assertImage(String id, String name, String owner, String description,
String architecture, Image image) {
+ assertEquals(id, image.getId());
+ assertEquals(name, image.getName());
+ assertEquals(owner, image.getOwnerId());
+ assertEquals(architecture, image.getArchitecture());
+ assertEquals(description, image.getDescription());
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBException;
-
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ActionUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstanceUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.InstancesUnmarshaller;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceActionResponse;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceResponse;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstancesResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class InstanceDomUnmarshallingTest {
-
- @Test
- public void instanceActionMayBeUnmarshalled() throws MalformedURLException,
JAXBException, DeltaCloudClientException {
- Action<Instance> instanceAction = new Action<Instance>();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstanceActionResponse.response.getBytes());
- new ActionUnmarshaller<Instance>().unmarshall(inputStream, instanceAction);
- assertNotNull(instanceAction);
- assertEquals(InstanceActionResponse.name, instanceAction.getName());
- assertEquals(InstanceActionResponse.url, instanceAction.getUrl().toString());
- assertEquals(InstanceActionResponse.method.toUpperCase(),
instanceAction.getMethod().toString().toUpperCase());
- }
-
- @Test
- public void instanceMayBeUnmarshalled() throws DeltaCloudClientException {
- Instance instance = new Instance();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstanceResponse.response.getBytes());
- new InstanceUnmarshaller().unmarshall(inputStream, instance);
- assertNotNull(instance);
- assertEquals(InstanceResponse.id1, instance.getId());
- assertEquals(InstanceResponse.name1, instance.getName());
- assertEquals(InstanceResponse.ownerId1, instance.getOwnerId());
- assertEquals(InstanceResponse.image1Id, instance.getImageId());
- assertEquals(InstanceResponse.hardwareProfile1Id, instance.getProfileId());
- assertEquals(InstanceResponse.realm1Id, instance.getRealmId());
- assertEquals(InstanceResponse.state, instance.getState());
- assertEquals(InstanceResponse.keyname1, instance.getKeyId());
- assertEquals(2, instance.getActions().size());
- assertEquals(InstanceResponse.actionNameStop, instance.getActions().get(0).getName());
- assertEquals(InstanceResponse.actionNameReboot,
instance.getActions().get(1).getName());
- assertEquals(1, instance.getPublicAddresses().size());
- assertEquals(InstanceResponse.publicAddress1, instance.getPublicAddresses().get(0));
- assertEquals(1, instance.getPrivateAddresses().size());
- assertEquals(InstanceResponse.privateAddress1, instance.getPrivateAddresses().get(0));
-
- }
-
- @Test
- public void instancesMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstancesResponse.response.getBytes());
- List<Instance> instances = new ArrayList<Instance>();
- new InstancesUnmarshaller().unmarshall(inputStream, instances);
- assertEquals(2, instances.size());
-
- Instance instance = instances.get(0);
- assertEquals(InstancesResponse.id1, instance.getId());
- assertEquals(InstancesResponse.name1, instance.getName());
-
- instance = instances.get(1);
- assertEquals(InstancesResponse.id2, instance.getId());
- assertEquals(InstancesResponse.name2, instance.getName());
- assertEquals(2, instance.getActions().size());
- }
-
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.unmarshal.ActionUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstanceUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.InstancesUnmarshaller;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceActionResponse;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstanceResponse;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.InstanceResponseFakes.InstancesResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class InstanceDomUnmarshallingTest {
+
+ @Test
+ public void instanceActionMayBeUnmarshalled() throws MalformedURLException,
JAXBException, DeltaCloudClientException {
+ Action<Instance> instanceAction = new Action<Instance>();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstanceActionResponse.response.getBytes());
+ new ActionUnmarshaller<Instance>().unmarshall(inputStream, instanceAction);
+ assertNotNull(instanceAction);
+ assertEquals(InstanceActionResponse.name, instanceAction.getName());
+ assertEquals(InstanceActionResponse.url, instanceAction.getUrl().toString());
+ assertEquals(InstanceActionResponse.method.toUpperCase(),
instanceAction.getMethod().toString().toUpperCase());
+ }
+
+ @Test
+ public void instanceMayBeUnmarshalled() throws DeltaCloudClientException {
+ Instance instance = new Instance();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstanceResponse.response.getBytes());
+ new InstanceUnmarshaller().unmarshall(inputStream, instance);
+ assertNotNull(instance);
+ assertEquals(InstanceResponse.id1, instance.getId());
+ assertEquals(InstanceResponse.name1, instance.getName());
+ assertEquals(InstanceResponse.ownerId1, instance.getOwnerId());
+ assertEquals(InstanceResponse.image1Id, instance.getImageId());
+ assertEquals(InstanceResponse.hardwareProfile1Id, instance.getProfileId());
+ assertEquals(InstanceResponse.realm1Id, instance.getRealmId());
+ assertEquals(InstanceResponse.state, instance.getState());
+ assertEquals(InstanceResponse.keyname1, instance.getKeyId());
+ assertEquals(2, instance.getActions().size());
+ assertEquals(InstanceResponse.actionNameStop, instance.getActions().get(0).getName());
+ assertEquals(InstanceResponse.actionNameReboot,
instance.getActions().get(1).getName());
+ assertEquals(1, instance.getPublicAddresses().size());
+ assertEquals(InstanceResponse.publicAddress1, instance.getPublicAddresses().get(0));
+ assertEquals(1, instance.getPrivateAddresses().size());
+ assertEquals(InstanceResponse.privateAddress1, instance.getPrivateAddresses().get(0));
+
+ }
+
+ @Test
+ public void instancesMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(InstancesResponse.response.getBytes());
+ List<Instance> instances = new ArrayList<Instance>();
+ new InstancesUnmarshaller().unmarshall(inputStream, instances);
+ assertEquals(2, instances.size());
+
+ Instance instance = instances.get(0);
+ assertEquals(InstancesResponse.id1, instance.getId());
+ assertEquals(InstancesResponse.name1, instance.getName());
+
+ instance = instances.get(1);
+ assertEquals(InstancesResponse.id2, instance.getId());
+ assertEquals(InstancesResponse.name2, instance.getName());
+ assertEquals(2, instance.getActions().size());
+ }
+
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.Instance;
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Integration tests for instance related methods in
- * {@link DeltaCloudClientImpl}.
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#listInstances()
- * @see DeltaCloudClientImpl#createInstance(String)
- * @see DeltaCloudClientImpl#destroyInstance(String)
- * @see DeltaCloudClientImpl#startInstance(String)
- * @see DeltaCloudClientImpl#shutdownInstance(String)
- */
-public class InstanceMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- /**
- * #listInstance contains the test instance created in {@link #setUp()}
- *
- * @throws DeltaCloudClientException
- * the delta cloud client exception
- */
-
- @Test
- public void listContainsTestInstance() throws DeltaCloudClientException {
- DeltaCloudClient client = testSetup.getClient();
- List<Instance> instances = client.listInstances();
- assertTrue(instances.size() > 0);
- Instance testInstance = testSetup.getTestInstance();
- assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
- }
-
- @Test
- public void listTestInstance() throws DeltaCloudClientException {
- Instance instance =
testSetup.getClient().listInstances(testSetup.getTestInstance().getId());
- assertNotNull(instance);
- Instance testInstance = testSetup.getTestInstance();
- assertEquals(testInstance.getId(), instance.getId());
- assertInstance(
- testInstance.getName()
- , testInstance.getOwnerId()
- , testInstance.getImageId()
- , testInstance.getRealmId()
- , testInstance.getProfileId()
- , testInstance.getMemory()
- , testInstance.getPrivateAddresses()
- , testInstance.getPublicAddresses()
- , instance);
- }
-
- @Test(expected = DeltaCloudNotFoundClientException.class)
- public void listDestroyedInstanceThrowsException() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- testSetup.quietlyDestroyInstance(testInstance);
- testSetup.getClient().listInstances(testInstance.getId());
- }
-
- private void assertInstance(String name, String owner, String ImageId, String realmId,
String profile,
- String memory, List<String> privateAddresses, List<String>
publicAddresses, Instance instance) {
- assertNotNull("instance " + name + " was not found", instance);
- assertEquals(name, instance.getName());
- assertEquals(owner, instance.getOwnerId());
- assertEquals(realmId, instance.getRealmId());
- assertEquals(profile, instance.getProfileId());
- assertEquals(memory, instance.getMemory());
- assertTrue(privateAddresses.equals(instance.getPrivateAddresses()));
- assertTrue(publicAddresses.equals(instance.getPublicAddresses()));
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void cannotDestroyIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
- DeltaCloudClientImpl unauthenticatedClient = new DeltaCloudClientImpl(
- MockIntegrationTestContext.DELTACLOUD_URL,
- "badUser", "badPassword");
- Image image = testSetup.getFirstImage(unauthenticatedClient);
- unauthenticatedClient.createInstance(image.getId());
- }
-
- @Test
- public void canCreateInstance() throws DeltaCloudClientException {
- Instance instance = null;
- try {
- Image image = testSetup.getFirstImage(testSetup.getClient());
- instance = testSetup.getClient().createInstance(image.getId());
- assertTrue(instance != null);
- assertEquals(image.getId(), instance.getImageId());
- assertEquals(State.RUNNING, instance.getState());
- } finally {
- testSetup.quietlyDestroyInstance(instance);
- }
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void cannotDestroyUnknownImageId() throws DeltaCloudClientException {
- testSetup.getClient().createInstance("dummy");
- }
-
- @Test(expected=DeltaCloudClientException.class)
- public void canDestroy() throws DeltaCloudClientException {
- Image image = testSetup.getFirstImage(testSetup.getClient());
- DeltaCloudClient client = testSetup.getClient();
- Instance instance = client.createInstance(image.getId());
- instance.stop(client);
- instance.destroy(client);
- client.listInstances(instance.getId());
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void destroyThrowsExceptionOnUnknowInstanceId() throws DeltaCloudClientException,
IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException,
SecurityException,
- NoSuchMethodException {
- DeltaCloudClient client = testSetup.getClient();
- client.performAction(
- createInstanceAction(
- "destroy",
- MockIntegrationTestContext.DELTACLOUD_URL,
- HttpMethod.POST,
- new Instance()));
- }
-
- private Action<Instance> createInstanceAction(String name, String url, HttpMethod
method, Instance instance) {
- Action<Instance> action = new Action<Instance>();
- action.setName(name);
- action.setMethod(method);
- action.setOwner(instance);
- return action;
- }
-
- @SuppressWarnings("unused")
- private class InstanceActionProxy implements InvocationHandler {
-
- @Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (method.getName().equals("getUrl")) {
- return MockIntegrationTestContext.DELTACLOUD_URL;
- } else if (method.getName().equals("getMethod")) {
- return HttpMethod.POST;
- } else {
- return null;
- }
- }
-
- }
-
- @Test
- public void canShutdownInstance() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- testInstance.stop(client);
- testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.STOPPED, testInstance.getState());
- }
-
- @Test
- public void canStartInstance() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- if (testInstance.getState() == State.RUNNING) {
- testInstance.stop(client);
- }
- testInstance.start(client);
- testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.RUNNING, testInstance.getState());
- }
-
- @Test
- public void canStartInstanceByAction() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- if (testInstance.getState() == State.RUNNING) {
- testInstance.stop(client);
- }
- assertTrue(testInstance.start(client));
- testInstance = client.listInstances(testInstance.getId()); // reload!
- assertEquals(State.RUNNING, testInstance.getState());
- }
-
- @Test
- public void cannotStartRunningInstance() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- testInstance.start(client);
- assertFalse(testInstance.start(client));
- }
-
- @Test
- public void cannotStopStoppedInstance() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- try {
- testInstance.stop(client);
- assertFalse(testInstance.stop(client));
- } finally {
- testInstance.start(client);
- }
- }
-
- @Test
- public void cannotDestroyRunningInstance() throws DeltaCloudClientException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- testInstance = client.listInstances(testInstance.getId()); // reload
- assertTrue(testInstance.getState() == State.RUNNING);
- assertFalse(testInstance.destroy(client));
- }
-
- @Test
- public void cannotRebootStoppedInstance() throws DeltaCloudClientException,
InterruptedException,
- ExecutionException {
- Instance testInstance = testSetup.getTestInstance();
- DeltaCloudClient client = testSetup.getClient();
- try {
- testInstance.stop(client);
- testInstance = client.listInstances(testInstance.getId()); // reload
- assertTrue(testInstance.getState() == State.STOPPED);
- assertFalse(testInstance.reboot(client));
- } finally {
- testInstance.start(client);
- client.listInstances(testInstance.getId()); // reload
- }
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/InstanceMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/InstanceMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.Instance;
+import org.jboss.tools.deltacloud.client.StateAware.State;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Integration tests for instance related methods in
+ * {@link DeltaCloudClientImpl}.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#listInstances()
+ * @see DeltaCloudClientImpl#createInstance(String)
+ * @see DeltaCloudClientImpl#destroyInstance(String)
+ * @see DeltaCloudClientImpl#startInstance(String)
+ * @see DeltaCloudClientImpl#shutdownInstance(String)
+ */
+public class InstanceMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ /**
+ * #listInstance contains the test instance created in {@link #setUp()}
+ *
+ * @throws DeltaCloudClientException
+ * the delta cloud client exception
+ */
+
+ @Test
+ public void listContainsTestInstance() throws DeltaCloudClientException {
+ DeltaCloudClient client = testSetup.getClient();
+ List<Instance> instances = client.listInstances();
+ assertTrue(instances.size() > 0);
+ Instance testInstance = testSetup.getTestInstance();
+ assertNotNull(testSetup.getInstanceById(testInstance.getId(), client));
+ }
+
+ @Test
+ public void listTestInstance() throws DeltaCloudClientException {
+ Instance instance =
testSetup.getClient().listInstances(testSetup.getTestInstance().getId());
+ assertNotNull(instance);
+ Instance testInstance = testSetup.getTestInstance();
+ assertEquals(testInstance.getId(), instance.getId());
+ assertInstance(
+ testInstance.getName()
+ , testInstance.getOwnerId()
+ , testInstance.getImageId()
+ , testInstance.getRealmId()
+ , testInstance.getProfileId()
+ , testInstance.getMemory()
+ , testInstance.getPrivateAddresses()
+ , testInstance.getPublicAddresses()
+ , instance);
+ }
+
+ @Test(expected = DeltaCloudNotFoundClientException.class)
+ public void listDestroyedInstanceThrowsException() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ testSetup.quietlyDestroyInstance(testInstance);
+ testSetup.getClient().listInstances(testInstance.getId());
+ }
+
+ private void assertInstance(String name, String owner, String ImageId, String realmId,
String profile,
+ String memory, List<String> privateAddresses, List<String>
publicAddresses, Instance instance) {
+ assertNotNull("instance " + name + " was not found", instance);
+ assertEquals(name, instance.getName());
+ assertEquals(owner, instance.getOwnerId());
+ assertEquals(realmId, instance.getRealmId());
+ assertEquals(profile, instance.getProfileId());
+ assertEquals(memory, instance.getMemory());
+ assertTrue(privateAddresses.equals(instance.getPrivateAddresses()));
+ assertTrue(publicAddresses.equals(instance.getPublicAddresses()));
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void cannotDestroyIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
+ DeltaCloudClientImpl unauthenticatedClient = new DeltaCloudClientImpl(
+ MockIntegrationTestContext.DELTACLOUD_URL,
+ "badUser", "badPassword");
+ Image image = testSetup.getFirstImage(unauthenticatedClient);
+ unauthenticatedClient.createInstance(image.getId());
+ }
+
+ @Test
+ public void canCreateInstance() throws DeltaCloudClientException {
+ Instance instance = null;
+ try {
+ Image image = testSetup.getFirstImage(testSetup.getClient());
+ instance = testSetup.getClient().createInstance(image.getId());
+ assertTrue(instance != null);
+ assertEquals(image.getId(), instance.getImageId());
+ assertEquals(State.RUNNING, instance.getState());
+ } finally {
+ testSetup.quietlyDestroyInstance(instance);
+ }
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void cannotDestroyUnknownImageId() throws DeltaCloudClientException {
+ testSetup.getClient().createInstance("dummy");
+ }
+
+ @Test(expected=DeltaCloudClientException.class)
+ public void canDestroy() throws DeltaCloudClientException {
+ Image image = testSetup.getFirstImage(testSetup.getClient());
+ DeltaCloudClient client = testSetup.getClient();
+ Instance instance = client.createInstance(image.getId());
+ instance.stop(client);
+ instance.destroy(client);
+ client.listInstances(instance.getId());
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void destroyThrowsExceptionOnUnknowInstanceId() throws DeltaCloudClientException,
IllegalArgumentException,
+ InstantiationException, IllegalAccessException, InvocationTargetException,
SecurityException,
+ NoSuchMethodException {
+ DeltaCloudClient client = testSetup.getClient();
+ client.performAction(
+ createInstanceAction(
+ "destroy",
+ MockIntegrationTestContext.DELTACLOUD_URL,
+ HttpMethod.POST,
+ new Instance()));
+ }
+
+ private Action<Instance> createInstanceAction(String name, String url, HttpMethod
method, Instance instance) {
+ Action<Instance> action = new Action<Instance>();
+ action.setName(name);
+ action.setMethod(method);
+ action.setOwner(instance);
+ return action;
+ }
+
+ @SuppressWarnings("unused")
+ private class InstanceActionProxy implements InvocationHandler {
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getName().equals("getUrl")) {
+ return MockIntegrationTestContext.DELTACLOUD_URL;
+ } else if (method.getName().equals("getMethod")) {
+ return HttpMethod.POST;
+ } else {
+ return null;
+ }
+ }
+
+ }
+
+ @Test
+ public void canShutdownInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ testInstance.stop(client);
+ testInstance = client.listInstances(testInstance.getId()); // reload!
+ assertEquals(State.STOPPED, testInstance.getState());
+ }
+
+ @Test
+ public void canStartInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ if (testInstance.getState() == State.RUNNING) {
+ testInstance.stop(client);
+ }
+ testInstance.start(client);
+ testInstance = client.listInstances(testInstance.getId()); // reload!
+ assertEquals(State.RUNNING, testInstance.getState());
+ }
+
+ @Test
+ public void canStartInstanceByAction() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ if (testInstance.getState() == State.RUNNING) {
+ testInstance.stop(client);
+ }
+ assertTrue(testInstance.start(client));
+ testInstance = client.listInstances(testInstance.getId()); // reload!
+ assertEquals(State.RUNNING, testInstance.getState());
+ }
+
+ @Test
+ public void cannotStartRunningInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ testInstance.start(client);
+ assertFalse(testInstance.start(client));
+ }
+
+ @Test
+ public void cannotStopStoppedInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ testInstance.stop(client);
+ assertFalse(testInstance.stop(client));
+ } finally {
+ testInstance.start(client);
+ }
+ }
+
+ @Test
+ public void cannotDestroyRunningInstance() throws DeltaCloudClientException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ testInstance = client.listInstances(testInstance.getId()); // reload
+ assertTrue(testInstance.getState() == State.RUNNING);
+ assertFalse(testInstance.destroy(client));
+ }
+
+ @Test
+ public void cannotRebootStoppedInstance() throws DeltaCloudClientException,
InterruptedException,
+ ExecutionException {
+ Instance testInstance = testSetup.getTestInstance();
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ testInstance.stop(client);
+ testInstance = client.listInstances(testInstance.getId()); // reload
+ assertTrue(testInstance.getState() == State.STOPPED);
+ assertFalse(testInstance.reboot(client));
+ } finally {
+ testInstance.start(client);
+ client.listInstances(testInstance.getId()); // reload
+ }
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.JAXBException;
-
-import org.jboss.tools.deltacloud.core.client.Action;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Key;
-import org.jboss.tools.deltacloud.core.client.unmarshal.ActionUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.KeysUnmarshaller;
-import org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyActionResponse;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyResponse;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeysResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class KeyDomUnmarshallingTest {
-
- @Test
- public void keyActionMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
- Action<Key> keyAction = new Action<Key>();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeyActionResponse.keyActionResponse.getBytes());
- new ActionUnmarshaller<Key>().unmarshall(inputStream, keyAction);
- assertNotNull(keyAction);
- assertEquals(KeyActionResponse.name, keyAction.getName());
- assertEquals(KeyActionResponse.url, keyAction.getUrl().toString());
- assertEquals(KeyActionResponse.method.toUpperCase(),
keyAction.getMethod().toString().toUpperCase());
- }
-
- @Test
- public void keyMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
- Key key = new Key();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeyResponse.keyResponse.getBytes());
- new KeyUnmarshaller().unmarshall(inputStream, key);
- assertNotNull(key);
- assertEquals(KeyResponseFakes.KeyResponse.id, key.getId());
- assertEquals(KeyResponse.fingerprint, key.getFingerprint());
- assertEquals(new URL(KeyResponse.url), key.getUrl());
- assertEquals(KeyResponse.pem, key.getPem());
- assertEquals(1, key.getActions().size());
- Action<Key> action = key.getActions().get(0);
- assertNotNull(action);
- assertEquals(KeyResponse.url, action.getUrl().toString());
- assertEquals(KeyResponse.name, action.getName());
- assertEquals(HttpMethod.valueOf(KeyResponse.method.toUpperCase()),
action.getMethod());
- }
-
- @Test
- public void keysMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeysResponse.keysResponse.getBytes());
- List<Key> keys = new ArrayList<Key>();
- new KeysUnmarshaller().unmarshall(inputStream, keys);
- assertEquals(2, keys.size());
- Key key = keys.get(0);
- assertEquals(KeysResponse.id1, key.getId());
- assertEquals(KeysResponse.fingerprint1, key.getFingerprint());
- assertEquals(new URL(KeysResponse.url1), key.getUrl());
- assertEquals(KeysResponse.pem1, key.getPem());
- assertEquals(1, key.getActions().size());
- Action<Key> action = key.getActions().get(0);
- assertNotNull(action);
- assertEquals(KeysResponse.url1, action.getUrl().toString());
- assertEquals(KeysResponse.name1, action.getName());
- assertEquals(HttpMethod.valueOf(KeysResponse.method1.toUpperCase()),
action.getMethod());
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBException;
+
+import org.jboss.tools.deltacloud.client.Action;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Key;
+import org.jboss.tools.deltacloud.client.unmarshal.ActionUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeyUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.KeysUnmarshaller;
+import org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyActionResponse;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeyResponse;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.KeyResponseFakes.KeysResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class KeyDomUnmarshallingTest {
+
+ @Test
+ public void keyActionMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
+ Action<Key> keyAction = new Action<Key>();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeyActionResponse.keyActionResponse.getBytes());
+ new ActionUnmarshaller<Key>().unmarshall(inputStream, keyAction);
+ assertNotNull(keyAction);
+ assertEquals(KeyActionResponse.name, keyAction.getName());
+ assertEquals(KeyActionResponse.url, keyAction.getUrl().toString());
+ assertEquals(KeyActionResponse.method.toUpperCase(),
keyAction.getMethod().toString().toUpperCase());
+ }
+
+ @Test
+ public void keyMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
+ Key key = new Key();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeyResponse.keyResponse.getBytes());
+ new KeyUnmarshaller().unmarshall(inputStream, key);
+ assertNotNull(key);
+ assertEquals(KeyResponseFakes.KeyResponse.id, key.getId());
+ assertEquals(KeyResponse.fingerprint, key.getFingerprint());
+ assertEquals(new URL(KeyResponse.url), key.getUrl());
+ assertEquals(KeyResponse.pem, key.getPem());
+ assertEquals(1, key.getActions().size());
+ Action<Key> action = key.getActions().get(0);
+ assertNotNull(action);
+ assertEquals(KeyResponse.url, action.getUrl().toString());
+ assertEquals(KeyResponse.name, action.getName());
+ assertEquals(HttpMethod.valueOf(KeyResponse.method.toUpperCase()),
action.getMethod());
+ }
+
+ @Test
+ public void keysMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(KeysResponse.keysResponse.getBytes());
+ List<Key> keys = new ArrayList<Key>();
+ new KeysUnmarshaller().unmarshall(inputStream, keys);
+ assertEquals(2, keys.size());
+ Key key = keys.get(0);
+ assertEquals(KeysResponse.id1, key.getId());
+ assertEquals(KeysResponse.fingerprint1, key.getFingerprint());
+ assertEquals(new URL(KeysResponse.url1), key.getUrl());
+ assertEquals(KeysResponse.pem1, key.getPem());
+ assertEquals(1, key.getActions().size());
+ Action<Key> action = key.getActions().get(0);
+ assertNotNull(action);
+ assertEquals(KeysResponse.url1, action.getUrl().toString());
+ assertEquals(KeysResponse.name1, action.getName());
+ assertEquals(HttpMethod.valueOf(KeysResponse.method1.toUpperCase()),
action.getMethod());
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.matchers.JUnitMatchers.hasItem;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClient;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.Key;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Integration tests for key related operations in delta cloud client.
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#createKey(String, String)
- * @see DeltaCloudClientImpl#deleteKey(String)
- */
-public class KeyMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- @Test
- public void canCreateKey() throws DeltaCloudClientException {
- String id = "test" + System.currentTimeMillis();
- DeltaCloudClient client = testSetup.getClient();
- try {
- Key key = client.createKey(id);
- assertNotNull(key);
- assertEquals(id, key.getId());
- } finally {
- quietlyDeleteKey(id);
- }
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void createDuplicateKeyThrowsException() throws DeltaCloudClientException {
- String id = "test" + System.currentTimeMillis();
- DeltaCloudClient client = testSetup.getClient();
- try {
- client.createKey(id);
- client.createKey(id);
- } finally {
- quietlyDeleteKey(id);
- }
- }
-
- /**
- * Checks if a key may be deleted.
- */
- @Test(expected = DeltaCloudNotFoundClientException.class)
- public void canDeleteKey() throws DeltaCloudClientException {
- String id = "test" + System.currentTimeMillis();
- DeltaCloudClient client = testSetup.getClient();
- Key key = client.createKey(id);
- assertNotNull(key);
- assertEquals(id, key.getId());
- key.destroy(client);
- client.listKey(key.getId());
- }
-
- /**
- * checks if the client throws a {@link DeltaCloudNotFoundClientException}
- * if an unknown key is requested.
- *
- * @throws DeltaCloudClientException
- */
- @Test(expected = DeltaCloudNotFoundClientException.class)
- public void listUnknownKeyThrowsException() throws DeltaCloudClientException {
- String id = String.valueOf(System.currentTimeMillis());
- testSetup.getClient().listKey(id);
- }
-
- @Test
- public void canListKey() throws DeltaCloudClientException {
- String id = String.valueOf(System.currentTimeMillis());
- DeltaCloudClient client = testSetup.getClient();
- try {
- Key createdKey = client.createKey(id);
- Key listedKey = client.listKey(id);
- assertEquals(createdKey.getId(), listedKey.getId());
- } finally {
- quietlyDeleteKey(id);
- }
- }
-
- @Test
- public void canListKeys() throws DeltaCloudClientException {
- String id = String.valueOf(System.currentTimeMillis());
- DeltaCloudClient client = testSetup.getClient();
- try {
- final Key createdKey = client.createKey(id);
- List<Key> keys = client.listKeys();
- assertNotNull(keys);
- assertThat(keys, hasItem(new BaseMatcher<Key>() {
-
- @Override
- public boolean matches(Object item) {
- if (item instanceof Key) {
- Key listedKey = (Key) item;
- return
- createdKey.getId().equals(listedKey.getId())
- && createdKey.getFingerprint().equals(listedKey.getFingerprint())
- && createdKey.getPem().equals(listedKey.getPem())
- && createdKey.getUrl().equals(listedKey.getUrl())
- && createdKey.getActions().size() == listedKey.getActions().size();
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- // TODO Auto-generated method stub
-
- }
- }));
- } finally {
- quietlyDeleteKey(id);
- }
- }
-
- private void quietlyDeleteKey(String id) {
- try {
- DeltaCloudClient client = testSetup.getClient();
- Key key = client.listKey(id);
- key.destroy(client);
- } catch (Exception e) {
- // ignore
- }
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/KeyMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/KeyMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.matchers.JUnitMatchers.hasItem;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.jboss.tools.deltacloud.client.DeltaCloudClient;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.Key;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Integration tests for key related operations in delta cloud client.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#createKey(String, String)
+ * @see DeltaCloudClientImpl#deleteKey(String)
+ */
+public class KeyMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ @Test
+ public void canCreateKey() throws DeltaCloudClientException {
+ String id = "test" + System.currentTimeMillis();
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ Key key = client.createKey(id);
+ assertNotNull(key);
+ assertEquals(id, key.getId());
+ } finally {
+ quietlyDeleteKey(id);
+ }
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void createDuplicateKeyThrowsException() throws DeltaCloudClientException {
+ String id = "test" + System.currentTimeMillis();
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ client.createKey(id);
+ client.createKey(id);
+ } finally {
+ quietlyDeleteKey(id);
+ }
+ }
+
+ /**
+ * Checks if a key may be deleted.
+ */
+ @Test(expected = DeltaCloudNotFoundClientException.class)
+ public void canDeleteKey() throws DeltaCloudClientException {
+ String id = "test" + System.currentTimeMillis();
+ DeltaCloudClient client = testSetup.getClient();
+ Key key = client.createKey(id);
+ assertNotNull(key);
+ assertEquals(id, key.getId());
+ key.destroy(client);
+ client.listKey(key.getId());
+ }
+
+ /**
+ * checks if the client throws a {@link DeltaCloudNotFoundClientException}
+ * if an unknown key is requested.
+ *
+ * @throws DeltaCloudClientException
+ */
+ @Test(expected = DeltaCloudNotFoundClientException.class)
+ public void listUnknownKeyThrowsException() throws DeltaCloudClientException {
+ String id = String.valueOf(System.currentTimeMillis());
+ testSetup.getClient().listKey(id);
+ }
+
+ @Test
+ public void canListKey() throws DeltaCloudClientException {
+ String id = String.valueOf(System.currentTimeMillis());
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ Key createdKey = client.createKey(id);
+ Key listedKey = client.listKey(id);
+ assertEquals(createdKey.getId(), listedKey.getId());
+ } finally {
+ quietlyDeleteKey(id);
+ }
+ }
+
+ @Test
+ public void canListKeys() throws DeltaCloudClientException {
+ String id = String.valueOf(System.currentTimeMillis());
+ DeltaCloudClient client = testSetup.getClient();
+ try {
+ final Key createdKey = client.createKey(id);
+ List<Key> keys = client.listKeys();
+ assertNotNull(keys);
+ assertThat(keys, hasItem(new BaseMatcher<Key>() {
+
+ @Override
+ public boolean matches(Object item) {
+ if (item instanceof Key) {
+ Key listedKey = (Key) item;
+ return
+ createdKey.getId().equals(listedKey.getId())
+ && createdKey.getFingerprint().equals(listedKey.getFingerprint())
+ && createdKey.getPem().equals(listedKey.getPem())
+ && createdKey.getUrl().equals(listedKey.getUrl())
+ && createdKey.getActions().size() == listedKey.getActions().size();
+ }
+ return false;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ // TODO Auto-generated method stub
+
+ }
+ }));
+ } finally {
+ quietlyDeleteKey(id);
+ }
+ }
+
+ private void quietlyDeleteKey(String id) {
+ try {
+ DeltaCloudClient client = testSetup.getClient();
+ Key key = client.listKey(id);
+ key.destroy(client);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.HardwareProfile;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Integration tests for key related operations in delta cloud client.
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#listProfiles()
- * @see DeltaCloudClientImpl#listProfie(String)
- */
-public class ProfileMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- @Test
- public void canListProfiles() throws DeltaCloudClientException {
- List<HardwareProfile> hardwareProfiles = testSetup.getClient().listProfiles();
- assertNotNull(hardwareProfiles);
- assertTrue(hardwareProfiles.size() > 0);
- }
-
- @Test
- public void canGetProfile() throws DeltaCloudClientException {
- // get a profile seen in the web UI
- HardwareProfile profile = testSetup.getClient().listProfile("m1-small");
- assertNotNull(profile);
- assertHardWareProfile("i386", "1740.8 MB", "160 GB",
"1", profile);
- }
-
- public void assertHardWareProfile(String architecture, String memory, String storage,
String cpu, HardwareProfile profile) {
- assertEquals(architecture, profile.getArchitecture());
- assertEquals(memory, profile.getMemory());
- assertEquals(storage, profile.getStorage());
- assertEquals(cpu, profile.getCPU());
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ProfileMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ProfileMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.HardwareProfile;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Integration tests for key related operations in delta cloud client.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#listProfiles()
+ * @see DeltaCloudClientImpl#listProfie(String)
+ */
+public class ProfileMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ @Test
+ public void canListProfiles() throws DeltaCloudClientException {
+ List<HardwareProfile> hardwareProfiles = testSetup.getClient().listProfiles();
+ assertNotNull(hardwareProfiles);
+ assertTrue(hardwareProfiles.size() > 0);
+ }
+
+ @Test
+ public void canGetProfile() throws DeltaCloudClientException {
+ // get a profile seen in the web UI
+ HardwareProfile profile = testSetup.getClient().listProfile("m1-small");
+ assertNotNull(profile);
+ assertHardWareProfile("i386", "1740.8 MB", "160 GB",
"1", profile);
+ }
+
+ public void assertHardWareProfile(String architecture, String memory, String storage,
String cpu, HardwareProfile profile) {
+ assertEquals(architecture, profile.getArchitecture());
+ assertEquals(memory, profile.getMemory());
+ assertEquals(storage, profile.getStorage());
+ assertEquals(cpu, profile.getCPU());
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Realm;
-import org.jboss.tools.deltacloud.core.client.Realm.RealmState;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmUnmarshaller;
-import org.jboss.tools.deltacloud.core.client.unmarshal.RealmsUnmarshaller;
-import org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes;
-import
org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes.RealmsResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class RealmDomUnmarshallingTest {
-
- @Test
- public void realmMayBeUnmarshalled() throws DeltaCloudClientException {
- Realm realm = new Realm();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.realmResponse.response.getBytes());
- new RealmUnmarshaller().unmarshall(inputStream, realm);
- assertNotNull(realm);
- assertEquals(RealmResponseFakes.realmResponse.id, realm.getId());
- assertEquals(RealmResponseFakes.realmResponse.name, realm.getName());
- assertEquals(RealmState.valueOf(RealmResponseFakes.realmResponse.state.toUpperCase()),
realm.getState());
- assertEquals(RealmResponseFakes.realmResponse.getIntLimit(), realm.getLimit());
- }
-
- @Test
- public void emptyLimitSetsDefaultLimit() throws DeltaCloudClientException {
- Realm realm = new Realm();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.invalidLimitRealmResponse.response.getBytes());
- new RealmUnmarshaller().unmarshall(inputStream, realm);
- assertNotNull(realm);
- assertEquals(Realm.LIMIT_DEFAULT, realm.getLimit());
- }
-
- @Test
- public void invalidStateSetsUNKNOWNState() throws DeltaCloudClientException {
- Realm realm = new Realm();
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.invalidLimitRealmResponse.response.getBytes());
- new RealmUnmarshaller().unmarshall(inputStream, realm);
- assertNotNull(realm);
- assertEquals(Realm.LIMIT_DEFAULT, realm.getLimit());
- }
-
- @Test
- public void realmsMayBeUnmarshalled() throws DeltaCloudClientException {
- ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmsResponse.response.getBytes());
- List<Realm> realms = new ArrayList<Realm>();
- new RealmsUnmarshaller().unmarshall(inputStream, realms);
- assertEquals(2, realms.size());
-
- Realm realm = realms.get(0);
- assertEquals(RealmsResponse.id1, realm.getId());
- assertEquals(RealmsResponse.name1, realm.getName());
-
- realm = realms.get(1);
- assertEquals(RealmsResponse.id2, realm.getId());
- assertEquals(RealmsResponse.name2, realm.getName());
- }
-
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmDomUnmarshallingTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmDomUnmarshallingTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Realm;
+import org.jboss.tools.deltacloud.client.Realm.RealmState;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmUnmarshaller;
+import org.jboss.tools.deltacloud.client.unmarshal.RealmsUnmarshaller;
+import org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes;
+import
org.jboss.tools.internal.deltacloud.client.test.fakes.RealmResponseFakes.RealmsResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class RealmDomUnmarshallingTest {
+
+ @Test
+ public void realmMayBeUnmarshalled() throws DeltaCloudClientException {
+ Realm realm = new Realm();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.realmResponse.response.getBytes());
+ new RealmUnmarshaller().unmarshall(inputStream, realm);
+ assertNotNull(realm);
+ assertEquals(RealmResponseFakes.realmResponse.id, realm.getId());
+ assertEquals(RealmResponseFakes.realmResponse.name, realm.getName());
+ assertEquals(RealmState.valueOf(RealmResponseFakes.realmResponse.state.toUpperCase()),
realm.getState());
+ assertEquals(RealmResponseFakes.realmResponse.getIntLimit(), realm.getLimit());
+ }
+
+ @Test
+ public void emptyLimitSetsDefaultLimit() throws DeltaCloudClientException {
+ Realm realm = new Realm();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.invalidLimitRealmResponse.response.getBytes());
+ new RealmUnmarshaller().unmarshall(inputStream, realm);
+ assertNotNull(realm);
+ assertEquals(Realm.LIMIT_DEFAULT, realm.getLimit());
+ }
+
+ @Test
+ public void invalidStateSetsUNKNOWNState() throws DeltaCloudClientException {
+ Realm realm = new Realm();
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmResponseFakes.invalidLimitRealmResponse.response.getBytes());
+ new RealmUnmarshaller().unmarshall(inputStream, realm);
+ assertNotNull(realm);
+ assertEquals(Realm.LIMIT_DEFAULT, realm.getLimit());
+ }
+
+ @Test
+ public void realmsMayBeUnmarshalled() throws DeltaCloudClientException {
+ ByteArrayInputStream inputStream = new
ByteArrayInputStream(RealmsResponse.response.getBytes());
+ List<Realm> realms = new ArrayList<Realm>();
+ new RealmsUnmarshaller().unmarshall(inputStream, realms);
+ assertEquals(2, realms.size());
+
+ Realm realm = realms.get(0);
+ assertEquals(RealmsResponse.id1, realm.getId());
+ assertEquals(RealmsResponse.name1, realm.getName());
+
+ realm = realms.get(1);
+ assertEquals(RealmsResponse.id2, realm.getId());
+ assertEquals(RealmsResponse.name2, realm.getName());
+ }
+
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.Realm;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Integration tests for key related operations in delta cloud client.
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#listRealms()
- * @see DeltaCloudClientImpl#listRealm(String)
- */
-public class RealmMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- @Test
- public void canListRealms() throws DeltaCloudClientException {
- List<Realm> realms = testSetup.getClient().listRealms();
- assertNotNull(realms);
- assertTrue(realms.size() > 0);
- }
-
- @Test
- public void canGetProfile() throws DeltaCloudClientException {
- // get a profile seen in the web UI
- Realm realm = testSetup.getClient().listRealms("eu");
- assertNotNull(realm);
- assertRealm("Europe", Realm.RealmState.AVAILABLE, 0, realm);
- }
-
- public void assertRealm(String name, Realm.RealmState state, int limit, Realm realm) {
- assertEquals(name, realm.getName());
- assertEquals(state, realm.getState());
- assertEquals(limit, realm.getLimit());
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/RealmMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/RealmMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.Realm;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Integration tests for key related operations in delta cloud client.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#listRealms()
+ * @see DeltaCloudClientImpl#listRealm(String)
+ */
+public class RealmMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ @Test
+ public void canListRealms() throws DeltaCloudClientException {
+ List<Realm> realms = testSetup.getClient().listRealms();
+ assertNotNull(realms);
+ assertTrue(realms.size() > 0);
+ }
+
+ @Test
+ public void canGetProfile() throws DeltaCloudClientException {
+ // get a profile seen in the web UI
+ Realm realm = testSetup.getClient().listRealms("eu");
+ assertNotNull(realm);
+ assertRealm("Europe", Realm.RealmState.AVAILABLE, 0, realm);
+ }
+
+ public void assertRealm(String name, Realm.RealmState state, int limit, Realm realm) {
+ assertEquals(name, realm.getName());
+ assertEquals(state, realm.getState());
+ assertEquals(limit, realm.getLimit());
+ }
+}
Deleted:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java 2011-05-19
14:57:51 UTC (rev 31383)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.internal.deltacloud.client.test.core.client;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.tools.deltacloud.core.client.API.Driver;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
-import org.jboss.tools.deltacloud.core.client.HttpMethod;
-import org.jboss.tools.deltacloud.core.client.Image;
-import org.jboss.tools.deltacloud.core.client.request.DeltaCloudRequest;
-import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
-import org.jboss.tools.internal.deltacloud.client.test.fakes.ServerFake;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Integration tests for {@link DeltaCloudClientImpl#getServerType()}.
- *
- * @author Andre Dietisheim
- *
- * @see DeltaCloudClientImpl#getServerType()
- */
-public class ServerTypeMockIntegrationTest {
-
- private MockIntegrationTestContext testSetup;
-
- @Before
- public void setUp() throws IOException, DeltaCloudClientException {
- this.testSetup = new MockIntegrationTestContext();
- testSetup.setUp();
- }
-
- @After
- public void tearDown() {
- testSetup.tearDown();
- }
-
- @Test
- public void recognizesDeltaCloud() throws IOException {
- assertEquals(Driver.MOCK, testSetup.getClient().getServerType());
- }
-
- /**
- *
- * #getServerType reports {@link DeltaCloudClient.DeltaCloudType#UNKNOWN) if it queries
a fake server that responds with a unknown answer.
- *
- * @throws IOException
- * Signals that an I/O exception has occurred.
- * @throws DeltaCloudClientException
- */
- @Test
- public void reportsUnknownUrl() throws IOException, DeltaCloudClientException {
- ServerFake serverFake =
- new ServerFake(
- new URL(MockIntegrationTestContext.SERVERFAKE_URL).getPort(),
- "<dummy></dummy>");
- serverFake.start();
- try {
- assertEquals(
- Driver.UNKNOWN,
- new DeltaCloudClientImpl(
- MockIntegrationTestContext.SERVERFAKE_URL,
MockIntegrationTestContext.DELTACLOUD_USER,
- MockIntegrationTestContext.DELTACLOUD_PASSWORD).getServerType());
- } finally {
- serverFake.stop();
- }
- }
-
- @Test(expected = DeltaCloudClientException.class)
- public void listImages_cannotListIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
- DeltaCloudClientImpl client = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL, "badUser",
- "badPassword");
- client.listImages();
- }
-
- @Test
- public void throwsDeltaCloudClientExceptionOnUnknownResource() {
- try {
- DeltaCloudClientImpl errorClient = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL) {
- @Override
- public List<Image> listImages() throws DeltaCloudClientException {
- request(new DeltaCloudRequest() {
-
- @Override
- public URL getUrl() throws MalformedURLException {
- return new URL(MockIntegrationTestContext.DELTACLOUD_URL + "/DUMMY");
- }
-
- @Override
- public HttpMethod getHttpMethod() {
- return HttpMethod.GET;
- }
-
- @Override
- public String getUrlString() {
- return null;
- }
- }
- );
- return Collections.emptyList();
- }
- };
- errorClient.listImages();
- fail("no exception catched");
- } catch (Exception e) {
- assertEquals(DeltaCloudNotFoundClientException.class, e.getClass());
- }
- }
-}
Copied:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java
(from rev 31412,
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/core/client/ServerTypeMockIntegrationTest.java)
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/client/ServerTypeMockIntegrationTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
+package org.jboss.tools.internal.deltacloud.client.test.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.tools.deltacloud.client.API.Driver;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.client.DeltaCloudNotFoundClientException;
+import org.jboss.tools.deltacloud.client.HttpMethod;
+import org.jboss.tools.deltacloud.client.Image;
+import org.jboss.tools.deltacloud.client.request.DeltaCloudRequest;
+import
org.jboss.tools.internal.deltacloud.client.test.context.MockIntegrationTestContext;
+import org.jboss.tools.internal.deltacloud.client.test.fakes.ServerFake;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Integration tests for {@link DeltaCloudClientImpl#getServerType()}.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see DeltaCloudClientImpl#getServerType()
+ */
+public class ServerTypeMockIntegrationTest {
+
+ private MockIntegrationTestContext testSetup;
+
+ @Before
+ public void setUp() throws IOException, DeltaCloudClientException {
+ this.testSetup = new MockIntegrationTestContext();
+ testSetup.setUp();
+ }
+
+ @After
+ public void tearDown() {
+ testSetup.tearDown();
+ }
+
+ @Test
+ public void recognizesDeltaCloud() throws IOException {
+ assertEquals(Driver.MOCK, testSetup.getClient().getServerType());
+ }
+
+ /**
+ *
+ * #getServerType reports {@link DeltaCloudClient.DeltaCloudType#UNKNOWN) if it queries
a fake server that responds with a unknown answer.
+ *
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ * @throws DeltaCloudClientException
+ */
+ @Test
+ public void reportsUnknownUrl() throws IOException, DeltaCloudClientException {
+ ServerFake serverFake =
+ new ServerFake(
+ new URL(MockIntegrationTestContext.SERVERFAKE_URL).getPort(),
+ "<dummy></dummy>");
+ serverFake.start();
+ try {
+ assertEquals(
+ Driver.UNKNOWN,
+ new DeltaCloudClientImpl(
+ MockIntegrationTestContext.SERVERFAKE_URL,
MockIntegrationTestContext.DELTACLOUD_USER,
+ MockIntegrationTestContext.DELTACLOUD_PASSWORD).getServerType());
+ } finally {
+ serverFake.stop();
+ }
+ }
+
+ @Test(expected = DeltaCloudClientException.class)
+ public void listImages_cannotListIfNotAuthenticated() throws MalformedURLException,
DeltaCloudClientException {
+ DeltaCloudClientImpl client = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL, "badUser",
+ "badPassword");
+ client.listImages();
+ }
+
+ @Test
+ public void throwsDeltaCloudClientExceptionOnUnknownResource() {
+ try {
+ DeltaCloudClientImpl errorClient = new
DeltaCloudClientImpl(MockIntegrationTestContext.DELTACLOUD_URL) {
+ @Override
+ public List<Image> listImages() throws DeltaCloudClientException {
+ request(new DeltaCloudRequest() {
+
+ @Override
+ public URL getUrl() throws MalformedURLException {
+ return new URL(MockIntegrationTestContext.DELTACLOUD_URL + "/DUMMY");
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public String getUrlString() {
+ return null;
+ }
+ }
+ );
+ return Collections.emptyList();
+ }
+ };
+ errorClient.listImages();
+ fail("no exception catched");
+ } catch (Exception e) {
+ assertEquals(DeltaCloudNotFoundClientException.class, e.getClass());
+ }
+ }
+}
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/context/MockIntegrationTestContext.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.context;
import static org.junit.Assert.assertNotNull;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/APIResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/APIResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/APIResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
/**
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/HardwareProfileResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
import org.jboss.tools.deltacloud.client.Property;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ImageResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ImageResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ImageResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/InstanceResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
import org.jboss.tools.deltacloud.client.StateAware.State;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/KeyResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/KeyResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/KeyResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
/**
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/RealmResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
import org.jboss.tools.deltacloud.client.Realm.RealmState;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerFake.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerFake.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerFake.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
import java.io.IOException;
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerResponseFakes.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerResponseFakes.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/test/fakes/ServerResponseFakes.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.test.fakes;
/**
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java 2011-05-22
19:49:05 UTC (rev 31419)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.client.test/src/org/jboss/tools/internal/deltacloud/client/utils/test/UrlBuilderTest.java 2011-05-23
07:28:29 UTC (rev 31420)
@@ -1,13 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************************/
package org.jboss.tools.internal.deltacloud.client.utils.test;
import static org.junit.Assert.assertEquals;