From 931aa7838aba71312dcc75d5ffb6a2b2f79ccfd8 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Tue, 21 Aug 2012 21:48:37 +0300 Subject: [PATCH 1/4] Make all Nova extensions extensible --- .../nova/v2_0/extensions/FloatingIPApi.java | 2 +- .../v2_0/extensions/FloatingIPAsyncApi.java | 6 ++--- .../extensions/HostAdministrationApi.java | 4 ++-- .../HostAdministrationAsyncApi.java | 4 ++-- .../v2_0/extensions/HostAggregateApi.java | 2 +- .../extensions/HostAggregateAsyncApi.java | 16 +++++++------- .../nova/v2_0/extensions/KeyPairApi.java | 2 +- .../nova/v2_0/extensions/KeyPairAsyncApi.java | 6 ++--- .../nova/v2_0/extensions/QuotaAsyncApi.java | 4 ++-- .../v2_0/extensions/QuotaClassAsyncApi.java | 2 +- .../v2_0/extensions/SecurityGroupApi.java | 2 +- .../extensions/SecurityGroupAsyncApi.java | 10 ++++----- .../ServerWithSecurityGroupsAsyncApi.java | 2 +- .../v2_0/extensions/SimpleTenantUsageApi.java | 2 +- .../extensions/SimpleTenantUsageAsyncApi.java | 4 ++-- .../v2_0/extensions/VirtualInterfaceApi.java | 2 +- .../extensions/VirtualInterfaceAsyncApi.java | 2 +- .../nova/v2_0/extensions/VolumeApi.java | 10 ++++----- .../nova/v2_0/extensions/VolumeAsyncApi.java | 22 +++++++++---------- .../nova/v2_0/extensions/VolumeTypeApi.java | 2 +- .../v2_0/extensions/VolumeTypeAsyncApi.java | 6 ++--- 21 files changed, 56 insertions(+), 56 deletions(-) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java index dcc0d7644e..45ee544aad 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPApi.java @@ -42,7 +42,7 @@ public interface FloatingIPApi { * * @return all Floating IPs */ - Set listFloatingIPs(); + Set listFloatingIPs(); /** * Get a specific Floating IP address diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java index 2c09f82b5e..d0db242d20 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/FloatingIPAsyncApi.java @@ -70,7 +70,7 @@ public interface FloatingIPAsyncApi { @SelectJson("floating_ips") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listFloatingIPs(); + ListenableFuture> listFloatingIPs(); /** * @see FloatingIPApi#getFloatingIP @@ -80,7 +80,7 @@ public interface FloatingIPAsyncApi { @SelectJson("floating_ip") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getFloatingIP(@PathParam("id") String id); + ListenableFuture getFloatingIP(@PathParam("id") String id); /** * @see FloatingIPApi#allocate @@ -92,7 +92,7 @@ public interface FloatingIPAsyncApi { @Produces(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) @Payload("{}") - ListenableFuture allocate(); + ListenableFuture allocate(); /** * @see FloatingIPApi#deallocate diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java index 8b305e3801..5b1666f7f2 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApi.java @@ -43,14 +43,14 @@ public interface HostAdministrationApi { * * @return the usage information */ - Set listHosts(); + Set listHosts(); /** * Retrieves the physical/usage resource on a specific host * * @return the usage information */ - Set getHostResourceUsage(String hostId); + Set getHostResourceUsage(String hostId); /** * Allow the specified host to accept new instances. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java index c46d78e616..89ea47fa36 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationAsyncApi.java @@ -73,7 +73,7 @@ public interface HostAdministrationAsyncApi { @GET @SelectJson("hosts") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listHosts(); + ListenableFuture> listHosts(); /** * @see HostAdministrationApi#getHostResourceUsage(String) @@ -82,7 +82,7 @@ public interface HostAdministrationAsyncApi { @Path("/{id}") @SelectJson("host") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> getHostResourceUsage(@PathParam("id") String hostId); + ListenableFuture> getHostResourceUsage(@PathParam("id") String hostId); /** * @see HostAdministrationApi#enableHost(String) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java index 74e3c2817e..61bc112032 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateApi.java @@ -45,7 +45,7 @@ public interface HostAggregateApi { /** * @return the set of host aggregates. */ - Set listAggregates(); + Set listAggregates(); /** * Retrieves the details of an aggregate, hosts and metadata included. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java index 1ea494c756..a964b48e2a 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/HostAggregateAsyncApi.java @@ -66,7 +66,7 @@ public interface HostAggregateAsyncApi { @SelectJson("aggregates") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listAggregates(); + ListenableFuture> listAggregates(); /** * @see HostAggregateApi#getAggregate(String) @@ -76,7 +76,7 @@ public interface HostAggregateAsyncApi { @SelectJson("aggregate") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getAggregate(@PathParam("id") String id); + ListenableFuture getAggregate(@PathParam("id") String id); /** * @see HostAggregateApi#createAggregate(String, String) @@ -86,7 +86,7 @@ public interface HostAggregateAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @WrapWith("aggregate") - ListenableFuture createAggregate(@PayloadParam("name") String name, + ListenableFuture createAggregate(@PayloadParam("name") String name, @PayloadParam("availability_zone") String availabilityZone); /** @@ -97,7 +97,7 @@ public interface HostAggregateAsyncApi { @SelectJson("aggregate") @Consumes(MediaType.APPLICATION_JSON) @WrapWith("aggregate") - ListenableFuture updateName(@PathParam("id") String id, @PayloadParam("name") String name); + ListenableFuture updateName(@PathParam("id") String id, @PayloadParam("name") String name); /** * @see HostAggregateApi#updateAvailabilityZone @@ -107,7 +107,7 @@ public interface HostAggregateAsyncApi { @SelectJson("aggregate") @Consumes(MediaType.APPLICATION_JSON) @WrapWith("aggregate") - ListenableFuture updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone); + ListenableFuture updateAvailabilityZone(@PathParam("id") String id, @PayloadParam("availability_zone") String availabilityZone); /** * @see HostAggregateApi#deleteAggregate(String) @@ -127,7 +127,7 @@ public interface HostAggregateAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @WrapWith("add_host") - ListenableFuture addHost(@PathParam("id") String id, @PayloadParam("host") String host); + ListenableFuture addHost(@PathParam("id") String id, @PayloadParam("host") String host); /** @@ -139,7 +139,7 @@ public interface HostAggregateAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @WrapWith("remove_host") - ListenableFuture removeHost(@PathParam("id") String id, @PayloadParam("host") String host); + ListenableFuture removeHost(@PathParam("id") String id, @PayloadParam("host") String host); /** * @see HostAggregateApi#setMetadata @@ -150,5 +150,5 @@ public interface HostAggregateAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @WrapWith("set_metadata") - ListenableFuture setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map metadata); + ListenableFuture setMetadata(@PathParam("id") String id, @PayloadParam("metadata") Map metadata); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java index 083e1630ac..1d5ae3c049 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApi.java @@ -43,7 +43,7 @@ public interface KeyPairApi { * * @return all Key Pairs */ - Set> listKeyPairs(); + Set> listKeyPairs(); /** * Create a Key Pair. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java index c433b71e2a..3fb1056d38 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairAsyncApi.java @@ -69,7 +69,7 @@ public interface KeyPairAsyncApi { @SelectJson("keypairs") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture>> listKeyPairs(); + ListenableFuture>> listKeyPairs(); @POST @Path("/os-keypairs") @@ -77,7 +77,7 @@ public interface KeyPairAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Payload("%7B\"keypair\":%7B\"name\":\"{name}\"%7D%7D") - ListenableFuture createKeyPair(@PayloadParam("name") String name); + ListenableFuture createKeyPair(@PayloadParam("name") String name); @POST @Path("/os-keypairs") @@ -85,7 +85,7 @@ public interface KeyPairAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Payload("%7B\"keypair\":%7B\"name\":\"{name}\",\"public_key\":\"{publicKey}\"%7D%7D") - ListenableFuture createKeyPairWithPublicKey(@PayloadParam("name") String name, + ListenableFuture createKeyPairWithPublicKey(@PayloadParam("name") String name, @PayloadParam("publicKey") String publicKey); @DELETE diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java index 63025ea6a5..b0f6dc7da7 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaAsyncApi.java @@ -64,7 +64,7 @@ public interface QuotaAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/{tenant_id}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getQuotasForTenant(@PathParam("tenant_id") String tenantId); + ListenableFuture getQuotasForTenant(@PathParam("tenant_id") String tenantId); /** * @see QuotaApi#updateQuotasForTenant(String, org.jclouds.openstack.nova.v2_0.domain.Quotas) @@ -83,6 +83,6 @@ public interface QuotaAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/{tenant_id}/defaults") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getDefaultQuotasForTenant(@PathParam("tenant_id") String tenantId); + ListenableFuture getDefaultQuotasForTenant(@PathParam("tenant_id") String tenantId); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java index 5987bddc05..41cfe91881 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/QuotaClassAsyncApi.java @@ -65,7 +65,7 @@ public interface QuotaClassAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/{id}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getQuotaClass(@PathParam("id") String id); + ListenableFuture getQuotaClass(@PathParam("id") String id); /** * @see QuotaClassApi#updateQuotaClass diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java index 078aa8dc40..8042ad2868 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApi.java @@ -44,7 +44,7 @@ public interface SecurityGroupApi { * * @return all Floating IPs */ - Set listSecurityGroups(); + Set listSecurityGroups(); /** * Get a specific Security Group diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java index 08d3cee86a..438c85eeb3 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupAsyncApi.java @@ -73,7 +73,7 @@ public interface SecurityGroupAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/os-security-groups") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listSecurityGroups(); + ListenableFuture> listSecurityGroups(); /** * @see SecurityGroupApi#getSecurityGroup @@ -83,7 +83,7 @@ public interface SecurityGroupAsyncApi { @SelectJson("security_group") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getSecurityGroup(@PathParam("id") String id); + ListenableFuture getSecurityGroup(@PathParam("id") String id); /** * @see SecurityGroupApi#createSecurityGroupWithNameAndDescription @@ -95,7 +95,7 @@ public interface SecurityGroupAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D") - ListenableFuture createSecurityGroupWithNameAndDescription(@PayloadParam("name") String name, + ListenableFuture createSecurityGroupWithNameAndDescription(@PayloadParam("name") String name, @PayloadParam("description") String description); /** @@ -117,7 +117,7 @@ public interface SecurityGroupAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @MapBinder(BindSecurityGroupRuleToJsonPayload.class) - ListenableFuture createSecurityGroupRuleAllowingCidrBlock( + ListenableFuture createSecurityGroupRuleAllowingCidrBlock( @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol, @PayloadParam("cidr") String cidr); @@ -131,7 +131,7 @@ public interface SecurityGroupAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @MapBinder(BindSecurityGroupRuleToJsonPayload.class) - ListenableFuture createSecurityGroupRuleAllowingSecurityGroupId( + ListenableFuture createSecurityGroupRuleAllowingSecurityGroupId( @PayloadParam("parent_group_id") String parent_group_id, Ingress ip_protocol, @PayloadParam("group_id") String group_id); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java index 54bd5775d4..30b8375f8f 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerWithSecurityGroupsAsyncApi.java @@ -57,6 +57,6 @@ public interface ServerWithSecurityGroupsAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/os-create-server-ext/{id}") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getServer(@PathParam("id") String id); + ListenableFuture getServer(@PathParam("id") String id); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java index eaddaea95a..d17eb19e03 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApi.java @@ -42,7 +42,7 @@ public interface SimpleTenantUsageApi { * * @return the set of TenantUsage reports */ - Set listTenantUsages(); + Set listTenantUsages(); /** * Retrieve tenant_usage for a specified tenant diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java index 4ef262613d..729f50e99e 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageAsyncApi.java @@ -62,7 +62,7 @@ public interface SimpleTenantUsageAsyncApi { @SelectJson("tenant_usages") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listTenantUsages(); + ListenableFuture> listTenantUsages(); /** * @see SimpleTenantUsageApi#getTenantUsage(String) @@ -72,6 +72,6 @@ public interface SimpleTenantUsageAsyncApi { @SelectJson("tenant_usage") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getTenantUsage(@PathParam("id") String tenantId); + ListenableFuture getTenantUsage(@PathParam("id") String tenantId); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java index 550ddd4e1b..257dea3e3c 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceApi.java @@ -41,6 +41,6 @@ public interface VirtualInterfaceApi { * * @return the list of snapshots */ - Set listVirtualInterfacesForServer(String serverId); + Set listVirtualInterfacesForServer(String serverId); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java index 47f1702687..f37bf6904e 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VirtualInterfaceAsyncApi.java @@ -56,5 +56,5 @@ public interface VirtualInterfaceAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/servers/{server_id}/os-virtual-interfaces") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listVirtualInterfacesForServer(@PathParam("server_id") String serverId); + ListenableFuture> listVirtualInterfacesForServer(@PathParam("server_id") String serverId); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java index b4c02257fb..3e3af64ccf 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApi.java @@ -45,14 +45,14 @@ public interface VolumeApi { * * @return the list of snapshots */ - Set listVolumes(); + Set listVolumes(); /** * Returns a detailed list of volumes. * * @return the list of volumes. */ - Set listVolumesInDetail(); + Set listVolumesInDetail(); /** * Return data about the given volume. @@ -80,7 +80,7 @@ public interface VolumeApi { * * @return all Floating IPs */ - Set listAttachmentsOnServer(String serverId); + Set listAttachmentsOnServer(String serverId); /** * Get a specific attached volume. @@ -108,14 +108,14 @@ public interface VolumeApi { * * @return the list of snapshots */ - Set listSnapshots(); + Set listSnapshots(); /** * Returns a summary list of snapshots. * * @return the list of snapshots */ - Set listSnapshotsInDetail(); + Set listSnapshotsInDetail(); /** * Return data about the given snapshot. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java index 18f680bd6d..412183aca3 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeAsyncApi.java @@ -71,7 +71,7 @@ public interface VolumeAsyncApi { @SelectJson("volumes") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listVolumes(); + ListenableFuture> listVolumes(); /** * Returns a detailed list of volumes. @@ -83,7 +83,7 @@ public interface VolumeAsyncApi { @SelectJson("volumes") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listVolumesInDetail(); + ListenableFuture> listVolumesInDetail(); /** * Return data about the given volume. @@ -95,7 +95,7 @@ public interface VolumeAsyncApi { @SelectJson("volume") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVolume(@PathParam("id") String volumeId); + ListenableFuture getVolume(@PathParam("id") String volumeId); /** * Creates a new volume @@ -108,7 +108,7 @@ public interface VolumeAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @MapBinder(CreateVolumeOptions.class) - ListenableFuture createVolume(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options); + ListenableFuture createVolume(@PayloadParam("size") int sizeGB, CreateVolumeOptions... options); /** * Delete a volume. @@ -131,7 +131,7 @@ public interface VolumeAsyncApi { @SelectJson("volumeAttachments") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listAttachmentsOnServer(@PathParam("server_id") String serverId); + ListenableFuture> listAttachmentsOnServer(@PathParam("server_id") String serverId); /** * Get a specific attached volume. @@ -143,7 +143,7 @@ public interface VolumeAsyncApi { @SelectJson("volumeAttachment") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getAttachmentForVolumeOnServer(@PathParam("id") String volumeId, + ListenableFuture getAttachmentForVolumeOnServer(@PathParam("id") String volumeId, @PathParam("server_id") String serverId); /** @@ -157,7 +157,7 @@ public interface VolumeAsyncApi { @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @WrapWith("volumeAttachment") - ListenableFuture attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId, + ListenableFuture attachVolumeToServerAsDevice(@PayloadParam("volumeId") String volumeId, @PathParam("server_id") String serverId, @PayloadParam("device") String device); /** @@ -181,7 +181,7 @@ public interface VolumeAsyncApi { @SelectJson("snapshots") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listSnapshots(); + ListenableFuture> listSnapshots(); /** * Returns a summary list of snapshots. @@ -193,7 +193,7 @@ public interface VolumeAsyncApi { @SelectJson("snapshots") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listSnapshotsInDetail(); + ListenableFuture> listSnapshotsInDetail(); /** * Return data about the given snapshot. @@ -205,7 +205,7 @@ public interface VolumeAsyncApi { @SelectJson("snapshot") @Consumes(MediaType.APPLICATION_JSON) @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getSnapshot(@PathParam("id") String snapshotId); + ListenableFuture getSnapshot(@PathParam("id") String snapshotId); /** * Creates a new Snapshot @@ -218,7 +218,7 @@ public interface VolumeAsyncApi { @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @MapBinder(CreateVolumeSnapshotOptions.class) - ListenableFuture createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options); + ListenableFuture createSnapshot(@PayloadParam("volume_id") String volumeId, CreateVolumeSnapshotOptions... options); /** * Delete a snapshot. diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java index d7506da2f7..b1225c3d0a 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApi.java @@ -47,7 +47,7 @@ public interface VolumeTypeApi { /** * @return set of all volume types */ - Set listVolumeTypes(); + Set listVolumeTypes(); /** * @param id the id of the volume type to retrieve diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java index 2e65e20be8..e50e172a8f 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeAsyncApi.java @@ -72,7 +72,7 @@ public interface VolumeTypeAsyncApi { @GET @SelectJson("volume_types") @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) - ListenableFuture> listVolumeTypes(); + ListenableFuture> listVolumeTypes(); /** @@ -82,7 +82,7 @@ public interface VolumeTypeAsyncApi { @Path("/{id}") @SelectJson("volume_type") @ExceptionParser(ReturnNullOnNotFoundOr404.class) - ListenableFuture getVolumeType(@PathParam("id") String id); + ListenableFuture getVolumeType(@PathParam("id") String id); /** * @see VolumeTypeApi#createVolumeType @@ -91,7 +91,7 @@ public interface VolumeTypeAsyncApi { @SelectJson("volume_type") @Produces(MediaType.APPLICATION_JSON) @WrapWith("volume_type") - ListenableFuture createVolumeType(@PayloadParam("name") String name, CreateVolumeTypeOptions... options); + ListenableFuture createVolumeType(@PayloadParam("name") String name, CreateVolumeTypeOptions... options); /** * @see VolumeTypeApi#deleteVolumeType From 7d70b5ddc3c4eeed964b47dacecebe5d8f94d5e5 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 23 Aug 2012 07:29:40 +0300 Subject: [PATCH 2/4] Updated NovaComputeService and FloatingIp cache to deal with extensibility --- .../openstack/nova/v2_0/compute/NovaComputeService.java | 2 +- .../compute/config/NovaComputeServiceContextModule.java | 6 +++--- .../compute/functions/AllocateAndAddFloatingIpToNode.java | 4 ++-- .../functions/RemoveFloatingIpFromNodeAndDeallocate.java | 4 ++-- .../v2_0/compute/loaders/LoadFloatingIpsForInstance.java | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) 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 f62ef07ca2..211404391e 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 @@ -155,7 +155,7 @@ public class NovaComputeService extends BaseComputeService { Optional keyPairApi = novaApi.getKeyPairExtensionForZone(zoneId); if (keyPairApi.isPresent()) { for (String group : groups) { - for (Map view : keyPairApi.get().listKeyPairs()) { + for (Map view : keyPairApi.get().listKeyPairs()) { for (KeyPair pair : Iterables.filter(view.values(), KeyPairPredicates.nameMatches(namingConvention.create().containsGroup(group)))) { ZoneAndName zoneAndName = ZoneAndName.fromZoneAndName(zoneId, pair.getName()); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java index 8bee10ab79..9b401d105b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/config/NovaComputeServiceContextModule.java @@ -129,7 +129,7 @@ public class NovaComputeServiceContextModule extends bind(TemplateOptions.class).to(NovaTemplateOptions.class); - bind(new TypeLiteral>>() { + bind(new TypeLiteral>>() { }).annotatedWith(Names.named("FLOATINGIP")).to(LoadFloatingIpsForInstance.class); bind(new TypeLiteral>() { @@ -163,8 +163,8 @@ public class NovaComputeServiceContextModule extends @Provides @Singleton @Named("FLOATINGIP") - protected LoadingCache> instanceToFloatingIps( - @Named("FLOATINGIP") CacheLoader> in) { + protected LoadingCache> instanceToFloatingIps( + @Named("FLOATINGIP") CacheLoader> in) { return CacheBuilder.newBuilder().build(in); } diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java index 6e2a59a2ba..0e1193d05b 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/AllocateAndAddFloatingIpToNode.java @@ -61,11 +61,11 @@ public class AllocateAndAddFloatingIpToNode implements private final Predicate> nodeRunning; private final NovaApi novaApi; - private final LoadingCache> floatingIpCache; + private final LoadingCache> floatingIpCache; @Inject public AllocateAndAddFloatingIpToNode(@Named(TIMEOUT_NODE_RUNNING) Predicate> nodeRunning, - NovaApi novaApi, @Named("FLOATINGIP") LoadingCache> floatingIpCache) { + NovaApi novaApi, @Named("FLOATINGIP") LoadingCache> floatingIpCache) { this.nodeRunning = checkNotNull(nodeRunning, "nodeRunning"); this.novaApi = checkNotNull(novaApi, "novaApi"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java index df73e69c68..00f93cbc25 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/functions/RemoveFloatingIpFromNodeAndDeallocate.java @@ -47,11 +47,11 @@ public class RemoveFloatingIpFromNodeAndDeallocate implements Function> floatingIpCache; + private final LoadingCache> floatingIpCache; @Inject public RemoveFloatingIpFromNodeAndDeallocate(NovaApi novaApi, - @Named("FLOATINGIP") LoadingCache> floatingIpCache) { + @Named("FLOATINGIP") LoadingCache> floatingIpCache) { this.novaApi = checkNotNull(novaApi, "novaApi"); this.floatingIpCache = checkNotNull(floatingIpCache, "floatingIpCache"); } 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 578d0b1927..d773bd5b11 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 @@ -40,7 +40,7 @@ import com.google.common.collect.Iterables; * @author Adam Lowe */ @Singleton -public class LoadFloatingIpsForInstance extends CacheLoader> { +public class LoadFloatingIpsForInstance extends CacheLoader> { private final NovaApi api; @Inject @@ -49,7 +49,7 @@ public class LoadFloatingIpsForInstance extends CacheLoader load(final ZoneAndId key) throws Exception { + public Iterable load(final ZoneAndId key) throws Exception { String zone = key.getZone(); Optional ipApiOptional = api.getFloatingIPExtensionForZone(zone); if (ipApiOptional.isPresent()) { From fec936ca36d26566430accd7596766409621e274 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 23 Aug 2012 08:04:37 +0300 Subject: [PATCH 3/4] Update Nova extension tests to use covariant returns --- .../LoadFloatingIpsForInstanceTest.java | 8 +++++--- .../v2_0/extensions/FloatingIPApiLiveTest.java | 4 ++-- .../HostAdministrationApiExpectTest.java | 2 +- .../HostAdministrationApiLiveTest.java | 2 +- .../extensions/HostAggregateApiLiveTest.java | 2 +- .../v2_0/extensions/KeyPairApiLiveTest.java | 2 +- .../extensions/SecurityGroupApiLiveTest.java | 2 +- .../SimpleTenantUsageApiExpectTest.java | 2 +- .../SimpleTenantUsageApiLiveTest.java | 2 +- .../VirtualInterfaceApiLiveTest.java | 2 +- .../v2_0/extensions/VolumeApiExpectTest.java | 18 +++++++++--------- .../v2_0/extensions/VolumeApiLiveTest.java | 10 +++++----- .../extensions/VolumeTypeApiExpectTest.java | 2 +- .../v2_0/extensions/VolumeTypeApiLiveTest.java | 2 +- 14 files changed, 31 insertions(+), 29 deletions(-) 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 6a7e24c2ab..291d89ecbb 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 @@ -25,6 +25,8 @@ import static org.easymock.EasyMock.verify; import static org.testng.Assert.assertEquals; 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.domain.FloatingIP; 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(); expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); - expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.of(testIp)).atLeastOnce(); + expect(ipApi.listFloatingIPs()).andReturn((Set) ImmutableSet.of(testIp)).atLeastOnce(); replay(api); replay(ipApi); @@ -67,7 +69,7 @@ public class LoadFloatingIpsForInstanceTest { expect(api.getFloatingIPExtensionForZone("Zone")).andReturn((Optional) Optional.of(ipApi)).atLeastOnce(); - expect(ipApi.listFloatingIPs()).andReturn(ImmutableSet.of()).atLeastOnce(); + expect(ipApi.listFloatingIPs()).andReturn((Set) ImmutableSet.of()).atLeastOnce(); replay(api); replay(ipApi); @@ -89,7 +91,7 @@ public class LoadFloatingIpsForInstanceTest { 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())) + (Set) ImmutableSet.of(FloatingIP.builder().id("1").ip("1.1.1.1").build())) .atLeastOnce(); replay(api); 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 8940b14da6..a35aaabb9b 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 @@ -52,7 +52,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { if (!apiOption.isPresent()) continue; FloatingIPApi api = apiOption.get(); - Set response = api.listFloatingIPs(); + Set response = api.listFloatingIPs(); assert null != response; assertTrue(response.size() >= 0); for (FloatingIP ip : response) { @@ -77,7 +77,7 @@ public class FloatingIPApiLiveTest extends BaseNovaApiLiveTest { FloatingIP floatingIP = api.allocate(); assertNotNull(floatingIP); - Set response = api.listFloatingIPs(); + Set response = api.listFloatingIPs(); boolean ipInSet = false; for (FloatingIP ip : response) { if (ip.getId().equals(floatingIP.getId())) diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java index 8d616891c7..b824552ec8 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HostAdministrationApiExpectTest.java @@ -59,7 +59,7 @@ public class HostAdministrationApiExpectTest extends BaseNovaApiExpectTest { Host expected = Host.builder().name("ubuntu").service("compute").build(); - Set result = api.listHosts(); + Set result = api.listHosts(); Host host = Iterables.getOnlyElement(result); assertEquals(host.getName(), "ubuntu"); assertEquals(host.getService(), "compute"); 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 88ff7b96d7..20ce931b8e 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 @@ -65,7 +65,7 @@ public class HostAdministrationApiLiveTest extends BaseNovaApiLiveTest { public void testListAndGet() throws Exception { if (optApi.isPresent()) { HostAdministrationApi api = optApi.get(); - Set hosts = api.listHosts(); + Set hosts = api.listHosts(); assertNotNull(hosts); for (Host host : hosts) { for (HostResourceUsage usage : api.getHostResourceUsage(host.getName())) { 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 2224da4474..566c2b3c53 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 @@ -78,7 +78,7 @@ public class HostAggregateApiLiveTest extends BaseNovaApiLiveTest { public void testListAndGetAggregate() { if (apiOption.isPresent()) { HostAggregateApi api = apiOption.get(); - Set aggregates = api.listAggregates(); + Set aggregates = api.listAggregates(); for (HostAggregate aggregate : aggregates) { assertNotNull(aggregate.getId()); assertNotNull(aggregate.getName()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java index 300b263cd4..e8f2837970 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiLiveTest.java @@ -38,7 +38,7 @@ public class KeyPairApiLiveTest extends BaseNovaApiLiveTest { public void testListKeyPairs() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { KeyPairApi api = novaContext.getApi().getKeyPairExtensionForZone(zoneId).get(); - Set> keyPairsList = api.listKeyPairs(); + Set> keyPairsList = api.listKeyPairs(); assertNotNull(keyPairsList); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java index 3168930593..e6a5a57ce8 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SecurityGroupApiLiveTest.java @@ -44,7 +44,7 @@ public class SecurityGroupApiLiveTest extends BaseNovaApiLiveTest { public void listSecurityGroups() throws Exception { for (String zoneId : novaContext.getApi().getConfiguredZones()) { SecurityGroupApi api = novaContext.getApi().getSecurityGroupExtensionForZone(zoneId).get(); - Set securityGroupsList = api.listSecurityGroups(); + Set securityGroupsList = api.listSecurityGroups(); assertNotNull(securityGroupsList); } } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java index 08fef66234..e158655dd2 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/SimpleTenantUsageApiExpectTest.java @@ -58,7 +58,7 @@ public class SimpleTenantUsageApiExpectTest extends BaseNovaApiExpectTest { .payload(payloadFromResource("/simple_tenant_usages.json")).build()) .getSimpleTenantUsageExtensionForZone("az-1.region-a.geo-1").get(); - Set results = api.listTenantUsages(); + Set results = api.listTenantUsages(); SimpleTenantUsage usage = Iterables.getOnlyElement(results); assertEquals(usage.getTenantId(), "f8535069c3fb404cb61c873b1a0b4921"); 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 dfa2c66ff7..4fe7a30b36 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 @@ -41,7 +41,7 @@ public class SimpleTenantUsageApiLiveTest extends BaseNovaApiLiveTest { Optional optApi = novaContext.getApi().getSimpleTenantUsageExtensionForZone(zoneId); if (optApi.isPresent() && identity.endsWith(":admin")) { SimpleTenantUsageApi api = optApi.get(); - Set usages = api.listTenantUsages(); + Set usages = api.listTenantUsages(); assertNotNull(usages); for (SimpleTenantUsage usage : usages) { SimpleTenantUsage details = api.getTenantUsage(usage.getTenantId()); 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 1962a0f9e8..f409ea1181 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 @@ -55,7 +55,7 @@ public class VirtualInterfaceApiLiveTest extends BaseNovaApiLiveTest { Server testServer = null; try { testServer = createServerInZone(zone); - Set results = apiOption.get().listVirtualInterfacesForServer(testServer.getId()); + Set results = apiOption.get().listVirtualInterfacesForServer(testServer.getId()); for (VirtualInterface vif : results) { assertNotNull(vif.getId()); assertNotNull(vif.getMacAddress()); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java index 9e0d7c5b55..80bde501e3 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeApiExpectTest.java @@ -62,7 +62,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set volumes = api.listVolumes(); + Set volumes = api.listVolumes(); assertEquals(volumes, ImmutableSet.of(testVolume())); } @@ -75,7 +75,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set volumes = api.listVolumes(); + Set volumes = api.listVolumes(); assertTrue(volumes.isEmpty()); } @@ -88,7 +88,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_list_detail.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set volumes = api.listVolumesInDetail(); + Set volumes = api.listVolumesInDetail(); assertEquals(volumes, ImmutableSet.of(testVolume())); } @@ -101,7 +101,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set volumes = api.listVolumesInDetail(); + Set volumes = api.listVolumesInDetail(); assertTrue(volumes.isEmpty()); } @@ -203,7 +203,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_list.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set attachments = api.listAttachmentsOnServer("instance-1"); + Set attachments = api.listAttachmentsOnServer("instance-1"); assertEquals(attachments, ImmutableSet.of(testAttachment())); // double-check individual fields VolumeAttachment attachment = Iterables.getOnlyElement(attachments); @@ -312,7 +312,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set snapshots = api.listSnapshots(); + Set snapshots = api.listSnapshots(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); } @@ -325,7 +325,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set snapshots = api.listSnapshots(); + Set snapshots = api.listSnapshots(); assertTrue(snapshots.isEmpty()); } @@ -363,7 +363,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/snapshot_list_detail.json")).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set snapshots = api.listSnapshotsInDetail(); + Set snapshots = api.listSnapshotsInDetail(); assertEquals(snapshots, ImmutableSet.of(testSnapshot())); // double-check individual fields @@ -385,7 +385,7 @@ public class VolumeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(404).build() ).getVolumeExtensionForZone("az-1.region-a.geo-1").get(); - Set snapshots = api.listSnapshotsInDetail(); + Set snapshots = api.listSnapshotsInDetail(); assertTrue(snapshots.isEmpty()); } 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 cbd1e52b69..fe10147f79 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 @@ -108,7 +108,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { @Test(dependsOnMethods = "testCreateVolume") public void testListVolumes() { if (volumeOption.isPresent()) { - Set volumes = volumeOption.get().listVolumes(); + Set volumes = volumeOption.get().listVolumes(); assertNotNull(volumes); boolean foundIt = false; for (Volume vol : volumes) { @@ -125,7 +125,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { @Test(dependsOnMethods = "testCreateVolume") public void testListVolumesInDetail() { if (volumeOption.isPresent()) { - Set volumes = volumeOption.get().listVolumesInDetail(); + Set volumes = volumeOption.get().listVolumesInDetail(); assertNotNull(volumes); boolean foundIt = false; for (Volume vol : volumes) { @@ -174,7 +174,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { @Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshots() { if (volumeOption.isPresent()) { - Set snapshots = volumeOption.get().listSnapshots(); + Set snapshots = volumeOption.get().listSnapshots(); assertNotNull(snapshots); boolean foundIt = false; for (VolumeSnapshot snap : snapshots) { @@ -193,7 +193,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { @Test(dependsOnMethods = "testCreateSnapshot") public void testListSnapshotsInDetail() { if (volumeOption.isPresent()) { - Set snapshots = volumeOption.get().listSnapshotsInDetail(); + Set snapshots = volumeOption.get().listSnapshotsInDetail(); assertNotNull(snapshots); boolean foundIt = false; for (VolumeSnapshot snap : snapshots) { @@ -225,7 +225,7 @@ public class VolumeApiLiveTest extends BaseNovaApiLiveTest { try { final String serverId = server_id = createServerInZone(zone).getId(); - Set attachments = volumeOption.get().listAttachmentsOnServer(serverId); + Set attachments = volumeOption.get().listAttachmentsOnServer(serverId); assertNotNull(attachments); final int before = attachments.size(); diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java index f024a98586..a62308adac 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/VolumeTypeApiExpectTest.java @@ -57,7 +57,7 @@ public class VolumeTypeApiExpectTest extends BaseNovaApiExpectTest { HttpResponse.builder().statusCode(200).payload(payloadFromResource("/volume_type_list.json")).build() ).getVolumeTypeExtensionForZone("az-1.region-a.geo-1").get(); - Set types = api.listVolumeTypes(); + Set types = api.listVolumeTypes(); assertEquals(types, ImmutableSet.of(testVolumeType())); } 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 9270a2e901..6d87e17c07 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 @@ -96,7 +96,7 @@ public class VolumeTypeApiLiveTest extends BaseNovaApiLiveTest { @Test(dependsOnMethods = "testCreateVolumeType") public void testListVolumeTypes() { if (volumeTypeOption.isPresent()) { - Set volumeTypes = volumeTypeOption.get().listVolumeTypes(); + Set volumeTypes = volumeTypeOption.get().listVolumeTypes(); assertNotNull(volumeTypes); boolean foundIt = false; for (VolumeType vt : volumeTypes) { From 0a7a9f378e498bd1a1283dd5e18b7134a186ecf6 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Thu, 23 Aug 2012 16:52:14 +0300 Subject: [PATCH 4/4] Updated KeyPair toString method to make expect test pass --- .../org/jclouds/openstack/nova/v2_0/domain/KeyPair.java | 9 +++++++-- .../nova/v2_0/extensions/KeyPairApiExpectTest.java | 1 + .../openstack/nova/v2_0/parse/ParseKeyPairListTest.java | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java index cb59e6744d..f14332ef70 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/KeyPair.java @@ -174,8 +174,13 @@ public class KeyPair { } protected ToStringHelper string() { - return Objects.toStringHelper(this) - .add("publicKey", publicKey).add("privateKey", privateKey).add("userId", userId).add("name", name).add("fingerprint", fingerprint); + return Objects.toStringHelper("") + .omitNullValues() + .add("public_key", publicKey) + .add("private_key", privateKey) + .add("user_id", userId) + .add("name", name) + .add("fingerprint", fingerprint); } @Override diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java index 4e39d8922b..5f215c3b50 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/KeyPairApiExpectTest.java @@ -55,6 +55,7 @@ public class KeyPairApiExpectTest extends BaseNovaApiExpectTest { 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(), new ParseKeyPairListTest().expected().toString()); } diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java index 0cd7354993..bc30d5b001 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseKeyPairListTest.java @@ -18,7 +18,6 @@ */ package org.jclouds.openstack.nova.v2_0.parse; -import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -33,6 +32,7 @@ import org.jclouds.rest.annotations.SelectJson; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; import com.google.inject.Guice; import com.google.inject.Injector; @@ -52,7 +52,7 @@ public class ParseKeyPairListTest extends BaseItemParserTest> expected() { - Map kp1 = new HashMap(); + Map kp1 = Maps.newHashMap(); kp1.put( "keypair", KeyPair @@ -60,7 +60,7 @@ public class ParseKeyPairListTest extends BaseItemParserTest kp2 = new HashMap(); + Map kp2 = Maps.newHashMap(); kp2.put( "keypair", KeyPair