From 4fad770eafbdcb46a4e8efc1019d89a313a3d8ac Mon Sep 17 00:00:00 2001 From: Adam Lowe Date: Fri, 10 Aug 2012 11:06:49 +0100 Subject: [PATCH 1/6] openstack-nova: allowing extension of the standard extensions by providers --- .../jclouds/openstack/nova/v2_0/NovaApi.java | 28 +++++++++---------- .../openstack/nova/v2_0/NovaAsyncApi.java | 28 +++++++++---------- .../nova/v2_0/compute/NovaComputeService.java | 4 +-- .../CreateSecurityGroupIfNeeded.java | 2 +- .../compute/loaders/CreateUniqueKeyPair.java | 2 +- .../loaders/LoadFloatingIpsForInstance.java | 2 +- ...indSecurityGroupWithNameAndReturnTrue.java | 2 +- .../loaders/CreateUniqueKeyPairTest.java | 6 ++-- .../LoadFloatingIpsForInstanceTest.java | 6 ++-- .../extensions/AdminActionsApiLiveTest.java | 2 +- .../FlavorExtraSpecsApiLiveTest.java | 2 +- .../extensions/FloatingIPApiLiveTest.java | 6 ++-- .../HostAdministrationApiLiveTest.java | 2 +- .../extensions/HostAggregateApiLiveTest.java | 4 +-- .../v2_0/extensions/QuotaApiLiveTest.java | 2 +- .../extensions/QuotaClassApiLiveTest.java | 2 +- .../ServerWithSecurityGroupsApiLiveTest.java | 2 +- .../SimpleTenantUsageApiLiveTest.java | 2 +- .../VirtualInterfaceApiLiveTest.java | 2 +- .../v2_0/extensions/VolumeApiLiveTest.java | 2 +- .../extensions/VolumeTypeApiLiveTest.java | 2 +- .../java/org/jclouds/util/Optionals2.java | 8 +++++- 22 files changed, 63 insertions(+), 55 deletions(-) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java index 7d87c7a93c..2cf173afd5 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java @@ -100,98 +100,98 @@ public interface NovaApi { * Provides synchronous access to Floating IP features. */ @Delegate - Optional getFloatingIPExtensionForZone( + Optional getFloatingIPExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Security Group features. */ @Delegate - Optional getSecurityGroupExtensionForZone( + Optional getSecurityGroupExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Key Pair features. */ @Delegate - Optional getKeyPairExtensionForZone( + Optional getKeyPairExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Host Administration features. */ @Delegate - Optional getHostAdministrationExtensionForZone( + Optional getHostAdministrationExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Simple Tenant Usage features. */ @Delegate - Optional getSimpleTenantUsageExtensionForZone( + Optional getSimpleTenantUsageExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Volume features. */ @Delegate - Optional getVolumeExtensionForZone( + Optional getVolumeExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Virtual Interface features. */ @Delegate - Optional getVirtualInterfaceExtensionForZone( + Optional getVirtualInterfaceExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Server Extra Data features. */ @Delegate - Optional getServerWithSecurityGroupsExtensionForZone( + Optional getServerWithSecurityGroupsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Server Admin Actions features. */ @Delegate - Optional getAdminActionsExtensionForZone( + Optional getAdminActionsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Aggregate features. */ @Delegate - Optional getHostAggregateExtensionForZone( + Optional getHostAggregateExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Flavor extra specs features. */ @Delegate - Optional getFlavorExtraSpecsExtensionForZone( + Optional getFlavorExtraSpecsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Quota features. */ @Delegate - Optional getQuotaExtensionForZone( + Optional getQuotaExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Quota Classes features. */ @Delegate - Optional getQuotaClassExtensionForZone( + Optional getQuotaClassExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides synchronous access to Volume Type features. */ @Delegate - Optional getVolumeTypeExtensionForZone( + Optional getVolumeTypeExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java index d379006d92..53b780e320 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java @@ -98,49 +98,49 @@ public interface NovaAsyncApi { * Provides asynchronous access to Floating IP features. */ @Delegate - Optional getFloatingIPExtensionForZone( + Optional getFloatingIPExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Security Group features. */ @Delegate - Optional getSecurityGroupExtensionForZone( + Optional getSecurityGroupExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Key Pair features. */ @Delegate - Optional getKeyPairExtensionForZone( + Optional getKeyPairExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Host Administration features. */ @Delegate - Optional getHostAdministrationExtensionForZone( + Optional getHostAdministrationExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Simple Tenant Usage features. */ @Delegate - Optional getSimpleTenantUsageExtensionForZone( + Optional getSimpleTenantUsageExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Volume features. */ @Delegate - Optional getVolumeExtensionForZone( + Optional getVolumeExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Virtual Interface features. */ @Delegate - Optional getVirtualInterfaceExtensionForZone( + Optional getVirtualInterfaceExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); @@ -148,49 +148,49 @@ public interface NovaAsyncApi { * Provides asynchronous access to Server Extra Data features. */ @Delegate - Optional getServerWithSecurityGroupsExtensionForZone( + Optional getServerWithSecurityGroupsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Server Admin Actions features. */ @Delegate - Optional getAdminActionsExtensionForZone( + Optional getAdminActionsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to HostAggregate features. */ @Delegate - Optional getHostAggregateExtensionForZone( + Optional getHostAggregateExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Flavor extra specs features. */ @Delegate - Optional getFlavorExtraSpecsExtensionForZone( + Optional getFlavorExtraSpecsExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Quota features. */ @Delegate - Optional getQuotaExtensionForZone( + Optional getQuotaExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Quota Classes features. */ @Delegate - Optional getQuotaClassExtensionForZone( + Optional getQuotaClassExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); /** * Provides asynchronous access to Volume Type features. */ @Delegate - Optional getVolumeTypeExtensionForZone( + Optional getVolumeTypeExtensionForZone( @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java index 622644b8df..f62ef07ca2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeService.java @@ -135,7 +135,7 @@ public class NovaComputeService extends BaseComputeService { } private void cleanupOrphanedSecurityGroupsInZone(Set groups, String zoneId) { - Optional securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId); + Optional securityGroupApi = novaApi.getSecurityGroupExtensionForZone(zoneId); if (securityGroupApi.isPresent()) { for (String group : groups) { for (SecurityGroup securityGroup : Iterables.filter(securityGroupApi.get().listSecurityGroups(), @@ -152,7 +152,7 @@ public class NovaComputeService extends BaseComputeService { } private void cleanupOrphanedKeyPairsInZone(Set groups, String zoneId) { - Optional keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId); + Optional keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId); if (keyPairApi.isPresent()) { for (String group : groups) { for (Map view : keyPairApi.get().listKeyPairs()) { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java index 250aa01944..fb9aeb824f 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/CreateSecurityGroupIfNeeded.java @@ -62,7 +62,7 @@ public class CreateSecurityGroupIfNeeded implements Function api = novaApi.getSecurityGroupExtensionForZone(zoneId); + Optional api = novaApi.getSecurityGroupExtensionForZone(zoneId); checkArgument(api.isPresent(), "Security groups are required, but the extension is not availablein zone %s!", zoneId); logger.debug(">> creating securityGroup %s", zoneSecurityGroupNameAndPorts); try { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java index 49ae02b57e..6454419fe9 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPair.java @@ -59,7 +59,7 @@ public class CreateUniqueKeyPair extends CacheLoader { String zoneId = checkNotNull(zoneAndName, "zoneAndName").getZone(); String prefix = zoneAndName.getName(); - Optional api = novaApi.getKeyPairExtensionForZone(zoneId); + Optional api = novaApi.getKeyPairExtensionForZone(zoneId); checkArgument(api.isPresent(), "Key pairs are required, but the extension is not available in zone %s!", zoneId); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java index 146d097f6a..578d0b1927 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstance.java @@ -51,7 +51,7 @@ public class LoadFloatingIpsForInstance extends CacheLoader load(final ZoneAndId key) throws Exception { String zone = key.getZone(); - Optional ipApiOptional = api.getFloatingIPExtensionForZone(zone); + Optional ipApiOptional = api.getFloatingIPExtensionForZone(zone); if (ipApiOptional.isPresent()) { return Iterables.filter(ipApiOptional.get().listFloatingIPs(), new Predicate() { diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java index 0c9f6fdaa7..0c435e3c61 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/predicates/FindSecurityGroupWithNameAndReturnTrue.java @@ -62,7 +62,7 @@ public class FindSecurityGroupWithNameAndReturnTrue implements Predicate api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone()); + Optional api = novaApi.getSecurityGroupExtensionForZone(securityGroupInZone.getZone()); checkArgument(api.isPresent(), "Security groups are required, but the extension is not available!"); logger.trace("looking for security group %s", securityGroupInZone.slashEncode()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java index 0f86851559..c2de758b67 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/CreateUniqueKeyPairTest.java @@ -52,7 +52,9 @@ public class CreateUniqueKeyPairTest { KeyPair pair = createMock(KeyPair.class); - expect(api.getKeyPairExtensionForZone("zone")).andReturn(Optional.of(keyApi)).atLeastOnce(); + Optional optKeyApi = Optional.of(keyApi); + + expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce(); expect(keyApi.createKeyPair("group-1")).andReturn(pair); @@ -83,7 +85,7 @@ public class CreateUniqueKeyPairTest { KeyPair pair = createMock(KeyPair.class); - expect(api.getKeyPairExtensionForZone("zone")).andReturn(Optional.of(keyApi)).atLeastOnce(); + expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce(); expect(uniqueIdSupplier.get()).andReturn("1"); expect(keyApi.createKeyPair("group-1")).andThrow(new IllegalStateException()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java index 4c32a2fe71..6a7e24c2ab 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/loaders/LoadFloatingIpsForInstanceTest.java @@ -46,7 +46,7 @@ public class LoadFloatingIpsForInstanceTest { FloatingIPApi ipApi = createMock(FloatingIPApi.class); FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build(); - expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce(); + expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.of(testIp)).atLeastOnce(); replay(api); @@ -65,7 +65,7 @@ public class LoadFloatingIpsForInstanceTest { NovaApi api = createMock(NovaApi.class); FloatingIPApi ipApi = createMock(FloatingIPApi.class); - expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce(); + expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.of()).atLeastOnce(); @@ -86,7 +86,7 @@ public class LoadFloatingIpsForInstanceTest { NovaApi api = createMock(NovaApi.class); FloatingIPApi ipApi = createMock(FloatingIPApi.class); - expect(api.getFloatingIPExtensionForZone("Zone")).andReturn(Optional.of(ipApi)).atLeastOnce(); + expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); expect(ipApi.listFloatingIPs()).andReturn( ImmutableSet.of(FloatingIP.builder().id("1").ip("1.1.1.1").build())) 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 f981afcb0a..803bb23e17 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 @@ -53,7 +53,7 @@ public class AdminActionsApiLiveTest extends BaseNovaApiLiveTest { private ImageApi imageApi; private ServerApi serverApi; private ExtensionApi extensionApi; - private Optional apiOption; + private Optional apiOption; private String zone; private String testServerId; 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 6225888117..a666aafa45 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 @@ -44,7 +44,7 @@ import com.google.common.collect.Maps; @Test(groups = "live", testName = "FlavorExtraSpecsApiLiveTest", singleThreaded = true) public class FlavorExtraSpecsApiLiveTest extends BaseNovaApiLiveTest { private FlavorApi flavorApi; - private Optional apiOption; + private Optional apiOption; private String zone; private Resource testFlavor; 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 9970056558..8940b14da6 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 @@ -48,7 +48,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testListFloatingIPs() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); @@ -70,7 +70,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testAllocateAndDeallocateFloatingIPs() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); @@ -101,7 +101,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { @Test public void testAddAndRemoveFloatingIp() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); + Optional apiOption = novaContext.getApi().getFloatingIPExtensionForZone(zoneId); if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java index 6960a6f59f..88ff7b96d7 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiLiveTest.java @@ -42,7 +42,7 @@ import com.google.common.collect.Iterables; */ @Test(groups = "live", testName = "HostAdministrationApiLiveTest", singleThreaded = true) public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest { - private Optional optApi = Optional.absent(); + private Optional optApi = Optional.absent(); Predicate isComputeHost = new Predicate() { @Override 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 c089269d47..2224da4474 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 @@ -44,8 +44,8 @@ import com.google.common.collect.Iterables; */ @Test(groups = "live", testName = "AggregateApiLiveTest", singleThreaded = true) public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest { - private Optional apiOption; - private Optional hostAdminOption; + private Optional apiOption; + private Optional hostAdminOption; private HostAggregate testAggregate; diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java index d1a1fe7532..efd88d750d 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaApiLiveTest.java @@ -36,7 +36,7 @@ import com.google.common.collect.Iterables; */ @Test(groups = "live", testName = "QuotaApiLiveTest", singleThreaded = true) public class QuotaApiLiveTest extends BaseNovaApiLiveTest { - private Optional apiOption; + private Optional apiOption; private String tenant; @BeforeClass(groups = {"integration", "live"}) diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java index 927ed4c062..d5b80da512 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassApiLiveTest.java @@ -36,7 +36,7 @@ import com.google.common.collect.Iterables; */ @Test(groups = "live", testName = "QuotaClassApiLiveTest", singleThreaded = true) public class QuotaClassApiLiveTest extends BaseNovaApiLiveTest { - private Optional apiOption; + private Optional apiOption; private String zone; @BeforeClass(groups = {"integration", "live"}) diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java index ebbaf78b43..533ac32432 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsApiLiveTest.java @@ -41,7 +41,7 @@ import com.google.common.collect.Iterables; @Test(groups = "live", testName = "ServerWithSecurityGroupsApiLiveTest", singleThreaded = true) public class ServerWithSecurityGroupsApiLiveTest extends BaseNovaApiLiveTest { private ServerApi serverApi; - private Optional apiOption; + private Optional apiOption; private String zone; @BeforeGroups(groups = {"integration", "live"}) diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java index 72d0a08749..dfa2c66ff7 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiLiveTest.java @@ -38,7 +38,7 @@ public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest { public void testList() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { - Optional optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); + Optional optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); if (optApi.isPresent() && identity.endsWith(":admin")) { SimpleTenantUsageApi api = optApi.get(); Set usages = api.listTenantUsages(); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java index 8011a0e237..1962a0f9e8 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApiLiveTest.java @@ -38,7 +38,7 @@ import com.google.common.collect.Iterables; */ @Test(groups = "live", testName = "VirtualInterfaceApiLiveTest", singleThreaded = true) public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest { - private Optional apiOption; + private Optional apiOption; private String zone; 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 94e537041e..cbd1e52b69 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 @@ -48,7 +48,7 @@ import com.google.common.collect.Iterables; @Test(groups = "live", testName = "VolumeApiLiveTest", singleThreaded = true) public class VolumeApiLiveTest extends BaseNovaApiLiveTest { - private Optional volumeOption; + private Optional volumeOption; private String zone; private Volume testVolume; 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 65fbdcabf6..9270a2e901 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 @@ -46,7 +46,7 @@ import com.google.common.collect.Iterables; @Test(groups = "live", testName = "VolumeTypeApiLiveTest", singleThreaded = true) public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { - private Optional volumeTypeOption; + private Optional volumeTypeOption; private String zone; private VolumeType testVolumeType; diff --git a/core/src/main/java/org/jclouds/util/Optionals2.java b/core/src/main/java/org/jclouds/util/Optionals2.java index 2ec4b1efc8..591c2dfb1d 100644 --- a/core/src/main/java/org/jclouds/util/Optionals2.java +++ b/core/src/main/java/org/jclouds/util/Optionals2.java @@ -20,6 +20,8 @@ package org.jclouds.util; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.WildcardType; import com.google.common.base.Optional; @@ -35,7 +37,11 @@ public class Optionals2 { if (optional) { ParameterizedType futureType = ParameterizedType.class.cast(method.getGenericReturnType()); // TODO: error checking in case this is a type, not a class. - syncClass = Class.class.cast(futureType.getActualTypeArguments()[0]); + Type t = futureType.getActualTypeArguments()[0]; + if (t instanceof WildcardType) { + t = ((WildcardType) t).getUpperBounds()[0]; + } + syncClass = Class.class.cast(t); } else { syncClass = method.getReturnType(); } From 6c9524dabc094db6eccccdd5e195d892d63047fc Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:04:54 +0100 Subject: [PATCH 2/6] openstack-keystone extensibility --- .../openstack/keystone/v2_0/features/ServiceApi.java | 2 +- .../keystone/v2_0/features/ServiceAsyncApi.java | 2 +- .../openstack/keystone/v2_0/features/TenantApi.java | 2 +- .../keystone/v2_0/features/TenantAsyncApi.java | 6 +++--- .../openstack/keystone/v2_0/features/TokenApi.java | 2 +- .../keystone/v2_0/features/TokenAsyncApi.java | 6 +++--- .../openstack/keystone/v2_0/features/UserApi.java | 6 +++--- .../openstack/keystone/v2_0/features/UserAsyncApi.java | 10 +++++----- .../keystone/v2_0/features/ServiceApiExpectTest.java | 2 +- .../keystone/v2_0/features/ServiceApiLiveTest.java | 2 +- .../keystone/v2_0/features/TenantApiExpectTest.java | 4 ++-- .../keystone/v2_0/features/TenantApiLiveTest.java | 2 +- .../keystone/v2_0/features/TokenApiExpectTest.java | 2 +- .../keystone/v2_0/features/TokenApiLiveTest.java | 2 +- .../keystone/v2_0/features/UserApiExpectTest.java | 6 +++--- .../keystone/v2_0/features/UserApiLiveTest.java | 10 +++++----- 16 files changed, 33 insertions(+), 33 deletions(-) diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java index 7fc87099bc..3a42c4d31c 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java @@ -40,5 +40,5 @@ public interface ServiceApi { /** * The operation returns a list of tenants which the current token provides access to. */ - Set listTenants(); + Set listTenants(); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java index b32482ff45..c890d35b10 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java @@ -57,5 +57,5 @@ public interface ServiceAsyncApi { @Path("/tenants") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listTenants(); + ListenableFuture> listTenants(); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java index f4b9e5b5fa..68a0118f43 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java @@ -40,7 +40,7 @@ public interface TenantApi { /** * The operation returns a list of tenants which the current token provides access to. */ - Set list(); + Set list(); /** * Retrieve information about a tenant, by tenant ID diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java index e03a38a87f..43b1ebefe9 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java @@ -62,7 +62,7 @@ public interface TenantAsyncApi { @Path("/tenants") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(); + ListenableFuture> list(); /** @see TenantApi#get(String) */ @GET @@ -71,7 +71,7 @@ public interface TenantAsyncApi { @Path("/tenants/{tenantId}") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("tenantId") String tenantId); + ListenableFuture get(@PathParam("tenantId") String tenantId); /** @see TenantApi#getByName(String) */ @GET @@ -80,6 +80,6 @@ public interface TenantAsyncApi { @Path("/tenants") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getByName(@QueryParam("name") String tenantName); + ListenableFuture getByName(@QueryParam("name") String tenantName); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java index ebd9baa17d..9b14b2a9f4 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java @@ -72,6 +72,6 @@ public interface TokenApi { * * @return the set of endpoints */ - Set listEndpointsForToken(String token); + Set listEndpointsForToken(String token); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java index 3f53195649..2473400a78 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java @@ -64,7 +64,7 @@ public interface TokenAsyncApi { @Path("/tokens/{token}") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("token") String token); + ListenableFuture get(@PathParam("token") String token); /** @see TokenApi#getUserOfToken(String) */ @GET @@ -73,7 +73,7 @@ public interface TokenAsyncApi { @Path("/tokens/{token}") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getUserOfToken(@PathParam("token") String token); + ListenableFuture getUserOfToken(@PathParam("token") String token); /** @see TokenApi#isValid(String) */ @HEAD @@ -89,6 +89,6 @@ public interface TokenAsyncApi { @Path("/tokens/{token}/endpoints") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listEndpointsForToken(@PathParam("token") String token); + ListenableFuture> listEndpointsForToken(@PathParam("token") String token); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java index 88ab62e9a1..619ecf0153 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java @@ -48,7 +48,7 @@ public interface UserApi { * * @return the list of users */ - Set list(); + Set list(); /** * Retrieve information about a user, by user ID @@ -73,13 +73,13 @@ public interface UserApi { * * @return the set of Roles granted to the user */ - Set listRolesOfUser(String userId); + Set listRolesOfUser(String userId); /** * List the roles a user has been granted on a specific tenant * * @return the set of roles */ - Set listRolesOfUserOnTenant(String userId, String tenantId); + Set listRolesOfUserOnTenant(String userId, String tenantId); } diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java index 7e3cf607ce..d7ba6a8bcb 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java @@ -61,7 +61,7 @@ public interface UserAsyncApi { @Path("/users") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(); + ListenableFuture> list(); /** @see UserApi#get(String) */ @GET @@ -70,7 +70,7 @@ public interface UserAsyncApi { @Path("/users/{userId}") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("userId") String userId); + ListenableFuture get(@PathParam("userId") String userId); /** @see UserApi#getByName(String) */ @GET @@ -79,7 +79,7 @@ public interface UserAsyncApi { @Path("/users") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getByName(@QueryParam("name") String userName); + ListenableFuture getByName(@QueryParam("name") String userName); /** @see UserApi#listRolesOfUser(String) */ @GET @@ -88,7 +88,7 @@ public interface UserAsyncApi { @Path("/users/{userId}/roles") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listRolesOfUser(@PathParam("userId") String userId); + ListenableFuture> listRolesOfUser(@PathParam("userId") String userId); /** @see UserApi#listRolesOfUserOnTenant(String, String) */ @GET @@ -97,5 +97,5 @@ public interface UserAsyncApi { @Path("/tenants/{tenantId}/users/{userId}/roles") @RequestFilters(AuthenticateRequest.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listRolesOfUserOnTenant(@PathParam("userId") String userId, @PathParam("tenantId") String tenantId); + ListenableFuture> listRolesOfUserOnTenant(@PathParam("userId") String userId, @PathParam("tenantId") String tenantId); } diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiExpectTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiExpectTest.java index e51d72fe05..f5e63a22af 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiExpectTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiExpectTest.java @@ -50,7 +50,7 @@ public class ServiceApiExpectTest extends BaseKeystoneRestApiExpectTest tenants = api.listTenants(); + Set tenants = api.listTenants(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java index 67125bf387..b12c5ae014 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApiLiveTest.java @@ -37,7 +37,7 @@ public class ServiceApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { ServiceApi api = keystoneContext.getApi().getServiceApi(); - Set result = api.listTenants(); + Set result = api.listTenants(); assertNotNull(result); assertFalse(result.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiExpectTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiExpectTest.java index c30cd16da9..094d657221 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiExpectTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiExpectTest.java @@ -56,7 +56,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest tenants = api.list(); + Set tenants = api.list(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); @@ -74,7 +74,7 @@ public class TenantApiExpectTest extends BaseKeystoneRestApiExpectTest tenants = api.list(); + Set tenants = api.list(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java index 3411e4ebaa..8c09e41c95 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TenantApiLiveTest.java @@ -38,7 +38,7 @@ public class TenantApiLiveTest extends BaseKeystoneApiLiveTest { public void testTenants() { TenantApi api = keystoneContext.getApi().getTenantApi().get(); - Set result = api.list(); + Set result = api.list(); assertNotNull(result); assertFalse(result.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiExpectTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiExpectTest.java index 54f518d487..9132077d6e 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiExpectTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiExpectTest.java @@ -138,7 +138,7 @@ public class TokenApiExpectTest extends BaseKeystoneRestApiExpectTest endpoints = api.listEndpointsForToken("XXXXXX"); + Set endpoints = api.listEndpointsForToken("XXXXXX"); assertEquals(endpoints, ImmutableSet.of( Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/")) diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java index d4eb9cb166..7328190ef6 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java @@ -82,7 +82,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { public void testTokenEndpoints() { TokenApi api = keystoneContext.getApi().getTokenApi().get(); - Set endpoints = api.listEndpointsForToken(token); + Set endpoints = api.listEndpointsForToken(token); assertNotNull(endpoints); assertFalse(endpoints.isEmpty()); diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiExpectTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiExpectTest.java index bf828b9ac4..01eddeff07 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiExpectTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiExpectTest.java @@ -56,7 +56,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest users = api.list(); + Set users = api.list(); assertNotNull(users); assertFalse(users.isEmpty()); @@ -123,7 +123,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f"); + Set roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f"); assertNotNull(roles); assertFalse(roles.isEmpty()); assertEquals(roles, ImmutableSet.of( @@ -154,7 +154,7 @@ public class UserApiExpectTest extends BaseKeystoneRestApiExpectTest roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f"); + Set roles = api.listRolesOfUser("3f6c1c9ba993495ead7d2eb2192e284f"); assertNotNull(roles); assertFalse(roles.isEmpty()); assertEquals(roles, ImmutableSet.of( diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java index 6ce1f0714f..6e9759a953 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/UserApiLiveTest.java @@ -41,7 +41,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUsers() { UserApi api = keystoneContext.getApi().getUserApi().get(); - Set users = api.list(); + Set users = api.list(); assertNotNull(users); assertFalse(users.isEmpty()); for (User user : users) { @@ -54,12 +54,12 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { public void testUserRolesOnTenant() { UserApi api = keystoneContext.getApi().getUserApi().get(); - Set users = api.list(); - Set tenants = keystoneContext.getApi().getTenantApi().get().list(); + Set users = api.list(); + Set tenants = keystoneContext.getApi().getTenantApi().get().list(); for (User user : users) { for (Tenant tenant : tenants) { - Set roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId()); + Set roles = api.listRolesOfUserOnTenant(user.getId(), tenant.getId()); for (Role role : roles) { assertNotNull(role.getId()); } @@ -72,7 +72,7 @@ public class UserApiLiveTest extends BaseKeystoneApiLiveTest { UserApi api = keystoneContext.getApi().getUserApi().get(); for (User user : api.list()) { - Set roles = api.listRolesOfUser(user.getId()); + Set roles = api.listRolesOfUser(user.getId()); for (Role role : roles) { assertNotNull(role.getId()); } From 9acfa880d493e009437c60666f04a439be8cafa3 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:29:36 +0100 Subject: [PATCH 3/6] openstack-nova extensibility --- .../openstack/nova/v2_0/config/NovaRestClientModule.java | 6 +++--- .../jclouds/openstack/nova/v2_0/features/ExtensionApi.java | 2 +- .../openstack/nova/v2_0/features/ExtensionAsyncApi.java | 4 ++-- .../org/jclouds/openstack/nova/v2_0/features/FlavorApi.java | 2 +- .../openstack/nova/v2_0/features/FlavorAsyncApi.java | 2 +- .../org/jclouds/openstack/nova/v2_0/features/ImageApi.java | 2 +- .../jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java | 2 +- .../org/jclouds/openstack/nova/v2_0/features/ServerApi.java | 2 +- .../openstack/nova/v2_0/features/ServerAsyncApi.java | 2 +- ...nnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java | 4 ++-- .../openstack/nova/v2_0/features/ExtensionApiLiveTest.java | 2 +- .../openstack/nova/v2_0/features/FlavorApiLiveTest.java | 2 +- .../openstack/nova/v2_0/features/ImageApiLiveTest.java | 2 +- .../openstack/nova/v2_0/features/ServerApiLiveTest.java | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java index 579b62390f..a75b52dcb8 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java @@ -129,12 +129,12 @@ public class NovaRestClientModule ext @Provides @Singleton - public LoadingCache> provideExtensionsByZone(final Provider novaApi) { + public LoadingCache> provideExtensionsByZone(final Provider novaApi) { return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS) - .build(new CacheLoader>() { + .build(new CacheLoader>() { @Override - public Set load(String key) throws Exception { + public Set load(String key) throws Exception { return novaApi.get().getExtensionApiForZone(key).listExtensions(); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApi.java index 08647ca7e9..1b5c4d73cb 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApi.java @@ -42,7 +42,7 @@ public interface ExtensionApi { * * @return all extensions */ - Set listExtensions(); + Set listExtensions(); /** * Extensions may also be queried individually by their unique alias. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionAsyncApi.java index a2207e49b9..91b012db36 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ExtensionAsyncApi.java @@ -59,7 +59,7 @@ public interface ExtensionAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/extensions") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listExtensions(); + ListenableFuture> listExtensions(); /** * @see ExtensionApi#getExtensionByAlias @@ -69,6 +69,6 @@ public interface ExtensionAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/extensions/{alias}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getExtensionByAlias(@PathParam("alias") String id); + ListenableFuture getExtensionByAlias(@PathParam("alias") String id); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java index 8bb523caad..5eb5cc69ed 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorApi.java @@ -43,7 +43,7 @@ public interface FlavorApi { * * @return all flavors (IDs, names, links) */ - Set listFlavors(); + Set listFlavors(); /** * List all flavors (all details) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java index ac010c2eb7..632f888668 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/FlavorAsyncApi.java @@ -61,7 +61,7 @@ public interface FlavorAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/flavors") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listFlavors(); + ListenableFuture> listFlavors(); /** * @see FlavorApi#listFlavorsInDetail diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java index dc31674d38..89fe3e38d5 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageApi.java @@ -43,7 +43,7 @@ public interface ImageApi { * * @return all images (IDs, names, links) */ - Set listImages(); + Set listImages(); /** * List all images (all details) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java index 0c623d3866..40fbc949b6 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ImageAsyncApi.java @@ -59,7 +59,7 @@ public interface ImageAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/images") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listImages(); + ListenableFuture> listImages(); /** * @see ImageApi#listImagesInDetail diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java index 8b476a669e..1378b18856 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerApi.java @@ -47,7 +47,7 @@ public interface ServerApi { * * @return all servers (IDs, names, links) */ - Set listServers(); + Set listServers(); /** * List all servers (all details) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java index 28db18398b..c1d7a7b79b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/features/ServerAsyncApi.java @@ -76,7 +76,7 @@ public interface ServerAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/servers") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listServers(); + ListenableFuture> listServers(); /** * @see ServerApi#listServersInDetail diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java index 183d5c60b0..2656b978dc 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/functions/PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.java @@ -51,7 +51,7 @@ import com.google.common.collect.Multimap; @Singleton public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet implements ImplicitOptionalConverter { - private final LoadingCache> extensions; + private final LoadingCache> extensions; @com.google.inject.Inject(optional=true) @Named("openstack.nova.extensions") @@ -88,7 +88,7 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio @Inject public PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet( - LoadingCache> extensions) { + LoadingCache> extensions) { this.extensions = checkNotNull(extensions, "extensions"); } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java index 67217c5ae3..60d53b0a17 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ExtensionApiLiveTest.java @@ -44,7 +44,7 @@ public class ExtensionApiLiveTest extends BaseNovaApiLiveTest { public void testListExtensions() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { ExtensionApi api = novaContext.getApi().getExtensionApiForZone(zoneId); - Set response = api.listExtensions(); + Set response = api.listExtensions(); assert null != response; assertTrue(response.size() >= 0); for (Extension extension : response) { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java index 1374911027..87cc77c60e 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java @@ -45,7 +45,7 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { public void testListFlavors() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { FlavorApi api = novaContext.getApi().getFlavorApiForZone(zoneId); - Set response = api.listFlavors(); + Set response = api.listFlavors(); assert null != response; assertTrue(response.size() >= 0); for (Resource flavor : response) { 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 80237740c3..034666503b 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 @@ -41,7 +41,7 @@ public class ImageApiLiveTest extends BaseNovaApiLiveTest { public void testListImages() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { ImageApi api = novaContext.getApi().getImageApiForZone(zoneId); - Set response = api.listImages(); + Set response = api.listImages(); assertNotNull(response); assertTrue(response.size() >= 0); for (Resource image : response) { diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java index 1a02473c52..f15604d8ee 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java @@ -40,7 +40,7 @@ public class ServerApiLiveTest extends BaseNovaApiLiveTest { public void testListServersInDetail() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { ServerApi api = novaContext.getApi().getServerApiForZone(zoneId); - Set response = api.listServers(); + Set response = api.listServers(); assert null != response; assertTrue(response.size() >= 0); for (Resource server : response) { From b3121b7889ac6bd28fa40c0bfad473000ae3fe43 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:42:22 +0100 Subject: [PATCH 4/6] openstack-glance extensibility --- .../glance/v1_0/features/ImageApi.java | 4 ++-- .../glance/v1_0/features/ImageAsyncApi.java | 12 ++++++------ .../functions/ParseImageDetailsFromHeaders.java | 17 ++++++++++++++++- .../glance/v1_0/features/ImageApiLiveTest.java | 4 ++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java index c86757a51d..b24e368359 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageApi.java @@ -44,12 +44,12 @@ public interface ImageApi { /** * Returns a set of brief metadata about images */ - Set list(ListImageOptions... options); + Set list(ListImageOptions... options); /** * Returns a set of detailed metadata about images */ - Set listInDetail(ListImageOptions... options); + Set listInDetail(ListImageOptions... options); /** * Return metadata about an image with id diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java index b7c467aa0a..c4b41caf2c 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/features/ImageAsyncApi.java @@ -73,7 +73,7 @@ public interface ImageAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/images") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(ListImageOptions... options); + ListenableFuture> list(ListImageOptions... options); /** * @see ImageApi#listInDetail @@ -83,7 +83,7 @@ public interface ImageAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/images/detail") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listInDetail(ListImageOptions... options); + ListenableFuture> listInDetail(ListImageOptions... options); /** * @see ImageApi#show @@ -110,7 +110,7 @@ public interface ImageAsyncApi { @Produces(MediaType.APPLICATION_OCTET_STREAM) @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options); + ListenableFuture create(@HeaderParam("x-image-meta-name") String name, Payload payload, CreateImageOptions... options); /** * @see ImageApi#reserve @@ -119,7 +119,7 @@ public interface ImageAsyncApi { @Path("/images") @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options); + ListenableFuture reserve(@HeaderParam("x-image-meta-name") String name, CreateImageOptions... options); /** * @see ImageApi#upload @@ -129,7 +129,7 @@ public interface ImageAsyncApi { @Produces(MediaType.APPLICATION_OCTET_STREAM) @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options); + ListenableFuture upload(@PathParam("id") String id, Payload imageData, UpdateImageOptions... options); /** * @see ImageApi#update @@ -138,7 +138,7 @@ public interface ImageAsyncApi { @Path("/images/{id}") @SelectJson("image") @Consumes(MediaType.APPLICATION_JSON) - ListenableFuture update(@PathParam("id") String id, UpdateImageOptions... options); + ListenableFuture update(@PathParam("id") String id, UpdateImageOptions... options); /** * @see ImageApi#delete diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java index 44ecc33d51..9bcb4e4deb 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/functions/ParseImageDetailsFromHeaders.java @@ -18,7 +18,21 @@ */ package org.jclouds.openstack.glance.v1_0.functions; -import static org.jclouds.openstack.glance.v1_0.options.ImageField.*; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CHECKSUM; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CONTAINER_FORMAT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.CREATED_AT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.DELETED_AT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.DISK_FORMAT; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.ID; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.IS_PUBLIC; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.LOCATION; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_DISK; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.MIN_RAM; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.NAME; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.OWNER; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.SIZE; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.STATUS; +import static org.jclouds.openstack.glance.v1_0.options.ImageField.UPDATED_AT; import javax.inject.Inject; @@ -44,6 +58,7 @@ public class ParseImageDetailsFromHeaders implements Function builder = ImageDetails.builder() .id(from.getFirstHeaderOrNull(ID.asHeader())) diff --git a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java index 6be9b4a1a0..ef457545fb 100644 --- a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java +++ b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/features/ImageApiLiveTest.java @@ -49,7 +49,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest { public void testList() throws Exception { for (String zoneId : glanceContext.getApi().getConfiguredRegions()) { ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId); - Set response = api.list(ListImageOptions.Builder.limit(100)); + Set response = api.list(ListImageOptions.Builder.limit(100)); assert null != response; for (Image image : response) { checkImage(image); @@ -67,7 +67,7 @@ public class ImageApiLiveTest extends BaseGlanceApiLiveTest { public void testListInDetail() throws Exception { for (String zoneId : glanceContext.getApi().getConfiguredRegions()) { ImageApi api = glanceContext.getApi().getImageApiForRegion(zoneId); - Set response = api.listInDetail(); + Set response = api.listInDetail(); assert null != response; for (ImageDetails image : response) { checkImage(image); From 70fc6f5c52c76511b53e46624714e3100662a885 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:43:55 +0100 Subject: [PATCH 5/6] openstack-swift extensibility --- .../org/jclouds/openstack/swift/v1/features/AccountApi.java | 4 ++-- .../openstack/swift/v1/features/AccountAsyncApi.java | 6 +++--- .../openstack/swift/v1/features/AccountApiLiveTest.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountApi.java b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountApi.java index 8bdbcecec4..1cf2e2b664 100644 --- a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountApi.java +++ b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountApi.java @@ -47,7 +47,7 @@ public interface AccountApi { /** * @see #listContainers(ListContainersOptions) */ - Set listContainers(); + Set listContainers(); /** * retrieve a list of existing storage containers ordered by name. The sort order for the name is @@ -57,6 +57,6 @@ public interface AccountApi { * @param options * @return a list of existing storage containers ordered by name. */ - Set listContainers(ListContainersOptions options); + Set listContainers(ListContainersOptions options); } diff --git a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountAsyncApi.java b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountAsyncApi.java index 542fff1357..de64deef66 100644 --- a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountAsyncApi.java +++ b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/features/AccountAsyncApi.java @@ -59,7 +59,7 @@ public interface AccountAsyncApi { @HEAD @ResponseParser(ParseAccountMetadataResponseFromHeaders.class) @Path("/") - ListenableFuture getAccountMetadata(); + ListenableFuture getAccountMetadata(); /** * @see AccountApi#listContainers() @@ -69,7 +69,7 @@ public interface AccountAsyncApi { @QueryParams(keys = "format", values = "json") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Path("/") - ListenableFuture> listContainers(); + ListenableFuture> listContainers(); /** * @see AccountApi#listContainers(ListContainersOptions) @@ -79,5 +79,5 @@ public interface AccountAsyncApi { @QueryParams(keys = "format", values = "json") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @Path("/") - ListenableFuture> listContainers(ListContainersOptions options); + ListenableFuture> listContainers(ListContainersOptions options); } diff --git a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/AccountApiLiveTest.java b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/AccountApiLiveTest.java index c3633dd096..8521c0e236 100644 --- a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/AccountApiLiveTest.java +++ b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/AccountApiLiveTest.java @@ -49,7 +49,7 @@ public class AccountApiLiveTest extends BaseSwiftApiLiveTest { public void testListContainers() throws Exception { for (String regionId : swiftContext.getApi().getConfiguredRegions()) { AccountApi api = swiftContext.getApi().getAccountApiForRegion(regionId); - Set response = api.listContainers(); + Set response = api.listContainers(); assertNotNull(response); for (ContainerMetadata container : response) { assertNotNull(container.getName()); From 2bfa9e0b236d01736772612511252f59754c0d9d Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Sun, 12 Aug 2012 12:46:25 +0100 Subject: [PATCH 6/6] openstack-quantum extensibility --- .../openstack/quantum/v1_0/features/NetworkApi.java | 4 ++-- .../quantum/v1_0/features/NetworkAsyncApi.java | 10 +++++----- .../openstack/quantum/v1_0/features/PortApi.java | 4 ++-- .../quantum/v1_0/features/PortAsyncApi.java | 12 ++++++------ .../quantum/v1_0/features/NetworkApiExpectTest.java | 4 ++-- .../quantum/v1_0/features/NetworkApiLiveTest.java | 4 ++-- .../quantum/v1_0/features/PortApiExpectTest.java | 4 ++-- .../quantum/v1_0/features/PortApiLiveTest.java | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java index bd970fccc8..116a23eef7 100644 --- a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java +++ b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApi.java @@ -44,12 +44,12 @@ public interface NetworkApi { * Returns the list of all networks currently defined in Quantum for the current tenant. The list provides the unique * identifier of each network configured for the tenant. */ - Set listReferences(); + Set listReferences(); /** * Returns all networks currently defined in Quantum for the current tenant. */ - Set list(); + Set list(); /** * Returns the specific network. diff --git a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkAsyncApi.java b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkAsyncApi.java index 44a8feabe9..ffb680528c 100644 --- a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkAsyncApi.java +++ b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/NetworkAsyncApi.java @@ -64,7 +64,7 @@ public interface NetworkAsyncApi { @GET @SelectJson("networks") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listReferences(); + ListenableFuture> listReferences(); /** * @see NetworkApi#list @@ -73,7 +73,7 @@ public interface NetworkAsyncApi { @SelectJson("networks") @Path("/detail") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(); + ListenableFuture> list(); /** * @see NetworkApi#get @@ -82,7 +82,7 @@ public interface NetworkAsyncApi { @SelectJson("network") @Path("/{id}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("id") String id); + ListenableFuture get(@PathParam("id") String id); /** * @see NetworkApi#getDetails @@ -91,7 +91,7 @@ public interface NetworkAsyncApi { @SelectJson("network") @Path("/{id}/detail") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getDetails(@PathParam("id") String id); + ListenableFuture getDetails(@PathParam("id") String id); /** * @see NetworkApi#create @@ -100,7 +100,7 @@ public interface NetworkAsyncApi { @SelectJson("network") @Produces(MediaType.APPLICATION_JSON) @WrapWith("network") - ListenableFuture create(@PayloadParam("name") String name); + ListenableFuture create(@PayloadParam("name") String name); /** * @see NetworkApi#rename diff --git a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java index 5acc661add..5f65506caf 100644 --- a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java +++ b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortApi.java @@ -44,12 +44,12 @@ public interface PortApi { /** * Returns the list of all ports currently defined in Quantum for the requested network */ - Set listReferences(); + Set listReferences(); /** * Returns the set of ports currently defined in Quantum for the requested network. */ - Set list(); + Set list(); /** * Returns a specific port. diff --git a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortAsyncApi.java b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortAsyncApi.java index c0c1e44b3c..a11b474b1d 100644 --- a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortAsyncApi.java +++ b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/features/PortAsyncApi.java @@ -64,7 +64,7 @@ public interface PortAsyncApi { @GET @SelectJson("ports") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listReferences(); + ListenableFuture> listReferences(); /** * @see PortApi#list @@ -73,7 +73,7 @@ public interface PortAsyncApi { @SelectJson("ports") @Path("/detail") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> list(); + ListenableFuture> list(); /** * @see PortApi#get @@ -82,7 +82,7 @@ public interface PortAsyncApi { @SelectJson("port") @Path("/{id}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("id") String id); + ListenableFuture get(@PathParam("id") String id); /** * @see PortApi#getDetails @@ -92,14 +92,14 @@ public interface PortAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/{id}/detail") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getDetails(@PathParam("id") String id); + ListenableFuture getDetails(@PathParam("id") String id); /** * @see PortApi#create() */ @POST @SelectJson("port") - ListenableFuture create(); + ListenableFuture create(); /** * @see PortApi#create(org.jclouds.openstack.quantum.v1_0.domain.Port.State) @@ -131,7 +131,7 @@ public interface PortAsyncApi { @SelectJson("attachment") @Path("/{id}/attachment") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture showAttachment(@PathParam("id") String portId); + ListenableFuture showAttachment(@PathParam("id") String portId); /** * @see PortApi#plugAttachment diff --git a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java index da8b08717e..bf23dfb041 100644 --- a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java +++ b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiExpectTest.java @@ -55,7 +55,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_network_refs.json", APPLICATION_JSON)).build()) .getNetworkApiForRegion("region-a.geo-1"); - Set nets = api.listReferences(); + Set nets = api.listReferences(); assertEquals(nets, listOfNetworkRefs()); } @@ -76,7 +76,7 @@ public class NetworkApiExpectTest extends BaseQuantumApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/list_networks.json", APPLICATION_JSON)).build()) .getNetworkApiForRegion("region-a.geo-1"); - Set nets = api.list(); + Set nets = api.list(); assertEquals(nets, listOfNetworks()); } diff --git a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java index a0060be346..5add5bf041 100644 --- a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java +++ b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/NetworkApiLiveTest.java @@ -42,8 +42,8 @@ public class NetworkApiLiveTest extends BaseQuantumApiLiveTest { public void testListNetworks() { for (String regionId : quantumContext.getApi().getConfiguredRegions()) { - Set ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences(); - Set networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list(); + Set ids = quantumContext.getApi().getNetworkApiForRegion(regionId).listReferences(); + Set networks = quantumContext.getApi().getNetworkApiForRegion(regionId).list(); assertNotNull(ids); assertEquals(ids.size(), networks.size()); for (Network network : networks) { diff --git a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java index 640b6ed431..02a61a1c3d 100644 --- a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java +++ b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiExpectTest.java @@ -56,7 +56,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"id\": \"a6058a59-fa8c-46cc-bac8-08904e6ff0a5\"}]}", APPLICATION_JSON)).build()) .getPortApiForRegionAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b"); - Set nets = api.listReferences(); + Set nets = api.listReferences(); assertEquals(nets, ImmutableSet.of(Reference.builder().id("a6058a59-fa8c-46cc-bac8-08904e6ff0a5").build())); } @@ -77,7 +77,7 @@ public class PortApiExpectTest extends BaseQuantumApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromStringWithContentType("{\"ports\": [{\"state\": \"DOWN\", \"id\": \"814ae4bb-33d9-425f-8ee2-13a5c90b1465\"}]}", APPLICATION_JSON)).build()) .getPortApiForRegionAndNetwork("region-a.geo-1", "1a104cf5-cb18-4d35-9407-2fd2646d9d0b"); - Set nets = api.list(); + Set nets = api.list(); assertEquals(nets, ImmutableSet.of(Port.builder().state(Port.State.DOWN).id("814ae4bb-33d9-425f-8ee2-13a5c90b1465").build())); } diff --git a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java index 68c92a6d83..b179061fe0 100644 --- a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java +++ b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/features/PortApiLiveTest.java @@ -46,11 +46,11 @@ public class PortApiLiveTest extends BaseQuantumApiLiveTest { public void testListPorts() { for (String regionId : quantumContext.getApi().getConfiguredRegions()) { NetworkApi netApi = quantumContext.getApi().getNetworkApiForRegion(regionId); - Set nets = netApi.listReferences(); + Set nets = netApi.listReferences(); for(Reference net : nets) { PortApi portApi = quantumContext.getApi().getPortApiForRegionAndNetwork(regionId, net.getId()); - Set portRefs = portApi.listReferences(); - Set ports = portApi.list(); + Set portRefs = portApi.listReferences(); + Set ports = portApi.list(); assertEquals(portRefs.size(), ports.size()); for (Port port : ports) {