Merge pull request #795 from grkvlt/openstack-nova-extension-extensibility

Make all Nova extensions extensible
This commit is contained in:
Adrian Cole 2012-08-23 07:52:38 -07:00
commit 4cd8d17e82
43 changed files with 108 additions and 100 deletions

View File

@ -155,7 +155,7 @@ public class NovaComputeService extends BaseComputeService {
Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId); Optional<? extends KeyPairApi> keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId);
if (keyPairApi.isPresent()) { if (keyPairApi.isPresent()) {
for (String group : groups) { for (String group : groups) {
for (Map<String, KeyPair> view : keyPairApi.get().listKeyPairs()) { for (Map<String, ? extends KeyPair> view : keyPairApi.get().listKeyPairs()) {
for (KeyPair pair : Iterables.filter(view.values(), for (KeyPair pair : Iterables.filter(view.values(),
KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) { KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) {
ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName()); ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName());

View File

@ -129,7 +129,7 @@ public class NovaComputeServiceContextModule extends
bind(TemplateOptions.class).to(NovaTemplateOptions.class); bind(TemplateOptions.class).to(NovaTemplateOptions.class);
bind(new TypeLiteral<CacheLoader<ZoneAndId, Iterable<FloatingIP>>>() { bind(new TypeLiteral<CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>>>() {
}).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class); }).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class);
bind(new TypeLiteral<Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>>() { bind(new TypeLiteral<Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>>() {
@ -163,8 +163,8 @@ public class NovaComputeServiceContextModule extends
@Provides @Provides
@Singleton @Singleton
@Named("FLOATINGIP") @Named("FLOATINGIP")
protected LoadingCache<ZoneAndId, Iterable<FloatingIP>> instanceToFloatingIps( protected LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> instanceToFloatingIps(
@Named("FLOATINGIP") CacheLoader<ZoneAndId, Iterable<FloatingIP>> in) { @Named("FLOATINGIP") CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> in) {
return CacheBuilder.newBuilder().build(in); return CacheBuilder.newBuilder().build(in);
} }

View File

@ -61,11 +61,11 @@ public class AllocateAndAddFloatingIpToNode implements
private final Predicate<AtomicReference<NodeMetadata>> nodeRunning; private final Predicate<AtomicReference<NodeMetadata>> nodeRunning;
private final NovaApi novaApi; private final NovaApi novaApi;
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache; private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
@Inject @Inject
public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning, public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate<AtomicReference<NodeMetadata>> nodeRunning,
NovaApi novaApi, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) { NovaApi novaApi, @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning"); this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning");
this.novaApi = checkNotNull(novaApi, "novaApi"); this.novaApi = checkNotNull(novaApi, "novaApi");
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");

View File

@ -47,11 +47,11 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function<ZoneAndId
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
private final NovaApi novaApi; private final NovaApi novaApi;
private final LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache; private final LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache;
@Inject @Inject
public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi, public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi,
@Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<FloatingIP>> floatingIpCache) { @Named("FLOATINGIP") LoadingCache<ZoneAndId, Iterable<? extends FloatingIP>> floatingIpCache) {
this.novaApi = checkNotNull(novaApi, "novaApi"); this.novaApi = checkNotNull(novaApi, "novaApi");
this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache");
} }

View File

@ -40,7 +40,7 @@ import com.google.common.collect.Iterables;
* @author Adam Lowe * @author Adam Lowe
*/ */
@Singleton @Singleton
public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<FloatingIP>> { public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<? extends FloatingIP>> {
private final NovaApi api; private final NovaApi api;
@Inject @Inject
@ -49,7 +49,7 @@ public class LoadFloatingIpsForInstance extends CacheLoader<ZoneAndId, Iterable<
} }
@Override @Override
public Iterable<FloatingIP> load(final ZoneAndId key) throws Exception { public Iterable<? extends FloatingIP> load(final ZoneAndId key) throws Exception {
String zone = key.getZone(); String zone = key.getZone();
Optional<? extends FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone); Optional<? extends FloatingIPApi> ipApiOptional = api.getFloatingIPExtensionForZone(zone);
if (ipApiOptional.isPresent()) { if (ipApiOptional.isPresent()) {

View File

@ -174,8 +174,13 @@ public class KeyPair {
} }
protected ToStringHelper string() { protected ToStringHelper string() {
return Objects.toStringHelper(this) return Objects.toStringHelper("")
.add("publicKey", publicKey).add("privateKey", privateKey).add("userId", userId).add("name", name).add("fingerprint", fingerprint); .omitNullValues()
.add("public_key", publicKey)
.add("private_key", privateKey)
.add("user_id", userId)
.add("name", name)
.add("fingerprint", fingerprint);
} }
@Override @Override

View File

@ -42,7 +42,7 @@ public interface FloatingIPApi {
* *
* @return all Floating IPs * @return all Floating IPs
*/ */
Set<FloatingIP> listFloatingIPs(); Set<? extends FloatingIP> listFloatingIPs();
/** /**
* Get a specific Floating IP address * Get a specific Floating IP address

View File

@ -70,7 +70,7 @@ public interface FloatingIPAsyncApi {
@SelectJson("floating_ips") @SelectJson("floating_ips")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<FloatingIP>> listFloatingIPs(); ListenableFuture<? extends Set<? extends FloatingIP>> listFloatingIPs();
/** /**
* @see FloatingIPApi#getFloatingIP * @see FloatingIPApi#getFloatingIP
@ -80,7 +80,7 @@ public interface FloatingIPAsyncApi {
@SelectJson("floating_ip") @SelectJson("floating_ip")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<FloatingIP> getFloatingIP(@PathParam("id") String id); ListenableFuture<? extends FloatingIP> getFloatingIP(@PathParam("id") String id);
/** /**
* @see FloatingIPApi#allocate * @see FloatingIPApi#allocate
@ -92,7 +92,7 @@ public interface FloatingIPAsyncApi {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
@Payload("{}") @Payload("{}")
ListenableFuture<FloatingIP> allocate(); ListenableFuture<? extends FloatingIP> allocate();
/** /**
* @see FloatingIPApi#deallocate * @see FloatingIPApi#deallocate

View File

@ -43,14 +43,14 @@ public interface HostAdministrationApi {
* *
* @return the usage information * @return the usage information
*/ */
Set<Host> listHosts(); Set<? extends Host> listHosts();
/** /**
* Retrieves the physical/usage resource on a specific host * Retrieves the physical/usage resource on a specific host
* *
* @return the usage information * @return the usage information
*/ */
Set<HostResourceUsage> getHostResourceUsage(String hostId); Set<? extends HostResourceUsage> getHostResourceUsage(String hostId);
/** /**
* Allow the specified host to accept new instances. * Allow the specified host to accept new instances.

View File

@ -73,7 +73,7 @@ public interface HostAdministrationAsyncApi {
@GET @GET
@SelectJson("hosts") @SelectJson("hosts")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Host>> listHosts(); ListenableFuture<? extends Set<? extends Host>> listHosts();
/** /**
* @see HostAdministrationApi#getHostResourceUsage(String) * @see HostAdministrationApi#getHostResourceUsage(String)
@ -82,7 +82,7 @@ public interface HostAdministrationAsyncApi {
@Path("/{id}") @Path("/{id}")
@SelectJson("host") @SelectJson("host")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<HostResourceUsage>> getHostResourceUsage(@PathParam("id") String hostId); ListenableFuture<? extends Set<? extends HostResourceUsage>> getHostResourceUsage(@PathParam("id") String hostId);
/** /**
* @see HostAdministrationApi#enableHost(String) * @see HostAdministrationApi#enableHost(String)

View File

@ -45,7 +45,7 @@ public interface HostAggregateApi {
/** /**
* @return the set of host aggregates. * @return the set of host aggregates.
*/ */
Set<HostAggregate> listAggregates(); Set<? extends HostAggregate> listAggregates();
/** /**
* Retrieves the details of an aggregate, hosts and metadata included. * Retrieves the details of an aggregate, hosts and metadata included.

View File

@ -66,7 +66,7 @@ public interface HostAggregateAsyncApi {
@SelectJson("aggregates") @SelectJson("aggregates")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<HostAggregate>> listAggregates(); ListenableFuture<? extends Set<? extends HostAggregate>> listAggregates();
/** /**
* @see HostAggregateApi#getAggregate(String) * @see HostAggregateApi#getAggregate(String)
@ -76,7 +76,7 @@ public interface HostAggregateAsyncApi {
@SelectJson("aggregate") @SelectJson("aggregate")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<HostAggregate> getAggregate(@PathParam("id") String id); ListenableFuture<? extends HostAggregate> getAggregate(@PathParam("id") String id);
/** /**
* @see HostAggregateApi#createAggregate(String, String) * @see HostAggregateApi#createAggregate(String, String)
@ -86,7 +86,7 @@ public interface HostAggregateAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("aggregate") @WrapWith("aggregate")
ListenableFuture<HostAggregate> createAggregate(@PayloadParam("name") String name, ListenableFuture<? extends HostAggregate> createAggregate(@PayloadParam("name") String name,
@PayloadParam("availability_zone") String availabilityZone); @PayloadParam("availability_zone") String availabilityZone);
/** /**
@ -97,7 +97,7 @@ public interface HostAggregateAsyncApi {
@SelectJson("aggregate") @SelectJson("aggregate")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@WrapWith("aggregate") @WrapWith("aggregate")
ListenableFuture<HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name); ListenableFuture<? extends HostAggregate> updateName(@PathParam("id") String id, @PayloadParam("name") String name);
/** /**
* @see HostAggregateApi#updateAvailabilityZone * @see HostAggregateApi#updateAvailabilityZone
@ -107,7 +107,7 @@ public interface HostAggregateAsyncApi {
@SelectJson("aggregate") @SelectJson("aggregate")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@WrapWith("aggregate") @WrapWith("aggregate")
ListenableFuture<HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone); ListenableFuture<? extends HostAggregate> updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone);
/** /**
* @see HostAggregateApi#deleteAggregate(String) * @see HostAggregateApi#deleteAggregate(String)
@ -127,7 +127,7 @@ public interface HostAggregateAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("add_host") @WrapWith("add_host")
ListenableFuture<HostAggregate> addHost(@PathParam("id") String id, @PayloadParam("host") String host); ListenableFuture<? extends HostAggregate> addHost(@PathParam("id") String id, @PayloadParam("host") String host);
/** /**
@ -139,7 +139,7 @@ public interface HostAggregateAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("remove_host") @WrapWith("remove_host")
ListenableFuture<HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host); ListenableFuture<? extends HostAggregate> removeHost(@PathParam("id") String id, @PayloadParam("host") String host);
/** /**
* @see HostAggregateApi#setMetadata * @see HostAggregateApi#setMetadata
@ -150,5 +150,5 @@ public interface HostAggregateAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("set_metadata") @WrapWith("set_metadata")
ListenableFuture<HostAggregate> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata); ListenableFuture<? extends HostAggregate> setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map<String, String> metadata);
} }

View File

@ -43,7 +43,7 @@ public interface KeyPairApi {
* *
* @return all Key Pairs * @return all Key Pairs
*/ */
Set<Map<String, KeyPair>> listKeyPairs(); Set<? extends Map<String, ? extends KeyPair>> listKeyPairs();
/** /**
* Create a Key Pair. * Create a Key Pair.

View File

@ -69,7 +69,7 @@ public interface KeyPairAsyncApi {
@SelectJson("keypairs") @SelectJson("keypairs")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Map<String, KeyPair>>> listKeyPairs(); ListenableFuture<? extends Set<? extends Map<String, ? extends KeyPair>>> listKeyPairs();
@POST @POST
@Path("/os-keypairs") @Path("/os-keypairs")
@ -77,7 +77,7 @@ public interface KeyPairAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Payload("%7B\"keypair\":%7B\"name\":\"{name}\"%7D%7D") @Payload("%7B\"keypair\":%7B\"name\":\"{name}\"%7D%7D")
ListenableFuture<KeyPair> createKeyPair(@PayloadParam("name") String name); ListenableFuture<? extends KeyPair> createKeyPair(@PayloadParam("name") String name);
@POST @POST
@Path("/os-keypairs") @Path("/os-keypairs")
@ -85,7 +85,7 @@ public interface KeyPairAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Payload("%7B\"keypair\":%7B\"name\":\"{name}\",\"public_key\":\"{publicKey}\"%7D%7D") @Payload("%7B\"keypair\":%7B\"name\":\"{name}\",\"public_key\":\"{publicKey}\"%7D%7D")
ListenableFuture<KeyPair> createKeyPairWithPublicKey(@PayloadParam("name") String name, ListenableFuture<? extends KeyPair> createKeyPairWithPublicKey(@PayloadParam("name") String name,
@PayloadParam("publicKey") String publicKey); @PayloadParam("publicKey") String publicKey);
@DELETE @DELETE

View File

@ -64,7 +64,7 @@ public interface QuotaAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/{tenant_id}") @Path("/{tenant_id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Quotas> getQuotasForTenant(@PathParam("tenant_id") String tenantId); ListenableFuture<? extends Quotas> getQuotasForTenant(@PathParam("tenant_id") String tenantId);
/** /**
* @see QuotaApi#updateQuotasForTenant(String, org.jclouds.openstack.nova.v2_0.domain.Quotas) * @see QuotaApi#updateQuotasForTenant(String, org.jclouds.openstack.nova.v2_0.domain.Quotas)
@ -83,6 +83,6 @@ public interface QuotaAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/{tenant_id}/defaults") @Path("/{tenant_id}/defaults")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Quotas> getDefaultQuotasForTenant(@PathParam("tenant_id") String tenantId); ListenableFuture<? extends Quotas> getDefaultQuotasForTenant(@PathParam("tenant_id") String tenantId);
} }

View File

@ -65,7 +65,7 @@ public interface QuotaClassAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/{id}") @Path("/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<QuotaClass> getQuotaClass(@PathParam("id") String id); ListenableFuture<? extends QuotaClass> getQuotaClass(@PathParam("id") String id);
/** /**
* @see QuotaClassApi#updateQuotaClass * @see QuotaClassApi#updateQuotaClass

View File

@ -44,7 +44,7 @@ public interface SecurityGroupApi {
* *
* @return all Floating IPs * @return all Floating IPs
*/ */
Set<SecurityGroup> listSecurityGroups(); Set<? extends SecurityGroup> listSecurityGroups();
/** /**
* Get a specific Security Group * Get a specific Security Group

View File

@ -73,7 +73,7 @@ public interface SecurityGroupAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/os-security-groups") @Path("/os-security-groups")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SecurityGroup>> listSecurityGroups(); ListenableFuture<? extends Set<? extends SecurityGroup>> listSecurityGroups();
/** /**
* @see SecurityGroupApi#getSecurityGroup * @see SecurityGroupApi#getSecurityGroup
@ -83,7 +83,7 @@ public interface SecurityGroupAsyncApi {
@SelectJson("security_group") @SelectJson("security_group")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<SecurityGroup> getSecurityGroup(@PathParam("id") String id); ListenableFuture<? extends SecurityGroup> getSecurityGroup(@PathParam("id") String id);
/** /**
* @see SecurityGroupApi#createSecurityGroupWithNameAndDescription * @see SecurityGroupApi#createSecurityGroupWithNameAndDescription
@ -95,7 +95,7 @@ public interface SecurityGroupAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D") @Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D")
ListenableFuture<SecurityGroup> createSecurityGroupWithNameAndDescription(@PayloadParam("name") String name, ListenableFuture<? extends SecurityGroup> createSecurityGroupWithNameAndDescription(@PayloadParam("name") String name,
@PayloadParam("description") String description); @PayloadParam("description") String description);
/** /**
@ -117,7 +117,7 @@ public interface SecurityGroupAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@MapBinder(BindSecurityGroupRuleToJsonPayload.class) @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
ListenableFuture<SecurityGroupRule> createSecurityGroupRuleAllowingCidrBlock( ListenableFuture<? extends SecurityGroupRule> createSecurityGroupRuleAllowingCidrBlock(
@PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol, @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
@PayloadParam("cidr") String cidr); @PayloadParam("cidr") String cidr);
@ -131,7 +131,7 @@ public interface SecurityGroupAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@MapBinder(BindSecurityGroupRuleToJsonPayload.class) @MapBinder(BindSecurityGroupRuleToJsonPayload.class)
ListenableFuture<SecurityGroupRule> createSecurityGroupRuleAllowingSecurityGroupId( ListenableFuture<? extends SecurityGroupRule> createSecurityGroupRuleAllowingSecurityGroupId(
@PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol, @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol,
@PayloadParam("group_id") String group_id); @PayloadParam("group_id") String group_id);

View File

@ -57,6 +57,6 @@ public interface ServerWithSecurityGroupsAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/os-create-server-ext/{id}") @Path("/os-create-server-ext/{id}")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<ServerWithSecurityGroups> getServer(@PathParam("id") String id); ListenableFuture<? extends ServerWithSecurityGroups> getServer(@PathParam("id") String id);
} }

View File

@ -42,7 +42,7 @@ public interface SimpleTenantUsageApi {
* *
* @return the set of TenantUsage reports * @return the set of TenantUsage reports
*/ */
Set<SimpleTenantUsage> listTenantUsages(); Set<? extends SimpleTenantUsage> listTenantUsages();
/** /**
* Retrieve tenant_usage for a specified tenant * Retrieve tenant_usage for a specified tenant

View File

@ -62,7 +62,7 @@ public interface SimpleTenantUsageAsyncApi {
@SelectJson("tenant_usages") @SelectJson("tenant_usages")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<SimpleTenantUsage>> listTenantUsages(); ListenableFuture<? extends Set<? extends SimpleTenantUsage>> listTenantUsages();
/** /**
* @see SimpleTenantUsageApi#getTenantUsage(String) * @see SimpleTenantUsageApi#getTenantUsage(String)
@ -72,6 +72,6 @@ public interface SimpleTenantUsageAsyncApi {
@SelectJson("tenant_usage") @SelectJson("tenant_usage")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<SimpleTenantUsage> getTenantUsage(@PathParam("id") String tenantId); ListenableFuture<? extends SimpleTenantUsage> getTenantUsage(@PathParam("id") String tenantId);
} }

View File

@ -41,6 +41,6 @@ public interface VirtualInterfaceApi {
* *
* @return the list of snapshots * @return the list of snapshots
*/ */
Set<VirtualInterface> listVirtualInterfacesForServer(String serverId); Set<? extends VirtualInterface> listVirtualInterfacesForServer(String serverId);
} }

View File

@ -56,5 +56,5 @@ public interface VirtualInterfaceAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Path("/servers/{server_id}/os-virtual-interfaces") @Path("/servers/{server_id}/os-virtual-interfaces")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VirtualInterface>> listVirtualInterfacesForServer(@PathParam("server_id") String serverId); ListenableFuture<? extends Set<? extends VirtualInterface>> listVirtualInterfacesForServer(@PathParam("server_id") String serverId);
} }

View File

@ -45,14 +45,14 @@ public interface VolumeApi {
* *
* @return the list of snapshots * @return the list of snapshots
*/ */
Set<Volume> listVolumes(); Set<? extends Volume> listVolumes();
/** /**
* Returns a detailed list of volumes. * Returns a detailed list of volumes.
* *
* @return the list of volumes. * @return the list of volumes.
*/ */
Set<Volume> listVolumesInDetail(); Set<? extends Volume> listVolumesInDetail();
/** /**
* Return data about the given volume. * Return data about the given volume.
@ -80,7 +80,7 @@ public interface VolumeApi {
* *
* @return all Floating IPs * @return all Floating IPs
*/ */
Set<VolumeAttachment> listAttachmentsOnServer(String serverId); Set<? extends VolumeAttachment> listAttachmentsOnServer(String serverId);
/** /**
* Get a specific attached volume. * Get a specific attached volume.
@ -108,14 +108,14 @@ public interface VolumeApi {
* *
* @return the list of snapshots * @return the list of snapshots
*/ */
Set<VolumeSnapshot> listSnapshots(); Set<? extends VolumeSnapshot> listSnapshots();
/** /**
* Returns a summary list of snapshots. * Returns a summary list of snapshots.
* *
* @return the list of snapshots * @return the list of snapshots
*/ */
Set<VolumeSnapshot> listSnapshotsInDetail(); Set<? extends VolumeSnapshot> listSnapshotsInDetail();
/** /**
* Return data about the given snapshot. * Return data about the given snapshot.

View File

@ -71,7 +71,7 @@ public interface VolumeAsyncApi {
@SelectJson("volumes") @SelectJson("volumes")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Volume>> listVolumes(); ListenableFuture<? extends Set<? extends Volume>> listVolumes();
/** /**
* Returns a detailed list of volumes. * Returns a detailed list of volumes.
@ -83,7 +83,7 @@ public interface VolumeAsyncApi {
@SelectJson("volumes") @SelectJson("volumes")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<Volume>> listVolumesInDetail(); ListenableFuture<? extends Set<? extends Volume>> listVolumesInDetail();
/** /**
* Return data about the given volume. * Return data about the given volume.
@ -95,7 +95,7 @@ public interface VolumeAsyncApi {
@SelectJson("volume") @SelectJson("volume")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Volume> getVolume(@PathParam("id") String volumeId); ListenableFuture<? extends Volume> getVolume(@PathParam("id") String volumeId);
/** /**
* Creates a new volume * Creates a new volume
@ -108,7 +108,7 @@ public interface VolumeAsyncApi {
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@MapBinder(CreateVolumeOptions.class) @MapBinder(CreateVolumeOptions.class)
ListenableFuture<Volume> createVolume(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options); ListenableFuture<? extends Volume> createVolume(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options);
/** /**
* Delete a volume. * Delete a volume.
@ -131,7 +131,7 @@ public interface VolumeAsyncApi {
@SelectJson("volumeAttachments") @SelectJson("volumeAttachments")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VolumeAttachment>> listAttachmentsOnServer(@PathParam("server_id") String serverId); ListenableFuture<? extends Set<? extends VolumeAttachment>> listAttachmentsOnServer(@PathParam("server_id") String serverId);
/** /**
* Get a specific attached volume. * Get a specific attached volume.
@ -143,7 +143,7 @@ public interface VolumeAsyncApi {
@SelectJson("volumeAttachment") @SelectJson("volumeAttachment")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VolumeAttachment> getAttachmentForVolumeOnServer(@PathParam("id") String volumeId, ListenableFuture<? extends VolumeAttachment> getAttachmentForVolumeOnServer(@PathParam("id") String volumeId,
@PathParam("server_id") String serverId); @PathParam("server_id") String serverId);
/** /**
@ -157,7 +157,7 @@ public interface VolumeAsyncApi {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@WrapWith("volumeAttachment") @WrapWith("volumeAttachment")
ListenableFuture<VolumeAttachment> attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId, ListenableFuture<? extends VolumeAttachment> attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId,
@PathParam("server_id") String serverId, @PayloadParam("device") String device); @PathParam("server_id") String serverId, @PayloadParam("device") String device);
/** /**
@ -181,7 +181,7 @@ public interface VolumeAsyncApi {
@SelectJson("snapshots") @SelectJson("snapshots")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VolumeSnapshot>> listSnapshots(); ListenableFuture<? extends Set<? extends VolumeSnapshot>> listSnapshots();
/** /**
* Returns a summary list of snapshots. * Returns a summary list of snapshots.
@ -193,7 +193,7 @@ public interface VolumeAsyncApi {
@SelectJson("snapshots") @SelectJson("snapshots")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VolumeSnapshot>> listSnapshotsInDetail(); ListenableFuture<? extends Set<? extends VolumeSnapshot>> listSnapshotsInDetail();
/** /**
* Return data about the given snapshot. * Return data about the given snapshot.
@ -205,7 +205,7 @@ public interface VolumeAsyncApi {
@SelectJson("snapshot") @SelectJson("snapshot")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VolumeSnapshot> getSnapshot(@PathParam("id") String snapshotId); ListenableFuture<? extends VolumeSnapshot> getSnapshot(@PathParam("id") String snapshotId);
/** /**
* Creates a new Snapshot * Creates a new Snapshot
@ -218,7 +218,7 @@ public interface VolumeAsyncApi {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@MapBinder(CreateVolumeSnapshotOptions.class) @MapBinder(CreateVolumeSnapshotOptions.class)
ListenableFuture<VolumeSnapshot> createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options); ListenableFuture<? extends VolumeSnapshot> createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options);
/** /**
* Delete a snapshot. * Delete a snapshot.

View File

@ -47,7 +47,7 @@ public interface VolumeTypeApi {
/** /**
* @return set of all volume types * @return set of all volume types
*/ */
Set<VolumeType> listVolumeTypes(); Set<? extends VolumeType> listVolumeTypes();
/** /**
* @param id the id of the volume type to retrieve * @param id the id of the volume type to retrieve

View File

@ -72,7 +72,7 @@ public interface VolumeTypeAsyncApi {
@GET @GET
@SelectJson("volume_types") @SelectJson("volume_types")
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
ListenableFuture<Set<VolumeType>> listVolumeTypes(); ListenableFuture<? extends Set<? extends VolumeType>> listVolumeTypes();
/** /**
@ -82,7 +82,7 @@ public interface VolumeTypeAsyncApi {
@Path("/{id}") @Path("/{id}")
@SelectJson("volume_type") @SelectJson("volume_type")
@ExceptionParser(ReturnNullOnNotFoundOr404.class) @ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<VolumeType> getVolumeType(@PathParam("id") String id); ListenableFuture<? extends VolumeType> getVolumeType(@PathParam("id") String id);
/** /**
* @see VolumeTypeApi#createVolumeType * @see VolumeTypeApi#createVolumeType
@ -91,7 +91,7 @@ public interface VolumeTypeAsyncApi {
@SelectJson("volume_type") @SelectJson("volume_type")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@WrapWith("volume_type") @WrapWith("volume_type")
ListenableFuture<VolumeType> createVolumeType(@PayloadParam("name") String name, CreateVolumeTypeOptions... options); ListenableFuture<? extends VolumeType> createVolumeType(@PayloadParam("name") String name, CreateVolumeTypeOptions... options);
/** /**
* @see VolumeTypeApi#deleteVolumeType * @see VolumeTypeApi#deleteVolumeType

View File

@ -25,6 +25,8 @@ import static org.easymock.EasyMock.verify;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertFalse;
import java.util.Set;
import org.jclouds.openstack.nova.v2_0.NovaApi; import org.jclouds.openstack.nova.v2_0.NovaApi;
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP; import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId; import org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId;
@ -47,7 +49,7 @@ public class LoadFloatingIpsForInstanceTest {
FloatingIP testIp = FloatingIP.builder().id("1").ip("1.1.1.1").fixedIp("10.1.1.1").instanceId("i-blah").build(); 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) Optional.of(ipApi)).atLeastOnce(); expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.<FloatingIP>of(testIp)).atLeastOnce(); expect(ipApi.listFloatingIPs()).andReturn((Set) ImmutableSet.<FloatingIP>of(testIp)).atLeastOnce();
replay(api); replay(api);
replay(ipApi); replay(ipApi);
@ -67,7 +69,7 @@ public class LoadFloatingIpsForInstanceTest {
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.<FloatingIP>of()).atLeastOnce(); expect(ipApi.listFloatingIPs()).andReturn((Set) ImmutableSet.<FloatingIP>of()).atLeastOnce();
replay(api); replay(api);
replay(ipApi); replay(ipApi);
@ -89,7 +91,7 @@ public class LoadFloatingIpsForInstanceTest {
expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce();
expect(ipApi.listFloatingIPs()).andReturn( expect(ipApi.listFloatingIPs()).andReturn(
ImmutableSet.<FloatingIP>of(FloatingIP.builder().id("1").ip("1.1.1.1").build())) (Set) ImmutableSet.<FloatingIP>of(FloatingIP.builder().id("1").ip("1.1.1.1").build()))
.atLeastOnce(); .atLeastOnce();
replay(api); replay(api);

View File

@ -52,7 +52,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
if (!apiOption.isPresent()) if (!apiOption.isPresent())
continue; continue;
FloatingIPApi api = apiOption.get(); FloatingIPApi api = apiOption.get();
Set<FloatingIP> response = api.listFloatingIPs(); Set<? extends FloatingIP> response = api.listFloatingIPs();
assert null != response; assert null != response;
assertTrue(response.size() >= 0); assertTrue(response.size() >= 0);
for (FloatingIP ip : response) { for (FloatingIP ip : response) {
@ -77,7 +77,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest {
FloatingIP floatingIP = api.allocate(); FloatingIP floatingIP = api.allocate();
assertNotNull(floatingIP); assertNotNull(floatingIP);
Set<FloatingIP> response = api.listFloatingIPs(); Set<? extends FloatingIP> response = api.listFloatingIPs();
boolean ipInSet = false; boolean ipInSet = false;
for (FloatingIP ip : response) { for (FloatingIP ip : response) {
if (ip.getId().equals(floatingIP.getId())) if (ip.getId().equals(floatingIP.getId()))

View File

@ -59,7 +59,7 @@ public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest {
Host expected = Host.builder().name("ubuntu").service("compute").build(); Host expected = Host.builder().name("ubuntu").service("compute").build();
Set<Host> result = api.listHosts(); Set<? extends Host> result = api.listHosts();
Host host = Iterables.getOnlyElement(result); Host host = Iterables.getOnlyElement(result);
assertEquals(host.getName(), "ubuntu"); assertEquals(host.getName(), "ubuntu");
assertEquals(host.getService(), "compute"); assertEquals(host.getService(), "compute");

View File

@ -65,7 +65,7 @@ public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest {
public void testListAndGet() throws Exception { public void testListAndGet() throws Exception {
if (optApi.isPresent()) { if (optApi.isPresent()) {
HostAdministrationApi api = optApi.get(); HostAdministrationApi api = optApi.get();
Set<Host> hosts = api.listHosts(); Set<? extends Host> hosts = api.listHosts();
assertNotNull(hosts); assertNotNull(hosts);
for (Host host : hosts) { for (Host host : hosts) {
for (HostResourceUsage usage : api.getHostResourceUsage(host.getName())) { for (HostResourceUsage usage : api.getHostResourceUsage(host.getName())) {

View File

@ -78,7 +78,7 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest {
public void testListAndGetAggregate() { public void testListAndGetAggregate() {
if (apiOption.isPresent()) { if (apiOption.isPresent()) {
HostAggregateApi api = apiOption.get(); HostAggregateApi api = apiOption.get();
Set<HostAggregate> aggregates = api.listAggregates(); Set<? extends HostAggregate> aggregates = api.listAggregates();
for (HostAggregate aggregate : aggregates) { for (HostAggregate aggregate : aggregates) {
assertNotNull(aggregate.getId()); assertNotNull(aggregate.getId());
assertNotNull(aggregate.getName()); assertNotNull(aggregate.getName());

View File

@ -55,6 +55,7 @@ public class KeyPairApiExpectTest extends BaseNovaApiExpectTest {
assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1")); assertEquals(apiWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
// NOTE this required a change to the KeyPair domain object toString method
assertEquals(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().listKeyPairs().toString(), assertEquals(apiWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().listKeyPairs().toString(),
new ParseKeyPairListTest().expected().toString()); new ParseKeyPairListTest().expected().toString());
} }

View File

@ -38,7 +38,7 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest {
public void testListKeyPairs() throws Exception { public void testListKeyPairs() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) { for (String zoneId : novaContext.getApi().getConfiguredZones()) {
KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get(); KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get();
Set<Map<String, KeyPair>> keyPairsList = api.listKeyPairs(); Set<? extends Map<String, ? extends KeyPair>> keyPairsList = api.listKeyPairs();
assertNotNull(keyPairsList); assertNotNull(keyPairsList);
} }
} }

View File

@ -44,7 +44,7 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest {
public void listSecurityGroups() throws Exception { public void listSecurityGroups() throws Exception {
for (String zoneId : novaContext.getApi().getConfiguredZones()) { for (String zoneId : novaContext.getApi().getConfiguredZones()) {
SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get();
Set<SecurityGroup> securityGroupsList = api.listSecurityGroups(); Set<? extends SecurityGroup> securityGroupsList = api.listSecurityGroups();
assertNotNull(securityGroupsList); assertNotNull(securityGroupsList);
} }
} }

View File

@ -58,7 +58,7 @@ public class SimpleTenantUsageApiExpectTest extends BaseNovaApiExpectTest {
.payload(payloadFromResource("/simple_tenant_usages.json")).build()) .payload(payloadFromResource("/simple_tenant_usages.json")).build())
.getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get(); .getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get();
Set<SimpleTenantUsage> results = api.listTenantUsages(); Set<? extends SimpleTenantUsage> results = api.listTenantUsages();
SimpleTenantUsage usage = Iterables.getOnlyElement(results); SimpleTenantUsage usage = Iterables.getOnlyElement(results);
assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921"); assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921");

View File

@ -41,7 +41,7 @@ public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest {
Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); Optional<? extends SimpleTenantUsageApi> optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId);
if (optApi.isPresent() && identity.endsWith(":admin")) { if (optApi.isPresent() && identity.endsWith(":admin")) {
SimpleTenantUsageApi api = optApi.get(); SimpleTenantUsageApi api = optApi.get();
Set<SimpleTenantUsage> usages = api.listTenantUsages(); Set<? extends SimpleTenantUsage> usages = api.listTenantUsages();
assertNotNull(usages); assertNotNull(usages);
for (SimpleTenantUsage usage : usages) { for (SimpleTenantUsage usage : usages) {
SimpleTenantUsage details = api.getTenantUsage(usage.getTenantId()); SimpleTenantUsage details = api.getTenantUsage(usage.getTenantId());

View File

@ -55,7 +55,7 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest {
Server testServer = null; Server testServer = null;
try { try {
testServer = createServerInZone(zone); testServer = createServerInZone(zone);
Set<VirtualInterface> results = apiOption.get().listVirtualInterfacesForServer(testServer.getId()); Set<? extends VirtualInterface> results = apiOption.get().listVirtualInterfacesForServer(testServer.getId());
for (VirtualInterface vif : results) { for (VirtualInterface vif : results) {
assertNotNull(vif.getId()); assertNotNull(vif.getId());
assertNotNull(vif.getMacAddress()); assertNotNull(vif.getMacAddress());

View File

@ -62,7 +62,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<Volume> volumes = api.listVolumes(); Set<? extends Volume> volumes = api.listVolumes();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -75,7 +75,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<Volume> volumes = api.listVolumes(); Set<? extends Volume> volumes = api.listVolumes();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }
@ -88,7 +88,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<Volume> volumes = api.listVolumesInDetail(); Set<? extends Volume> volumes = api.listVolumesInDetail();
assertEquals(volumes, ImmutableSet.of(testVolume())); assertEquals(volumes, ImmutableSet.of(testVolume()));
} }
@ -101,7 +101,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<Volume> volumes = api.listVolumesInDetail(); Set<? extends Volume> volumes = api.listVolumesInDetail();
assertTrue(volumes.isEmpty()); assertTrue(volumes.isEmpty());
} }
@ -203,7 +203,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1"); Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1");
assertEquals(attachments, ImmutableSet.of(testAttachment())); assertEquals(attachments, ImmutableSet.of(testAttachment()));
// double-check individual fields // double-check individual fields
VolumeAttachment attachment = Iterables.getOnlyElement(attachments); VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
@ -312,7 +312,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeSnapshot> snapshots = api.listSnapshots(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
} }
@ -325,7 +325,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeSnapshot> snapshots = api.listSnapshots(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshots();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }
@ -363,7 +363,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeSnapshot> snapshots = api.listSnapshotsInDetail(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail();
assertEquals(snapshots, ImmutableSet.of(testSnapshot())); assertEquals(snapshots, ImmutableSet.of(testSnapshot()));
// double-check individual fields // double-check individual fields
@ -385,7 +385,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(404).build() HttpResponse.builder().statusCode(404).build()
).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeSnapshot> snapshots = api.listSnapshotsInDetail(); Set<? extends VolumeSnapshot> snapshots = api.listSnapshotsInDetail();
assertTrue(snapshots.isEmpty()); assertTrue(snapshots.isEmpty());
} }

View File

@ -108,7 +108,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumes() { public void testListVolumes() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<Volume> volumes = volumeOption.get().listVolumes(); Set<? extends Volume> volumes = volumeOption.get().listVolumes();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -125,7 +125,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolume") @Test(dependsOnMethods = "testCreateVolume")
public void testListVolumesInDetail() { public void testListVolumesInDetail() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<Volume> volumes = volumeOption.get().listVolumesInDetail(); Set<? extends Volume> volumes = volumeOption.get().listVolumesInDetail();
assertNotNull(volumes); assertNotNull(volumes);
boolean foundIt = false; boolean foundIt = false;
for (Volume vol : volumes) { for (Volume vol : volumes) {
@ -174,7 +174,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshots() { public void testListSnapshots() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<VolumeSnapshot> snapshots = volumeOption.get().listSnapshots(); Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshots();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (VolumeSnapshot snap : snapshots) { for (VolumeSnapshot snap : snapshots) {
@ -193,7 +193,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateSnapshot") @Test(dependsOnMethods = "testCreateSnapshot")
public void testListSnapshotsInDetail() { public void testListSnapshotsInDetail() {
if (volumeOption.isPresent()) { if (volumeOption.isPresent()) {
Set<VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail(); Set<? extends VolumeSnapshot> snapshots = volumeOption.get().listSnapshotsInDetail();
assertNotNull(snapshots); assertNotNull(snapshots);
boolean foundIt = false; boolean foundIt = false;
for (VolumeSnapshot snap : snapshots) { for (VolumeSnapshot snap : snapshots) {
@ -225,7 +225,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest {
try { try {
final String serverId = server_id = createServerInZone(zone).getId(); final String serverId = server_id = createServerInZone(zone).getId();
Set<VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId); Set<? extends VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId);
assertNotNull(attachments); assertNotNull(attachments);
final int before = attachments.size(); final int before = attachments.size();

View File

@ -57,7 +57,7 @@ public class VolumeTypeApiExpectTest extends BaseNovaApiExpectTest {
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build() HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build()
).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get(); ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get();
Set<VolumeType> types = api.listVolumeTypes(); Set<? extends VolumeType> types = api.listVolumeTypes();
assertEquals(types, ImmutableSet.of(testVolumeType())); assertEquals(types, ImmutableSet.of(testVolumeType()));
} }

View File

@ -96,7 +96,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest {
@Test(dependsOnMethods = "testCreateVolumeType") @Test(dependsOnMethods = "testCreateVolumeType")
public void testListVolumeTypes() { public void testListVolumeTypes() {
if (volumeTypeOption.isPresent()) { if (volumeTypeOption.isPresent()) {
Set<VolumeType> volumeTypes = volumeTypeOption.get().listVolumeTypes(); Set<? extends VolumeType> volumeTypes = volumeTypeOption.get().listVolumeTypes();
assertNotNull(volumeTypes); assertNotNull(volumeTypes);
boolean foundIt = false; boolean foundIt = false;
for (VolumeType vt : volumeTypes) { for (VolumeType vt : volumeTypes) {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.openstack.nova.v2_0.parse; package org.jclouds.openstack.nova.v2_0.parse;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -33,6 +32,7 @@ import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -52,7 +52,7 @@ public class ParseKeyPairListTest extends BaseItemParserTest<Set<Map<String, Key
@SelectJson("keypairs") @SelectJson("keypairs")
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public Set<Map<String, KeyPair>> expected() { public Set<Map<String, KeyPair>> expected() {
Map<String, KeyPair> kp1 = new HashMap<String, KeyPair>(); Map<String, KeyPair> kp1 = Maps.newHashMap();
kp1.put( kp1.put(
"keypair", "keypair",
KeyPair KeyPair
@ -60,7 +60,7 @@ public class ParseKeyPairListTest extends BaseItemParserTest<Set<Map<String, Key
.publicKey( .publicKey(
"ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQCy9EC3O7Ff80vPEfAHDQob61PGwcpYc5KE7tEZnZhrB9n0NyHPRm0E0M+ls3fcTa04HDi+R0DzmRwoyhHQJyI658v8kWZZcuvFjKCcsgsSh/dzdX0xTreLIzSOzt5U7RnZYfshP5cmxtF99yrEY3M/swdin0L+fXsTSkR1B42STQ== nova@nv-aw2az1-api0001") "ssh-rsa AAAXB3NzaC1yc2EAAAADAQABAAAAgQCy9EC3O7Ff80vPEfAHDQob61PGwcpYc5KE7tEZnZhrB9n0NyHPRm0E0M+ls3fcTa04HDi+R0DzmRwoyhHQJyI658v8kWZZcuvFjKCcsgsSh/dzdX0xTreLIzSOzt5U7RnZYfshP5cmxtF99yrEY3M/swdin0L+fXsTSkR1B42STQ== nova@nv-aw2az1-api0001")
.name("default").fingerprint("ab:0c:f4:f3:54:c0:5d:3f:ed:62:ad:d3:94:7c:79:7c").build()); .name("default").fingerprint("ab:0c:f4:f3:54:c0:5d:3f:ed:62:ad:d3:94:7c:79:7c").build());
Map<String, KeyPair> kp2 = new HashMap<String, KeyPair>(); Map<String, KeyPair> kp2 = Maps.newHashMap();
kp2.put( kp2.put(
"keypair", "keypair",
KeyPair KeyPair