From 206dd67c0017cd11dce7f39c5fc946cc842c70da Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 19 Mar 2012 17:50:30 -0700 Subject: [PATCH] revised syntax of security groups --- .../extensions/SecurityGroupAsyncClient.java | 4 ++-- .../v1_1/extensions/SecurityGroupClient.java | 2 +- .../SecurityGroupClientExpectTest.java | 2 +- .../extensions/SecurityGroupClientLiveTest.java | 16 ++++++++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupAsyncClient.java b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupAsyncClient.java index 9da280bd35..bd242577c4 100644 --- a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupAsyncClient.java +++ b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupAsyncClient.java @@ -84,7 +84,7 @@ public interface SecurityGroupAsyncClient { ListenableFuture getSecurityGroup(@PathParam("id") String id); /** - * @see SecurityGroupClient#createSecurityGroup + * @see SecurityGroupClient#createSecurityGroupWithNameAndDescription */ @POST @Path("/os-security-groups") @@ -93,7 +93,7 @@ public interface SecurityGroupAsyncClient { @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Payload("%7B\"security_group\":%7B\"name\":\"{name}\",\"description\":\"{description}\"%7D%7D") - ListenableFuture createSecurityGroup(@PayloadParam("name") String name, + ListenableFuture createSecurityGroupWithNameAndDescription(@PayloadParam("name") String name, @PayloadParam("description") String description); /** diff --git a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClient.java b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClient.java index 47dd9ae215..8a3a2ab099 100644 --- a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClient.java +++ b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClient.java @@ -57,7 +57,7 @@ public interface SecurityGroupClient { * * @return a new Security Group */ - SecurityGroup createSecurityGroup(String name, String description); + SecurityGroup createSecurityGroupWithNameAndDescription(String name, String description); /** * Delete a Security Group. diff --git a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientExpectTest.java b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientExpectTest.java index 0e54cafbb5..cb04b684b7 100644 --- a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientExpectTest.java +++ b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientExpectTest.java @@ -149,7 +149,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest { assertEquals( clientWhenSecurityGroupsExist.getSecurityGroupExtensionForZone("az-1.region-a.geo-1").get() - .createSecurityGroup("name", "description").toString(), createSecurityGroupExpected().toString()); + .createSecurityGroupWithNameAndDescription("name", "description").toString(), createSecurityGroupExpected().toString()); } public void testDeleteSecurityGroupWhenResponseIs2xx() throws Exception { diff --git a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientLiveTest.java b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientLiveTest.java index 44cde49141..3abae242f7 100644 --- a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientLiveTest.java +++ b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/extensions/SecurityGroupClientLiveTest.java @@ -51,7 +51,8 @@ public class SecurityGroupClientLiveTest extends BaseNovaClientLiveTest { SecurityGroup securityGroup = null; String id; try { - securityGroup = client.createSecurityGroup(SECURITY_GROUP_NAME, "test security group"); + securityGroup = client + .createSecurityGroupWithNameAndDescription(SECURITY_GROUP_NAME, "test security group"); assertNotNull(securityGroup); id = securityGroup.getId(); SecurityGroup theGroup = client.getSecurityGroup(id); @@ -70,13 +71,20 @@ public class SecurityGroupClientLiveTest extends BaseNovaClientLiveTest { SecurityGroup securityGroup = null; try { - securityGroup = client.createSecurityGroup(SECURITY_GROUP_NAME, "test security group"); + securityGroup = client + .createSecurityGroupWithNameAndDescription(SECURITY_GROUP_NAME, "test security group"); assertNotNull(securityGroup); - SecurityGroupRule rule = client.createSecurityGroupRule("tcp", "443", "443", "0.0.0.0/0", "", - securityGroup.getId()); + SecurityGroupRule rule = client.createSecurityGroupRule("tcp", "443", "443", "0.0.0.0/0", "", securityGroup + .getId()); assertNotNull(rule); + SecurityGroupRule rule2 = client.createSecurityGroupRule("tcp", "443", "443", "", securityGroup.getId(), + securityGroup.getId()); + assertNotNull(rule2); + + securityGroup = client.getSecurityGroup(securityGroup.getId()); + } finally { if (securityGroup != null) { client.deleteSecurityGroup(securityGroup.getId());