mirror of https://github.com/apache/jclouds.git
unhooked version dependency from ec2 async tests
This commit is contained in:
parent
6dc03a7993
commit
ac7a4b5354
|
@ -21,6 +21,8 @@ package org.jclouds.ec2.binders;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
|
import static org.jclouds.http.utils.Queries.queryParser;
|
||||||
|
import static org.jclouds.io.Payloads.newUrlEncodedFormPayload;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -29,9 +31,8 @@ import org.jclouds.ec2.domain.BlockDevice;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.rest.Binder;
|
import org.jclouds.rest.Binder;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Multimaps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
|
@ -40,28 +41,29 @@ import com.google.common.collect.Multimaps;
|
||||||
public class BindBlockDeviceMappingToIndexedFormParams implements Binder {
|
public class BindBlockDeviceMappingToIndexedFormParams implements Binder {
|
||||||
|
|
||||||
private static final String deviceNamePattern = "BlockDeviceMapping.%d.DeviceName";
|
private static final String deviceNamePattern = "BlockDeviceMapping.%d.DeviceName";
|
||||||
private static final String volumeIdPattern = "BlockDeviceMapping.%d.Ebs.VolumeId";
|
|
||||||
private static final String deleteOnTerminationPattern = "BlockDeviceMapping.%d.Ebs.DeleteOnTermination";
|
private static final String deleteOnTerminationPattern = "BlockDeviceMapping.%d.Ebs.DeleteOnTermination";
|
||||||
|
private static final String volumeIdPattern = "BlockDeviceMapping.%d.Ebs.VolumeId";
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
|
||||||
checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Map");
|
checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Map");
|
||||||
Map<String, BlockDevice> blockDeviceMapping = (Map<String, BlockDevice>) input;
|
Map<String, BlockDevice> blockDeviceMapping = (Map<String, BlockDevice>) input;
|
||||||
|
Multimap<String, String> original = queryParser().apply(request.getPayload().getRawContent().toString());
|
||||||
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
|
ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
|
||||||
|
builder.putAll("Action", "ModifyInstanceAttribute");
|
||||||
int amazonOneBasedIndex = 1; // according to docs, counters must start with 1
|
int amazonOneBasedIndex = 1; // according to docs, counters must start with 1
|
||||||
for (Entry<String, BlockDevice> ebsBlockDeviceName : blockDeviceMapping.entrySet()) {
|
for (Entry<String, BlockDevice> ebsBlockDeviceName : blockDeviceMapping.entrySet()) {
|
||||||
// not null by contract
|
// not null by contract
|
||||||
builder.put(format(volumeIdPattern, amazonOneBasedIndex), ebsBlockDeviceName.getValue().getVolumeId());
|
|
||||||
builder.put(format(deviceNamePattern, amazonOneBasedIndex), ebsBlockDeviceName.getKey());
|
builder.put(format(deviceNamePattern, amazonOneBasedIndex), ebsBlockDeviceName.getKey());
|
||||||
builder.put(format(deleteOnTerminationPattern, amazonOneBasedIndex),
|
builder.put(format(deleteOnTerminationPattern, amazonOneBasedIndex),
|
||||||
String.valueOf(ebsBlockDeviceName.getValue().isDeleteOnTermination()));
|
String.valueOf(ebsBlockDeviceName.getValue().isDeleteOnTermination()));
|
||||||
|
builder.put(format(volumeIdPattern, amazonOneBasedIndex), ebsBlockDeviceName.getValue().getVolumeId());
|
||||||
amazonOneBasedIndex++;
|
amazonOneBasedIndex++;
|
||||||
}
|
}
|
||||||
Multimap<String, String> forms = Multimaps.forMap(builder.build());
|
builder.putAll("InstanceId", original.get("InstanceId"));
|
||||||
return forms.size() == 0 ? request : (R) request.toBuilder().replaceFormParams(forms).build();
|
request.setPayload(newUrlEncodedFormPayload(builder.build()));
|
||||||
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,17 +44,18 @@ public class BindBlockDeviceMappingToIndexedFormParamsTest {
|
||||||
BindBlockDeviceMappingToIndexedFormParams binder = injector
|
BindBlockDeviceMappingToIndexedFormParams binder = injector
|
||||||
.getInstance(BindBlockDeviceMappingToIndexedFormParams.class);
|
.getInstance(BindBlockDeviceMappingToIndexedFormParams.class);
|
||||||
|
|
||||||
public void testMapping() {
|
public void testMappingOrdersLexicographically() {
|
||||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||||
mapping.put("apple", new BlockDevice("appleId", true));
|
mapping.put("apple", new BlockDevice("appleId", true));
|
||||||
Date date = new Date(999999l);
|
Date date = new Date(999999l);
|
||||||
mapping.put("cranberry", new BlockDevice("cranberry", Status.ATTACHED, date, false));
|
mapping.put("cranberry", new BlockDevice("cranberry", Status.ATTACHED, date, false));
|
||||||
|
|
||||||
HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost").build();
|
HttpRequest request = HttpRequest.builder().method("POST").endpoint("http://localhost")
|
||||||
|
.addFormParam("InstanceId", "i-foo").build();
|
||||||
request = binder.bindToRequest(request, mapping);
|
request = binder.bindToRequest(request, mapping);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
request.getPayload().getRawContent(),
|
request.getPayload().getRawContent(),
|
||||||
"BlockDeviceMapping.1.Ebs.VolumeId=appleId&BlockDeviceMapping.1.DeviceName=apple&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.2.Ebs.VolumeId=cranberry&BlockDeviceMapping.2.DeviceName=cranberry&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false");
|
"Action=ModifyInstanceAttribute&BlockDeviceMapping.1.DeviceName=apple&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeId=appleId&BlockDeviceMapping.2.DeviceName=cranberry&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.Ebs.VolumeId=cranberry&InstanceId=i-foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = IllegalArgumentException.class)
|
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||||
|
|
|
@ -547,6 +547,15 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setBlockDeviceMapping = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.VolumeId", "vol-test1")
|
||||||
|
.addFormParam("InstanceId", "1").build();
|
||||||
|
|
||||||
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
||||||
|
@ -556,20 +565,13 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||||
|
|
||||||
|
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, filter.filter(setBlockDeviceMapping).getPayload().getRawContent().toString(),
|
||||||
request,
|
"application/x-www-form-urlencoded", false);
|
||||||
"Action=ModifyInstanceAttribute&InstanceId=1&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&BlockDeviceMapping.1.DeviceName=/dev/sda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
filter.filter(request);// ensure encoding worked properly
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&BlockDeviceMapping.1.DeviceName=/dev/sda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&InstanceId=1&Signature=RwY8lVPHSQxQkd5efUKccHdSTkN4OxMIMFiYAe3rrUE%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface AWSEC2AsyncClient extends EC2AsyncClient {
|
public interface AWSEC2AsyncClient extends EC2AsyncClient {
|
||||||
public static final String VERSION = "2011-05-15";
|
public static final String VERSION = "2012-06-01";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
|
|
@ -59,13 +59,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "CreateImage")
|
.addFormParam("Action", "CreateImage")
|
||||||
.addFormParam("InstanceId", "instanceId")
|
.addFormParam("InstanceId", "instanceId")
|
||||||
.addFormParam("Name", "name")
|
.addFormParam("Name", "name").build();
|
||||||
.addFormParam("Signature", "ISQJKjDmhy9Vyc5zKYfkSk%2B2zIu%2Bfm6nc4H0a4mvmcU=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
||||||
|
@ -76,7 +70,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, createImage.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(createImage).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -92,13 +86,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("Description", "description")
|
.addFormParam("Description", "description")
|
||||||
.addFormParam("InstanceId", "instanceId")
|
.addFormParam("InstanceId", "instanceId")
|
||||||
.addFormParam("Name", "name")
|
.addFormParam("Name", "name")
|
||||||
.addFormParam("NoReboot", "true")
|
.addFormParam("NoReboot", "true").build();
|
||||||
.addFormParam("Signature", "nEpcd4m4UGl7OUm3sIlknV98HzHRUg4WYd/doIJ9S84=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
||||||
|
@ -110,7 +98,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, createImageOptions.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(createImageOptions).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -123,13 +111,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
HttpRequest describeImages = HttpRequest.builder().method("POST")
|
HttpRequest describeImages = HttpRequest.builder().method("POST")
|
||||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "DescribeImages")
|
.addFormParam("Action", "DescribeImages").build();
|
||||||
.addFormParam("Signature", "tMg44xaebrZMOYS6EOf2RvvrOEJMacSlNAJaQruj100=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "describeImagesInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "describeImagesInRegion", String.class,
|
||||||
|
@ -140,7 +122,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, describeImages.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(describeImages).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -158,13 +140,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("ImageId.1", "1")
|
.addFormParam("ImageId.1", "1")
|
||||||
.addFormParam("ImageId.2", "2")
|
.addFormParam("ImageId.2", "2")
|
||||||
.addFormParam("Owner.1", "fred")
|
.addFormParam("Owner.1", "fred")
|
||||||
.addFormParam("Owner.2", "nancy")
|
.addFormParam("Owner.2", "nancy").build();
|
||||||
.addFormParam("Signature", "WeMm/2znlzxYhwQqbcLr74qXreoQ60WI76T6NKZ071Q=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "describeImagesInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "describeImagesInRegion", String.class,
|
||||||
|
@ -176,7 +152,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, describeImagesOptions.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(describeImagesOptions).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -190,13 +166,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "DeregisterImage")
|
.addFormParam("Action", "DeregisterImage")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId").build();
|
||||||
.addFormParam("Signature", "89plCGzc15vXmjO38/B430Pwz5/Zv6%2BxLwIQivUJIQ8=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "deregisterImageInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "deregisterImageInRegion", String.class, String.class);
|
||||||
|
@ -206,7 +176,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, deregisterImage.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(deregisterImage).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -221,13 +191,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "RegisterImage")
|
.addFormParam("Action", "RegisterImage")
|
||||||
.addFormParam("ImageLocation", "pathToManifest")
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
.addFormParam("Name", "name")
|
.addFormParam("Name", "name").build();
|
||||||
.addFormParam("Signature", "XnUpMvw7tz6PEngDmt%2Bx2XKFFfV1HWg54rxv5DrudrQ=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||||
|
@ -238,7 +202,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, registerImageFromManifest.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(registerImageFromManifest).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -253,13 +217,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("Action", "RegisterImage")
|
.addFormParam("Action", "RegisterImage")
|
||||||
.addFormParam("Description", "description")
|
.addFormParam("Description", "description")
|
||||||
.addFormParam("ImageLocation", "pathToManifest")
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
.addFormParam("Name", "name")
|
.addFormParam("Name", "name").build();
|
||||||
.addFormParam("Signature", "/nJBP27hFsDual7ZRIK8fQsWiNNA8hWaVY7AFIuismE=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||||
|
@ -271,8 +229,8 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, registerImageFromManifestOptions.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(registerImageFromManifestOptions).getPayload().getRawContent()
|
||||||
"application/x-www-form-urlencoded", false);
|
.toString(), "application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -288,13 +246,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
||||||
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
||||||
.addFormParam("Name", "imageName")
|
.addFormParam("Name", "imageName")
|
||||||
.addFormParam("RootDeviceName", "/dev/sda1")
|
.addFormParam("RootDeviceName", "/dev/sda1").build();
|
||||||
.addFormParam("Signature", "Pj242OpjbY4NXvaVYzQdjTud4N68NIxQP0oRZtdjd%2BY=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
|
@ -305,7 +257,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, registerImageBackedByEBS.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(registerImageBackedByEBS).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -329,13 +281,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("BlockDeviceMapping.2.VirtualName", "newblock")
|
.addFormParam("BlockDeviceMapping.2.VirtualName", "newblock")
|
||||||
.addFormParam("Description", "description")
|
.addFormParam("Description", "description")
|
||||||
.addFormParam("Name", "imageName")
|
.addFormParam("Name", "imageName")
|
||||||
.addFormParam("RootDeviceName", "/dev/sda1")
|
.addFormParam("RootDeviceName", "/dev/sda1").build();
|
||||||
.addFormParam("Signature", "QGwHRDis98NSU2KU9W52srltVyAQrDtj3MQ5YlzNX3I=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
|
@ -348,8 +294,8 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, registerImageBackedByEBSOptions.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(registerImageBackedByEBSOptions).getPayload().getRawContent()
|
||||||
"application/x-www-form-urlencoded", false);
|
.toString(), "application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -363,13 +309,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "DescribeImageAttribute")
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
.addFormParam("Attribute", "blockDeviceMapping")
|
.addFormParam("Attribute", "blockDeviceMapping")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId").build();
|
||||||
.addFormParam("Signature", "aJjRBDJvQ91Zw33%2BLqyhDsfQdWxF2xdN3KlV90pGCb0=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "getBlockDeviceMappingsForImageInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "getBlockDeviceMappingsForImageInRegion", String.class,
|
||||||
|
@ -380,8 +320,8 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, getBlockDeviceMappingsForImage.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(getBlockDeviceMappingsForImage).getPayload().getRawContent()
|
||||||
"application/x-www-form-urlencoded", false);
|
.toString(), "application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, BlockDeviceMappingHandler.class);
|
assertSaxResponseParserClassEquals(method, BlockDeviceMappingHandler.class);
|
||||||
|
@ -395,13 +335,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "DescribeImageAttribute")
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
.addFormParam("Attribute", "launchPermission")
|
.addFormParam("Attribute", "launchPermission")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId").build();
|
||||||
.addFormParam("Signature", "qVRsCNECPCvnU340sv7yLVCDzRYIMGCyAypl4ioWKVU=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "getLaunchPermissionForImageInRegion", String.class, String.class);
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "getLaunchPermissionForImageInRegion", String.class, String.class);
|
||||||
|
@ -411,7 +345,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, getLaunchPermissionForImage.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(getLaunchPermissionForImage).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -428,15 +362,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("Attribute", "launchPermission")
|
.addFormParam("Attribute", "launchPermission")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId")
|
||||||
.addFormParam("OperationType", "add")
|
.addFormParam("OperationType", "add")
|
||||||
.addFormParam("Signature", "CpCCffn%2BuR5LjbI/iCTl7%2BsrPxbrYEYvVZue%2BmWgRgE=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("UserGroup.1", "all")
|
.addFormParam("UserGroup.1", "all")
|
||||||
.addFormParam("UserId.1", "bob")
|
.addFormParam("UserId.1", "bob")
|
||||||
.addFormParam("UserId.2", "sue")
|
.addFormParam("UserId.2", "sue").build();
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "addLaunchPermissionsToImageInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "addLaunchPermissionsToImageInRegion", String.class,
|
||||||
|
@ -448,7 +376,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, addLaunchPermission.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(addLaunchPermission).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -465,15 +393,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addFormParam("Attribute", "launchPermission")
|
.addFormParam("Attribute", "launchPermission")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId")
|
||||||
.addFormParam("OperationType", "remove")
|
.addFormParam("OperationType", "remove")
|
||||||
.addFormParam("Signature", "ScuPcaRhVy/Je%2BXUGIo1mB4IUevDBW/0tAod4FHQQS8=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("UserGroup.1", "all")
|
.addFormParam("UserGroup.1", "all")
|
||||||
.addFormParam("UserId.1", "bob")
|
.addFormParam("UserId.1", "bob")
|
||||||
.addFormParam("UserId.2", "sue")
|
.addFormParam("UserId.2", "sue").build();
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "removeLaunchPermissionsFromImageInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "removeLaunchPermissionsFromImageInRegion", String.class,
|
||||||
|
@ -485,7 +407,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, removeLaunchPermission.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(removeLaunchPermission).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -499,13 +421,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "ResetImageAttribute")
|
.addFormParam("Action", "ResetImageAttribute")
|
||||||
.addFormParam("Attribute", "launchPermission")
|
.addFormParam("Attribute", "launchPermission")
|
||||||
.addFormParam("ImageId", "imageId")
|
.addFormParam("ImageId", "imageId").build();
|
||||||
.addFormParam("Signature", "l9F9IalCsYbGGf8O/35lLhttJ4vLLgoZZHUpmCCH9tI=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "resetLaunchPermissionsOnImageInRegion", String.class,
|
Invokable<?, ?> method = method(AWSAMIAsyncClient.class, "resetLaunchPermissionsOnImageInRegion", String.class,
|
||||||
|
@ -516,7 +432,8 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, resetLaunchPermissionsOnImage.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request,
|
||||||
|
filter.filter(resetLaunchPermissionsOnImage).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
|
|
@ -349,13 +349,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "userData")
|
.addFormParam("Attribute", "userData")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "nArJlrtyAfgqDnXxv%2B2y0r9O%2BIfUcitpQMjfQR0oeRM=")
|
.addFormParam("Value", "dGVzdA%3D%3D").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "dGVzdA%3D%3D")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setUserDataForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setUserDataForInstanceInRegion", String.class, String.class,
|
||||||
|
@ -366,7 +360,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, setUserDataForInstance.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(setUserDataForInstance).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -382,13 +376,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "ramdisk")
|
.addFormParam("Attribute", "ramdisk")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "y9xr294R57Pjzzafq90Xi2LMi0JKj/Jwy5HL%2BYWyTvo=")
|
.addFormParam("Value", "test").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "test")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setRamdiskForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setRamdiskForInstanceInRegion", String.class, String.class,
|
||||||
|
@ -399,7 +387,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, setRamdiskForInstance.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(setRamdiskForInstance).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -415,13 +403,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "kernel")
|
.addFormParam("Attribute", "kernel")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "vqAuTOcX6i8UfiVGAO/2yz2HHTqZyayiy/SiEU4ySws=")
|
.addFormParam("Value", "test").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "test")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setKernelForInstanceInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setKernelForInstanceInRegion", String.class, String.class,
|
||||||
|
@ -432,7 +414,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, setKernelForInstance.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(setKernelForInstance).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -448,13 +430,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "disableApiTermination")
|
.addFormParam("Attribute", "disableApiTermination")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "tOgWZ2rJ2KDgV55oMEa3RXKHvroiuqZfGfugBCV7ZLk=")
|
.addFormParam("Value", "true").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "true")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
|
@ -466,7 +442,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, setApiTerminationDisabled.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(setApiTerminationDisabled).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -482,13 +458,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "instanceType")
|
.addFormParam("Attribute", "instanceType")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "DC1r80OrSLCVcVt/y3gUPWxRWrPK8T96FXjNfmCMwRY=")
|
.addFormParam("Value", "c1.medium").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "c1.medium")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setInstanceTypeForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setInstanceTypeForInstanceInRegion", String.class,
|
||||||
|
@ -499,7 +469,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, instanceTypeForInstance.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(instanceTypeForInstance).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -515,13 +485,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
.addFormParam("Action", "ModifyInstanceAttribute")
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
.addFormParam("Attribute", "instanceInitiatedShutdownBehavior")
|
.addFormParam("Attribute", "instanceInitiatedShutdownBehavior")
|
||||||
.addFormParam("InstanceId", "1")
|
.addFormParam("InstanceId", "1")
|
||||||
.addFormParam("Signature", "HLu0ufuCEUPUrNzjMsmFvjqEFbdawad/7Hufdg9flbc=")
|
.addFormParam("Value", "terminate").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Value", "terminate")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
|
@ -533,8 +497,8 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, setInstanceInitiatedShutdownBehavior.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(setInstanceInitiatedShutdownBehavior).getPayload().getRawContent()
|
||||||
"application/x-www-form-urlencoded", false);
|
.toString(), "application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -543,6 +507,15 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setBlockDeviceMapping = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.VolumeId", "vol-test1")
|
||||||
|
.addFormParam("InstanceId", "1").build();
|
||||||
|
|
||||||
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
Invokable<?, ?> method = method(AWSInstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
||||||
|
@ -552,13 +525,11 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||||
|
|
||||||
filter.filter(request);
|
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, filter.filter(setBlockDeviceMapping).getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&BlockDeviceMapping.1.DeviceName=/dev/sda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&InstanceId=1&Signature=qqJpPk8UmhPY9Jica0JSADEZiY3eHf9WETm%2B5tLT0NE%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2011-05-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -63,13 +63,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "ImportKeyPair")
|
.addFormParam("Action", "ImportKeyPair")
|
||||||
.addFormParam("KeyName", "mykey")
|
.addFormParam("KeyName", "mykey")
|
||||||
.addFormParam("PublicKeyMaterial", "c3NoLXJzYSBBQQ%3D%3D")
|
.addFormParam("PublicKeyMaterial", "c3NoLXJzYSBBQQ%3D%3D").build();
|
||||||
.addFormParam("Signature", "hI3Y8ggtVzXrEMmHp4Kem2/HCAX9hYN2NKjhDBz9SkY=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testImportKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
public void testImportKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSKeyPairAsyncClient.class, "importKeyPairInRegion", String.class, String.class,
|
Invokable<?, ?> method = method(AWSKeyPairAsyncClient.class, "importKeyPairInRegion", String.class, String.class,
|
||||||
|
@ -80,7 +74,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, importKeyPair.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(importKeyPair).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -106,13 +106,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "CreateSecurityGroup")
|
.addFormParam("Action", "CreateSecurityGroup")
|
||||||
.addFormParam("GroupDescription", "description")
|
.addFormParam("GroupDescription", "description")
|
||||||
.addFormParam("GroupName", "name")
|
.addFormParam("GroupName", "name").build();
|
||||||
.addFormParam("Signature", "4uhrFtF0ppjWPJU6MUto3iQ8z3e5WKMUuPCE294hrg4=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AWSSecurityGroupAsyncClient.class, "createSecurityGroupInRegion", String.class,
|
Invokable<?, ?> method = method(AWSSecurityGroupAsyncClient.class, "createSecurityGroupInRegion", String.class,
|
||||||
|
@ -123,7 +117,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, createSecurityGroup.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(createSecurityGroup).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -64,13 +64,7 @@ public class PlacementGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<Pla
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "CreatePlacementGroup")
|
.addFormParam("Action", "CreatePlacementGroup")
|
||||||
.addFormParam("GroupName", "name")
|
.addFormParam("GroupName", "name")
|
||||||
.addFormParam("Signature", "V3o3tjvFQfI1zdP4iZJLnlusP3dSpPFx7bJVJlJbs2w=")
|
.addFormParam("Strategy", "cluster").build();
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("Strategy", "cluster")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testCreatePlacementGroup() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreatePlacementGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PlacementGroupAsyncClient.class, "createPlacementGroupInRegion", String.class,
|
Invokable<?, ?> method = method(PlacementGroupAsyncClient.class, "createPlacementGroupInRegion", String.class,
|
||||||
|
@ -81,7 +75,7 @@ public class PlacementGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<Pla
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, createPlacementGroup.getPayload().getRawContent().toString(),
|
assertPayloadEquals(request, filter.filter(createPlacementGroup).getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -25,19 +25,13 @@ import java.util.Date;
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||||
import org.jclouds.aws.ec2.domain.LaunchSpecification;
|
|
||||||
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
||||||
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
|
||||||
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
||||||
import org.jclouds.aws.ec2.xml.SpotInstanceHandler;
|
|
||||||
import org.jclouds.aws.ec2.xml.SpotInstancesHandler;
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
/**
|
/**
|
||||||
|
@ -49,83 +43,6 @@ import com.google.common.reflect.Invokable;
|
||||||
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
||||||
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
||||||
|
|
||||||
HttpRequest requestSpotInstances = HttpRequest.builder().method("POST")
|
|
||||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
|
||||||
.addFormParam("Action", "RequestSpotInstances")
|
|
||||||
.addFormParam("LaunchSpecification.ImageId", "m1.small")
|
|
||||||
.addFormParam("LaunchSpecification.InstanceType", "ami-voo")
|
|
||||||
.addFormParam("Signature", "5PZRT8xXMugx1ku/NxQpaGWqYLLbKwJksBbeldGLO2s=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("SpotPrice", "0.01")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRequestSpotInstance() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "requestSpotInstanceInRegion", String.class,
|
|
||||||
float.class, String.class, String.class);
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, 0.01f, "m1.small", "ami-voo"));
|
|
||||||
|
|
||||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request, requestSpotInstances.getPayload().getRawContent().toString(),
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstanceHandler.class);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpRequest requestSpotInstancesOptions = HttpRequest.builder().method("POST")
|
|
||||||
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
|
||||||
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
|
||||||
.addFormParam("Action", "RequestSpotInstances")
|
|
||||||
.addFormParam("AvailabilityZoneGroup", "availabilityZoneGroup")
|
|
||||||
.addFormParam("InstanceCount", "3")
|
|
||||||
.addFormParam("LaunchGroup", "launchGroup")
|
|
||||||
.addFormParam("LaunchSpecification.ImageId", "ami-voo")
|
|
||||||
.addFormParam("LaunchSpecification.InstanceType", "m1.small")
|
|
||||||
.addFormParam("LaunchSpecification.KernelId", "kernelId")
|
|
||||||
.addFormParam("LaunchSpecification.Placement.AvailabilityZone", "eu-west-1a")
|
|
||||||
.addFormParam("LaunchSpecification.SecurityGroup.1", "group1")
|
|
||||||
.addFormParam("Signature", "94pCsdmfYVMbMzofCeTvfvpQozIY6iDu0LewXvHl1ao=")
|
|
||||||
.addFormParam("SignatureMethod", "HmacSHA256")
|
|
||||||
.addFormParam("SignatureVersion", "2")
|
|
||||||
.addFormParam("SpotPrice", "0.01")
|
|
||||||
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
|
||||||
.addFormParam("ValidFrom", "1970-05-23T21%3A21%3A18Z")
|
|
||||||
.addFormParam("ValidUntil", "2009-02-13T23%3A31%3A31Z")
|
|
||||||
.addFormParam("Version", "2011-05-15")
|
|
||||||
.addFormParam("AWSAccessKeyId", "identity").build();
|
|
||||||
|
|
||||||
public void testRequestSpotInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "requestSpotInstancesInRegion", String.class,
|
|
||||||
float.class, int.class, LaunchSpecification.class, RequestSpotInstancesOptions[].class);
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("eu-west-1", 0.01, 3,
|
|
||||||
LaunchSpecification.builder().instanceType("m1.small").imageId("ami-voo").availabilityZone("eu-west-1a")
|
|
||||||
.kernelId("kernelId").securityGroupName("group1").build(), new RequestSpotInstancesOptions().validFrom(from)
|
|
||||||
.validUntil(to).availabilityZoneGroup("availabilityZoneGroup").launchGroup("launchGroup")));
|
|
||||||
|
|
||||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request, requestSpotInstancesOptions.getPayload().getRawContent().toString(),
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testCancelSpotInstanceRequests() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCancelSpotInstanceRequests() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "cancelSpotInstanceRequestsInRegion", String.class,
|
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "cancelSpotInstanceRequestsInRegion", String.class,
|
||||||
String[].class);
|
String[].class);
|
||||||
|
@ -143,42 +60,6 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDescribeSpotInstanceRequests() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "describeSpotInstanceRequestsInRegion", String.class,
|
|
||||||
String[].class);
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request, "Action=DescribeSpotInstanceRequests",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
|
||||||
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDescribeSpotInstanceRequestsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "describeSpotInstanceRequestsInRegion", String.class,
|
|
||||||
String[].class);
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=DescribeSpotInstanceRequests&SpotInstanceRequestId.1=1&SpotInstanceRequestId.2=2",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
|
||||||
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDescribeSpotPriceHistory() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeSpotPriceHistory() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "describeSpotPriceHistoryInRegion", String.class,
|
Invokable<?, ?> method = method(SpotInstanceAsyncClient.class, "describeSpotPriceHistoryInRegion", String.class,
|
||||||
DescribeSpotPriceHistoryOptions[].class);
|
DescribeSpotPriceHistoryOptions[].class);
|
||||||
|
|
Loading…
Reference in New Issue