diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java index dc4b274a8d..b02650dfd8 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java @@ -82,7 +82,7 @@ public class AllocateAndAddFloatingIpToNode implements FloatingIP ip = null; try { logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId()); - ip = floatingIpApi.allocate(); + ip = floatingIpApi.create(); } catch (InsufficientResourcesException e) { logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId()); logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId()); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java index fb59e5c0eb..5a81b499d2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java @@ -63,7 +63,7 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function> removing floatingIp(%s) from node(%s)", ip, id); floatingIpApi.removeFromServer(ip.getIp(), id.getId()); logger.debug(">> deallocating floatingIp(%s)", ip); - floatingIpApi.deallocate(ip.getId()); + floatingIpApi.delete(ip.getId()); } floatingIpCache.invalidate(id); return id; @@ -71,6 +71,6 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function securityGroupCache; private final LoadingCache keyPairCache; private final NovaApi novaApi; @@ -77,15 +77,15 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT GroupNamingConvention.Factory namingConvention, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, - AllocateAndAddFloatingIpToNode allocateAndAddFloatingIpToNode, + AllocateAndAddFloatingIpToNode createAndAddFloatingIpToNode, LoadingCache securityGroupCache, LoadingCache keyPairCache, NovaApi novaApi) { super(addNodeWithTagStrategy, listNodesStrategy, namingConvention, executor, customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory); this.securityGroupCache = checkNotNull(securityGroupCache, "securityGroupCache"); this.keyPairCache = checkNotNull(keyPairCache, "keyPairCache"); - this.allocateAndAddFloatingIpToNode = checkNotNull(allocateAndAddFloatingIpToNode, - "allocateAndAddFloatingIpToNode"); + this.createAndAddFloatingIpToNode = checkNotNull(createAndAddFloatingIpToNode, + "createAndAddFloatingIpToNode"); this.novaApi = checkNotNull(novaApi, "novaApi"); } @@ -153,7 +153,7 @@ public class ApplyNovaTemplateOptionsCreateNodesWithGroupEncodedIntoNameThenAddT NovaTemplateOptions templateOptions = NovaTemplateOptions.class.cast(template.getOptions()); if (templateOptions.shouldAutoAssignFloatingIp()) { - return Futures.compose(future, allocateAndAddFloatingIpToNode, executor); + return Futures.compose(future, createAndAddFloatingIpToNode, executor); } else { return future; } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java index e8548caebd..3275b62b01 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaProperties.java @@ -31,10 +31,10 @@ public class NovaProperties { public static final String TIMEOUT_SECURITYGROUP_PRESENT = "jclouds.openstack-nova.timeout.securitygroup-present"; /** - * Whenever a node is created, automatically allocate and assign a floating ip address, also - * deallocate when the node is destroyed. + * Whenever a node is created, automatically create and assign a floating ip address, also + * delete when the node is destroyed. */ - public static final String AUTO_ALLOCATE_FLOATING_IPS = "jclouds.openstack-nova.auto-allocate-floating-ips"; + public static final String AUTO_ALLOCATE_FLOATING_IPS = "jclouds.openstack-nova.auto-create-floating-ips"; /** * Whenever a node is created, automatically generate keypairs for groups, as needed, also diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java index e7b0b9db1b..33987cf9a7 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java @@ -57,17 +57,17 @@ public interface FloatingIPApi { /** * Allocate a Floating IP address * - * @return a newly allocated FloatingIP + * @return a newly created FloatingIP */ - FloatingIP allocate(); + FloatingIP create(); /** - * Deallocate a Floating IP address + * Decreate a Floating IP address * * @param id * the Floating IP id */ - void deallocate(String id); + void delete(String id); /** * Add a Floating IP address to a Server diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java index 0b30fcd442..391de9fdd2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java @@ -84,7 +84,7 @@ public interface FloatingIPAsyncApi { ListenableFuture get(@PathParam("id") String id); /** - * @see FloatingIPApi#allocate + * @see FloatingIPApi#create */ @POST @Path("/os-floating-ips") @@ -93,16 +93,16 @@ public interface FloatingIPAsyncApi { @Produces(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) @Payload("{}") - ListenableFuture allocate(); + ListenableFuture create(); /** - * @see FloatingIPApi#deallocate + * @see FloatingIPApi#delete */ @DELETE @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) @Path("/os-floating-ips/{id}") - ListenableFuture deallocate(@PathParam("id") String id); + ListenableFuture delete(@PathParam("id") String id); /** * @see FloatingIPApi#addToServer diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java index c8acfec60c..c19cc001c1 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest.java @@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSet; * @see KeystoneProperties#CREDENTIAL_TYPE * @author Adrian Cole */ -@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest") +@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest") public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseNovaApiExpectTest { public AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest() { identity = "identity"; diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/NovaErrorHandlerTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/NovaErrorHandlerTest.java index ec16e85c08..2691715488 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/NovaErrorHandlerTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/NovaErrorHandlerTest.java @@ -81,7 +81,7 @@ public class NovaErrorHandlerTest { URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/37936628937291/os-floating-ips"), 400, "HTTP/1.1 400 Bad Request", - "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot allocate any more addresses\", \"code\": 400}}", + "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot create any more addresses\", \"code\": 400}}", InsufficientResourcesException.class); } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java index 39062ed150..97f763de2d 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNodeExpectTest.java @@ -57,7 +57,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer host).name("Server 71592").status(Status.RUNNING).privateAddresses(ImmutableSet.of("10.4.27.237")) .credentials(LoginCredentials.builder().password("foo").build()).build(); - HttpRequest allocateFloatingIP = HttpRequest.builder().method("POST").endpoint( + HttpRequest createFloatingIP = HttpRequest.builder().method("POST").endpoint( URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips")).headers( ImmutableMultimap. builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).payload(payloadFromStringWithContentType("{}", "application/json")).build(); @@ -65,7 +65,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer HttpResponse addFloatingIPResponse = HttpResponse.builder().statusCode(200).build(); public void testAllocateWhenAllocationReturnsIpIsAddedToServerAndUpdatesNodeMetadataButSavesCredentials() throws Exception { - HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(200).payload( + HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/floatingip_details.json")).build(); HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.3"); @@ -73,7 +73,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer AllocateAndAddFloatingIpToNode fn = requestsSendResponses( ImmutableMap. builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put( - allocateFloatingIP, allocateFloatingIPResponse) + createFloatingIP, createFloatingIPResponse) .put(addFloatingIPRequest, addFloatingIPResponse).build()).getContext().utils().injector() .getInstance(AllocateAndAddFloatingIpToNode.class); @@ -98,12 +98,12 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer } public void testAllocateWhenAllocationFailsLookupUnusedIpAddToServerAndUpdatesNodeMetadata() throws Exception { - HttpResponse allocateFloatingIPResponse = HttpResponse + HttpResponse createFloatingIPResponse = HttpResponse .builder() .statusCode(400) .payload( payloadFromStringWithContentType( - "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot allocate any more addresses\", \"code\": 400}}", + "{\"badRequest\": {\"message\": \"AddressLimitExceeded: Address quota exceeded. You cannot create any more addresses\", \"code\": 400}}", "application/json")).build(); HttpRequest list = HttpRequest.builder().method("GET").endpoint( @@ -119,7 +119,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer AllocateAndAddFloatingIpToNode fn = requestsSendResponses( ImmutableMap. builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put( - allocateFloatingIP, allocateFloatingIPResponse) + createFloatingIP, createFloatingIPResponse) .put(addFloatingIPRequest, addFloatingIPResponse).put(list, listResponseForUnassigned).build()).getContext().utils().injector() .getInstance(AllocateAndAddFloatingIpToNode.class); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java index 602517c9f8..40312f4891 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AdminActionsApiLiveTest.java @@ -33,9 +33,9 @@ import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; import org.jclouds.openstack.nova.v2_0.options.CreateBackupOfServerOptions; import org.jclouds.openstack.v2_0.features.ExtensionApi; import org.testng.SkipException; -import org.testng.annotations.AfterGroups; +import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Optional; @@ -60,7 +60,7 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { private String testServerId; private String backupImageId; - @BeforeGroups(groups = { "integration", "live" }) + @BeforeClass(groups = {"integration", "live"}) @Override public void setupContext() { super.setupContext(); @@ -74,9 +74,9 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { } } - @AfterGroups(groups = "live", alwaysRun = true) + @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDown() { + protected void tearDownContext() { if (apiOption.isPresent()) { if (testServerId != null) { assertTrue(novaContext.getApi().getServerApiForZone(zone).delete(testServerId)); @@ -85,7 +85,7 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { imageApi.delete(backupImageId); } } - super.tearDown(); + super.tearDownContext(); } protected void skipOnAdminExtensionAbsent() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java index fc2ec17238..0b24f84d39 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FlavorExtraSpecsApiLiveTest.java @@ -27,8 +27,8 @@ import java.util.Map; import org.jclouds.openstack.nova.v2_0.features.FlavorApi; import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; import org.jclouds.openstack.v2_0.domain.Resource; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Optional; @@ -50,7 +50,7 @@ public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest { private Resource testFlavor; private Map testSpecs = ImmutableMap.of("jclouds-test", "some data", "jclouds-test2", "more data!"); - @BeforeGroups(groups = { "integration", "live" }) + @BeforeClass(groups = {"integration", "live"}) @Override public void setupContext() { super.setupContext(); @@ -59,15 +59,15 @@ public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest { apiOption = novaContext.getApi().getFlavorExtraSpecsExtensionForZone(zone); } - @AfterGroups(groups = "live") + @AfterClass(groups = { "integration", "live" }) @Override - public void tearDown() { + protected void tearDownContext() { if (apiOption.isPresent() && testFlavor != null) { for(String key : testSpecs.keySet()) { assertTrue(apiOption.get().deleteMetadataKey(testFlavor.getId(), key)); } } - super.tearDown(); + super.tearDownContext(); } public void testCreateExtraSpecs() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java index 3d85f11ce3..141408edea 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiExpectTest.java @@ -133,7 +133,7 @@ public class FloatingIPApiExpectTest extends BaseNovaApiExpectTest { } public void testAllocateWhenResponseIs2xx() throws Exception { - HttpRequest allocateFloatingIP = HttpRequest + HttpRequest createFloatingIP = HttpRequest .builder() .method("POST") .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") @@ -141,20 +141,20 @@ public class FloatingIPApiExpectTest extends BaseNovaApiExpectTest { .addHeader("X-Auth-Token", authToken) .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(200) + HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResource("/floatingip_details.json")).build(); NovaApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP, - allocateFloatingIPResponse); + responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, + createFloatingIPResponse); - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocate().toString(), + assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().toString(), new ParseFloatingIPTest().expected().toString()); } public void testAllocateWhenResponseIs404() throws Exception { - HttpRequest allocateFloatingIP = HttpRequest + HttpRequest createFloatingIP = HttpRequest .builder() .method("POST") .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") @@ -162,13 +162,13 @@ public class FloatingIPApiExpectTest extends BaseNovaApiExpectTest { .addHeader("X-Auth-Token", authToken) .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(404).build(); + HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build(); NovaApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP, - allocateFloatingIPResponse); + responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, + createFloatingIPResponse); - assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocate()); + assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create()); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java index 9f4e439d8a..164be4fdbc 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApiLiveTest.java @@ -68,13 +68,13 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { } @Test - public void testAllocateAndDeallocateFloatingIPs() throws Exception { + public void testAllocateAndDecreateFloatingIPs() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); - FloatingIP floatingIP = api.allocate(); + FloatingIP floatingIP = api.create(); assertNotNull(floatingIP); Set response = api.list().toImmutableSet(); @@ -85,7 +85,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { } assertTrue(ipInSet); - api.deallocate(floatingIP.getId()); + api.delete(floatingIP.getId()); response = api.list().toImmutableSet(); ipInSet = false; @@ -107,7 +107,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { FloatingIPApi api = apiOption.get(); ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId); Server server = createServerInZone(zoneId); - FloatingIP floatingIP = api.allocate(); + FloatingIP floatingIP = api.create(); assertNotNull(floatingIP); try { api.addToServer(floatingIP.getIp(), server.getId()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java index 793ba42fe2..42b81d39c4 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApiExpectTest.java @@ -135,7 +135,7 @@ public class FloatingIPAsyncApiExpectTest extends BaseNovaAsyncApiExpectTest { } public void testAllocateWhenResponseIs2xx() throws Exception { - HttpRequest allocateFloatingIP = HttpRequest + HttpRequest createFloatingIP = HttpRequest .builder() .method("POST") .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") @@ -143,20 +143,20 @@ public class FloatingIPAsyncApiExpectTest extends BaseNovaAsyncApiExpectTest { .addHeader("X-Auth-Token", authToken) .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(200) + HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(200) .payload(payloadFromResource("/floatingip_details.json")).build(); NovaAsyncApi apiWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP, - allocateFloatingIPResponse); + responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, + createFloatingIPResponse); - assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocate().get() + assertEquals(apiWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get() .toString(), new ParseFloatingIPTest().expected().toString()); } public void testAllocateWhenResponseIs404() throws Exception { - HttpRequest allocateFloatingIP = HttpRequest + HttpRequest createFloatingIP = HttpRequest .builder() .method("POST") .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-floating-ips") @@ -164,13 +164,13 @@ public class FloatingIPAsyncApiExpectTest extends BaseNovaAsyncApiExpectTest { .addHeader("X-Auth-Token", authToken) .payload(payloadFromStringWithContentType("{}", "application/json")).build(); - HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(404).build(); + HttpResponse createFloatingIPResponse = HttpResponse.builder().statusCode(404).build(); NovaAsyncApi apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, - responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP, - allocateFloatingIPResponse); + responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createFloatingIP, + createFloatingIPResponse); - assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().allocate().get()); + assertNull(apiWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().create().get()); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java index 847ad551c5..339bbf9f24 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApiLiveTest.java @@ -28,8 +28,8 @@ import java.util.Set; import org.jclouds.openstack.nova.v2_0.domain.Host; import org.jclouds.openstack.nova.v2_0.domain.HostAggregate; import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Optional; @@ -49,7 +49,7 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest { private HostAggregate testAggregate; - @BeforeGroups(groups = {"integration", "live"}) + @BeforeClass(groups = {"integration", "live"}) @Override public void setupContext() { super.setupContext(); @@ -58,13 +58,13 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest { hostAdminOption = novaContext.getApi().getHostAdministrationExtensionForZone(zone); } + @AfterClass(groups = { "integration", "live" }) @Override - @AfterGroups(groups = {"integration", "live"}) - public void tearDown() { + protected void tearDownContext() { if (testAggregate != null) { assertTrue(apiOption.get().delete(testAggregate.getId())); } - super.tearDown(); + super.tearDownContext(); } public void testCreateAggregate() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java index 0d9363cfb5..4e1efbf00b 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiLiveTest.java @@ -31,8 +31,8 @@ import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; import org.jclouds.openstack.nova.v2_0.options.CreateVolumeOptions; import org.jclouds.openstack.nova.v2_0.options.CreateVolumeSnapshotOptions; import org.jclouds.predicates.RetryablePredicate; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Objects; @@ -54,7 +54,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { private Volume testVolume; private VolumeSnapshot testSnapshot; - @BeforeGroups(groups = { "integration", "live" }) + @BeforeClass(groups = {"integration", "live"}) @Override public void setupContext() { super.setupContext(); @@ -62,9 +62,9 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { volumeOption = novaContext.getApi().getVolumeExtensionForZone(zone); } - @AfterGroups(groups = "live", alwaysRun = true) + @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDown() { + protected void tearDownContext() { if (volumeOption.isPresent()) { if (testSnapshot != null) { final String snapshotId = testSnapshot.getId(); @@ -87,7 +87,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { }, 180 * 1000L).apply(volumeOption.get())); } } - super.tearDown(); + super.tearDownContext(); } public void testCreateVolume() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java index 941613ec50..3733c4beb9 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiLiveTest.java @@ -28,7 +28,7 @@ import org.jclouds.openstack.nova.v2_0.domain.VolumeType; import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest; import org.jclouds.openstack.nova.v2_0.options.CreateVolumeTypeOptions; import org.jclouds.predicates.RetryablePredicate; -import org.testng.annotations.AfterGroups; +import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -59,9 +59,10 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { volumeTypeOption = novaContext.getApi().getVolumeTypeExtensionForZone(zone); } - @AfterGroups(groups = "live") + + @AfterClass(groups = { "integration", "live" }) @Override - protected void tearDown() { + protected void tearDownContext() { if (volumeTypeOption.isPresent()) { if (testVolumeType != null) { final String id = testVolumeType.getId(); @@ -74,7 +75,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { }, 5 * 1000L).apply(volumeTypeOption.get())); } } - super.tearDown(); + super.tearDownContext(); } public void testCreateVolumeType() { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java index 6c3f325676..678115aa6c 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ImageApiLiveTest.java @@ -65,8 +65,8 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { assertNotNull(image.getName()); assertNotNull(image.getLinks()); assertNotNull(image.getCreated()); - assertTrue(image.getMinDisk() > 0); - assertTrue(image.getMinRam() > 0); + // image.getMinDisk() can be zero + // image.getMinRam() can be zero assertTrue(image.getProgress() >= 0 && image.getProgress() <= 100); assertNotNull(image.getStatus()); // image.getServer() can be null diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java index a108eef9ec..79bc69ab91 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/internal/BaseNovaApiLiveTest.java @@ -33,9 +33,9 @@ import org.jclouds.openstack.nova.v2_0.domain.ServerCreated; import org.jclouds.openstack.nova.v2_0.features.FlavorApi; import org.jclouds.openstack.nova.v2_0.features.ImageApi; import org.jclouds.openstack.nova.v2_0.features.ServerApi; +import org.jclouds.openstack.v2_0.domain.Resource; import org.jclouds.rest.RestContext; -import org.testng.annotations.AfterGroups; -import org.testng.annotations.BeforeGroups; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Throwables; @@ -50,6 +50,7 @@ import com.google.common.collect.Ordering; */ @Test(groups = "live") public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { + protected String hostName = System.getProperty("user.name").replace('.','-').toLowerCase(); public BaseNovaApiLiveTest() { provider = "openstack-nova"; @@ -58,12 +59,19 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { protected Set zones; protected RestContext novaContext; - @BeforeGroups(groups = { "integration", "live" }, alwaysRun = true) + @BeforeClass(groups = { "integration", "live" }) @Override public void setupContext() { super.setupContext(); novaContext = view.unwrap(); zones = novaContext.getApi().getConfiguredZones(); + for (String zone : zones){ + ServerApi api = novaContext.getApi().getServerApiForZone(zone); + for (Resource server : api.list().concat()){ + if (server.getName().equals(hostName)) + api.delete(server.getId()); + } + } } @Override @@ -74,15 +82,9 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { return props; } - @AfterGroups(groups = "live") - protected void tearDown() { - if (novaContext != null) - novaContext.close(); - } - protected Server createServerInZone(String zoneId) { ServerApi serverApi = novaContext.getApi().getServerApiForZone(zoneId); - ServerCreated server = serverApi.create("test", imageIdForZone(zoneId), flavorRefForZone(zoneId)); + ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId)); blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE); return serverApi.get(server.getId()); } @@ -93,10 +95,9 @@ public class BaseNovaApiLiveTest extends BaseComputeServiceContextLiveTest { */ protected void blockUntilServerInState(String serverId, ServerApi api, Status status) { Server currentDetails = null; - for (currentDetails = api.get(serverId); currentDetails.getStatus() != status || - (currentDetails.getExtendedStatus().isPresent() && currentDetails.getExtendedStatus().get().getTaskState() != null); - currentDetails = api - .get(serverId)) { + for (currentDetails = api.get(serverId); currentDetails.getStatus() != status + || ((currentDetails.getExtendedStatus().isPresent() && currentDetails.getExtendedStatus().get() + .getTaskState() != null)); currentDetails = api.get(serverId)) { System.out.printf("blocking on status %s%n%s%n", status, currentDetails); try { Thread.sleep(5 * 1000); diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java index 8a8262ce34..f8930000e8 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java @@ -18,8 +18,6 @@ */ package org.jclouds.hpcloud.objectstorage; -import static org.jclouds.openstack.keystone.v2_0.config.CredentialTypes.API_ACCESS_KEY_CREDENTIALS; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT; import java.net.URI; @@ -57,7 +55,6 @@ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { public static Properties defaultProperties() { Properties properties = new Properties(); - properties.setProperty(CREDENTIAL_TYPE, API_ACCESS_KEY_CREDENTIALS); properties.setProperty(REQUIRES_TENANT, "true"); return properties; } diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSignerTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSignerTest.java index da1c2699ec..ab0351bb59 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSignerTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobRequestSignerTest.java @@ -44,7 +44,7 @@ import com.google.common.collect.ImmutableMultimap; public class HPCloudObjectStorageBlobRequestSignerTest extends BaseHPCloudObjectStorageBlobStoreExpectTest { Map requestResponseMap = ImmutableMap. builder().put( - keystoneAuthWithAccessKeyAndSecretKey, responseWithKeystoneAccess).build(); + keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess).build(); public void testSignGetBlob() { diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java index 1651065fac..20e6eaf0f8 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java @@ -39,7 +39,7 @@ public class HPCloudObjectStorageBlobStoreExpectTest extends BaseHPCloudObjectSt public void testListObjectsWhenResponseIs2xx() throws Exception { Map requestResponseMap = ImmutableMap. builder().put( - keystoneAuthWithAccessKeyAndSecretKey, responseWithKeystoneAccess).build(); + keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess).build(); BlobStore clientWhenLocationsExist = requestsSendResponses(requestResponseMap);