From a7d73a2d64bc4503e826fedea176ac28ad386a7e Mon Sep 17 00:00:00 2001 From: Alex Yarmula Date: Tue, 16 Mar 2010 16:55:19 -0700 Subject: [PATCH] fix for multiple security groups in ec2 --- .../aws/ec2/options/RunInstancesOptions.java | 17 ++++++++++---- .../ec2/services/InstanceAsyncClientTest.java | 22 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java b/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java index fdaeae56c6..9d8eef0966 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/options/RunInstancesOptions.java @@ -37,7 +37,7 @@ import org.jclouds.encryption.internal.Base64; * EC2Client connection = // get connection * ListenableFuture instances = connection.runInstances(executableBy("123125").imageIds(1000, 1004)); * - * + * * @author Adrian Cole * @see RunInstancesOptions.class, 0).getClass()); GeneratedHttpRequest httpMethod = processor.createRequest(method, Region.EU_WEST_1, AvailabilityZone.EU_WEST_1A, "ami-voo", 1, 5, - new RunInstancesOptions().withKernelId("kernelId").enableMonitoring()); + new RunInstancesOptions().withKernelId("kernelId").enableMonitoring(). + withSecurityGroups("group1", "group2")); + + assertRequestLineEquals(httpMethod, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1"); + assertHeadersEqual( + httpMethod, + "Content-Length: 164\nContent-Type: application/x-www-form-urlencoded\nHost: ec2.eu-west-1.amazonaws.com\n"); + assertPayloadEquals( + httpMethod, + "Version=2009-11-30&Action=RunInstances&ImageId=ami-voo&MinCount=1&MaxCount=5&KernelId=kernelId&Monitoring.Enabled=true&SecurityGroup.1=group1&SecurityGroup.2=group2&Placement.AvailabilityZone=eu-west-1a"); - assertRequestLineEquals(httpMethod, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1"); - assertHeadersEqual( - httpMethod, - "Content-Length: 118\nContent-Type: application/x-www-form-urlencoded\nHost: ec2.eu-west-1.amazonaws.com\n"); - assertPayloadEquals( - httpMethod, - "Version=2009-11-30&Action=RunInstances&ImageId=ami-voo&MinCount=1&MaxCount=5&KernelId=kernelId&Monitoring.Enabled=true&Placement.AvailabilityZone=eu-west-1a"); assertResponseParserClassEquals(method, httpMethod, ParseSax.class); assertSaxResponseParserClassEquals(method, RunInstancesResponseHandler.class);