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(); }