mirror of https://github.com/apache/jclouds.git
regression in last commit; guice child injector locks up under threading; also added new ec2 instance size
This commit is contained in:
parent
891484a2aa
commit
4098c4bd0a
|
@ -34,7 +34,7 @@ import org.jclouds.rest.annotations.Delegate;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public interface EC2AsyncClient {
|
public interface EC2AsyncClient {
|
||||||
public final static String VERSION = "2009-11-30";
|
public final static String VERSION = "2010-06-15";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides asynchronous access to AMI services.
|
* Provides asynchronous access to AMI services.
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.jclouds.aws.ec2;
|
||||||
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
import static org.jclouds.Constants.PROPERTY_API_VERSION;
|
||||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||||
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
||||||
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_CC_AMIs;
|
||||||
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_ELB_ENDPOINT;
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_ELB_ENDPOINT;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
|
||||||
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
||||||
|
@ -46,6 +47,8 @@ public class EC2PropertiesBuilder extends PropertiesBuilder {
|
||||||
"https://elasticloadbalancing.us-east-1.amazonaws.com");
|
"https://elasticloadbalancing.us-east-1.amazonaws.com");
|
||||||
// alestic, canonical, and rightscale
|
// alestic, canonical, and rightscale
|
||||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "063491364108,099720109477,411009282317");
|
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "063491364108,099720109477,411009282317");
|
||||||
|
// amis that work with the cluster instances
|
||||||
|
properties.setProperty(PROPERTY_EC2_CC_AMIs, "us-east-1/ami-7ea24a17");
|
||||||
// auth fail sometimes happens in EC2, as the rc.local script that injects the
|
// auth fail sometimes happens in EC2, as the rc.local script that injects the
|
||||||
// authorized key executes after ssh has started
|
// authorized key executes after ssh has started
|
||||||
properties.setProperty("jclouds.ssh.max_retries", "6");
|
properties.setProperty("jclouds.ssh.max_retries", "6");
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.aws.ec2;
|
||||||
|
|
||||||
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
||||||
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
||||||
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_CC_AMIs;
|
||||||
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_PORT_OPEN;
|
import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_TIMEOUT_PORT_OPEN;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -39,6 +40,8 @@ public class EucalyptusPropertiesBuilder extends EC2PropertiesBuilder {
|
||||||
// properties.setProperty(PROPERTY_ELB_ENDPOINT,
|
// properties.setProperty(PROPERTY_ELB_ENDPOINT,
|
||||||
// "https://elasticloadbalancing.us-east-1.amazonaws.com");
|
// "https://elasticloadbalancing.us-east-1.amazonaws.com");
|
||||||
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin");
|
properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "admin");
|
||||||
|
// amis that work with the cluster instances
|
||||||
|
properties.setProperty(PROPERTY_EC2_CC_AMIs, "");
|
||||||
properties.setProperty(PROPERTY_TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + "");
|
properties.setProperty(PROPERTY_TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + "");
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.ec2.compute.config;
|
package org.jclouds.aws.ec2.compute.config;
|
||||||
|
|
||||||
|
import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.imageIds;
|
||||||
import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.ownedBy;
|
import static org.jclouds.aws.ec2.options.DescribeImagesOptions.Builder.ownedBy;
|
||||||
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
|
||||||
|
import static org.jclouds.aws.ec2.reference.EC2Constants.PROPERTY_EC2_CC_AMIs;
|
||||||
import static org.jclouds.aws.ec2.util.EC2Utils.getAllRunningInstancesInRegion;
|
import static org.jclouds.aws.ec2.util.EC2Utils.getAllRunningInstancesInRegion;
|
||||||
import static org.jclouds.aws.ec2.util.EC2Utils.parseHandle;
|
import static org.jclouds.aws.ec2.util.EC2Utils.parseHandle;
|
||||||
import static org.jclouds.compute.domain.OsFamily.CENTOS;
|
import static org.jclouds.compute.domain.OsFamily.CENTOS;
|
||||||
|
@ -62,6 +64,7 @@ import org.jclouds.aws.ec2.compute.strategy.EC2DestroyLoadBalancerStrategy;
|
||||||
import org.jclouds.aws.ec2.compute.strategy.EC2DestroyNodeStrategy;
|
import org.jclouds.aws.ec2.compute.strategy.EC2DestroyNodeStrategy;
|
||||||
import org.jclouds.aws.ec2.compute.strategy.EC2LoadBalanceNodesStrategy;
|
import org.jclouds.aws.ec2.compute.strategy.EC2LoadBalanceNodesStrategy;
|
||||||
import org.jclouds.aws.ec2.compute.strategy.EC2RunNodesAndAddToSetStrategy;
|
import org.jclouds.aws.ec2.compute.strategy.EC2RunNodesAndAddToSetStrategy;
|
||||||
|
import org.jclouds.aws.ec2.domain.InstanceType;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.aws.ec2.domain.RunningInstance;
|
import org.jclouds.aws.ec2.domain.RunningInstance;
|
||||||
import org.jclouds.aws.ec2.domain.Image.ImageType;
|
import org.jclouds.aws.ec2.domain.Image.ImageType;
|
||||||
|
@ -116,7 +119,8 @@ import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.name.Names;
|
import com.google.inject.name.Names;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the {@link ComputeServiceContext}; requires {@link EC2ComputeService} bound.
|
* Configures the {@link ComputeServiceContext}; requires
|
||||||
|
* {@link EC2ComputeService} bound.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -126,32 +130,39 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
@Singleton
|
@Singleton
|
||||||
@Named("PRESENT")
|
@Named("PRESENT")
|
||||||
protected Predicate<RunningInstance> instancePresent(InstancePresent present) {
|
protected Predicate<RunningInstance> instancePresent(InstancePresent present) {
|
||||||
return new RetryablePredicate<RunningInstance>(present, 3000, 200, TimeUnit.MILLISECONDS);
|
return new RetryablePredicate<RunningInstance>(present, 3000, 200,
|
||||||
|
TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
install(new ComputeServiceTimeoutsModule());
|
install(new ComputeServiceTimeoutsModule());
|
||||||
bind(Location.class).toProvider(DefaultLocationProvider.class).in(Scopes.SINGLETON);
|
bind(Location.class).toProvider(DefaultLocationProvider.class).in(
|
||||||
|
Scopes.SINGLETON);
|
||||||
bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
|
bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
|
||||||
bind(TemplateOptions.class).to(EC2TemplateOptions.class);
|
bind(TemplateOptions.class).to(EC2TemplateOptions.class);
|
||||||
bind(ComputeService.class).to(EC2ComputeService.class);
|
bind(ComputeService.class).to(EC2ComputeService.class);
|
||||||
bind(new TypeLiteral<ComputeServiceContext>() {
|
bind(new TypeLiteral<ComputeServiceContext>() {
|
||||||
}).to(new TypeLiteral<ComputeServiceContextImpl<EC2Client, EC2AsyncClient>>() {
|
})
|
||||||
|
.to(
|
||||||
|
new TypeLiteral<ComputeServiceContextImpl<EC2Client, EC2AsyncClient>>() {
|
||||||
}).in(Scopes.SINGLETON);
|
}).in(Scopes.SINGLETON);
|
||||||
bind(new TypeLiteral<RestContext<EC2Client, EC2AsyncClient>>() {
|
bind(new TypeLiteral<RestContext<EC2Client, EC2AsyncClient>>() {
|
||||||
}).to(new TypeLiteral<RestContextImpl<EC2Client, EC2AsyncClient>>() {
|
}).to(new TypeLiteral<RestContextImpl<EC2Client, EC2AsyncClient>>() {
|
||||||
}).in(Scopes.SINGLETON);
|
}).in(Scopes.SINGLETON);
|
||||||
bind(LoadBalanceNodesStrategy.class).to(EC2LoadBalanceNodesStrategy.class);
|
bind(LoadBalanceNodesStrategy.class)
|
||||||
bind(DestroyLoadBalancerStrategy.class).to(EC2DestroyLoadBalancerStrategy.class);
|
.to(EC2LoadBalanceNodesStrategy.class);
|
||||||
bind(RunNodesAndAddToSetStrategy.class).to(EC2RunNodesAndAddToSetStrategy.class);
|
bind(DestroyLoadBalancerStrategy.class).to(
|
||||||
|
EC2DestroyLoadBalancerStrategy.class);
|
||||||
|
bind(RunNodesAndAddToSetStrategy.class).to(
|
||||||
|
EC2RunNodesAndAddToSetStrategy.class);
|
||||||
bind(ListNodesStrategy.class).to(EC2ListNodesStrategy.class);
|
bind(ListNodesStrategy.class).to(EC2ListNodesStrategy.class);
|
||||||
bind(GetNodeMetadataStrategy.class).to(EC2GetNodeMetadataStrategy.class);
|
bind(GetNodeMetadataStrategy.class).to(EC2GetNodeMetadataStrategy.class);
|
||||||
bind(RebootNodeStrategy.class).to(EC2RebootNodeStrategy.class);
|
bind(RebootNodeStrategy.class).to(EC2RebootNodeStrategy.class);
|
||||||
bind(DestroyNodeStrategy.class).to(EC2DestroyNodeStrategy.class);
|
bind(DestroyNodeStrategy.class).to(EC2DestroyNodeStrategy.class);
|
||||||
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>() {
|
bind(new TypeLiteral<Function<RunningInstance, Map<String, String>>>() {
|
||||||
}).annotatedWith(Names.named("volumeMapping")).to(RunningInstanceToStorageMappingUnix.class)
|
}).annotatedWith(Names.named("volumeMapping")).to(
|
||||||
.in(Scopes.SINGLETON);
|
RunningInstanceToStorageMappingUnix.class).in(Scopes.SINGLETON);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -170,10 +181,12 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Named("DEFAULT")
|
@Named("DEFAULT")
|
||||||
protected TemplateBuilder provideTemplate(@Region String region, TemplateBuilder template) {
|
protected TemplateBuilder provideTemplate(@Region String region,
|
||||||
return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest() : template
|
TemplateBuilder template) {
|
||||||
.architecture(Architecture.X86_32).osFamily(UBUNTU).imageNameMatches(".*10\\.?04.*")
|
return "Eucalyptus".equals(region) ? template.osFamily(CENTOS).smallest()
|
||||||
.osDescriptionMatches("^ubuntu-images.*");
|
: template.architecture(Architecture.X86_32).osFamily(UBUNTU)
|
||||||
|
.imageNameMatches(".*10\\.?04.*").osDescriptionMatches(
|
||||||
|
"^ubuntu-images.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO make this more efficient for listNodes(); currently
|
// TODO make this more efficient for listNodes(); currently
|
||||||
|
@ -191,7 +204,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2ListNodesStrategy(EC2Client client, @Region Map<String, URI> regionMap,
|
protected EC2ListNodesStrategy(EC2Client client,
|
||||||
|
@Region Map<String, URI> regionMap,
|
||||||
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata,
|
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
@ -213,29 +227,31 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
Map<String, ListenableFuture<?>> parallelResponses = Maps.newHashMap();
|
Map<String, ListenableFuture<?>> parallelResponses = Maps.newHashMap();
|
||||||
|
|
||||||
for (final String region : regionMap.keySet()) {
|
for (final String region : regionMap.keySet()) {
|
||||||
parallelResponses.put(region, ConcurrentUtils.makeListenable(executor
|
parallelResponses.put(region, ConcurrentUtils.makeListenable(
|
||||||
.submit(new Callable<Void>() {
|
executor.submit(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
Iterables.addAll(nodes, Iterables.transform(Iterables.concat(client
|
Iterables.addAll(nodes, Iterables.transform(Iterables
|
||||||
.getInstanceServices().describeInstancesInRegion(region)),
|
.concat(client.getInstanceServices()
|
||||||
|
.describeInstancesInRegion(region)),
|
||||||
runningInstanceToNodeMetadata));
|
runningInstanceToNodeMetadata));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}), executor));
|
}), executor));
|
||||||
}
|
}
|
||||||
Map<String, Exception> exceptions = awaitCompletion(parallelResponses, executor, null,
|
Map<String, Exception> exceptions = awaitCompletion(parallelResponses,
|
||||||
logger, "nodes");
|
executor, null, logger, "nodes");
|
||||||
|
|
||||||
if (exceptions.size() > 0)
|
if (exceptions.size() > 0)
|
||||||
throw new RuntimeException(String.format("error parsing nodes in regions: %s",
|
throw new RuntimeException(String.format(
|
||||||
exceptions));
|
"error parsing nodes in regions: %s", exceptions));
|
||||||
return Iterables.filter(nodes, filter);
|
return Iterables.filter(nodes, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public static class EC2GetNodeMetadataStrategy implements GetNodeMetadataStrategy {
|
public static class EC2GetNodeMetadataStrategy implements
|
||||||
|
GetNodeMetadataStrategy {
|
||||||
|
|
||||||
private final EC2Client client;
|
private final EC2Client client;
|
||||||
private final RunningInstanceToNodeMetadata runningInstanceToNodeMetadata;
|
private final RunningInstanceToNodeMetadata runningInstanceToNodeMetadata;
|
||||||
|
@ -254,8 +270,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
String instanceId = parts[1];
|
String instanceId = parts[1];
|
||||||
try {
|
try {
|
||||||
RunningInstance runningInstance = Iterables
|
RunningInstance runningInstance = Iterables
|
||||||
.getOnlyElement(getAllRunningInstancesInRegion(client.getInstanceServices(),
|
.getOnlyElement(getAllRunningInstancesInRegion(client
|
||||||
region, instanceId));
|
.getInstanceServices(), region, instanceId));
|
||||||
return runningInstanceToNodeMetadata.apply(runningInstance);
|
return runningInstanceToNodeMetadata.apply(runningInstance);
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -270,7 +286,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
private final GetNodeMetadataStrategy getNode;
|
private final GetNodeMetadataStrategy getNode;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected EC2RebootNodeStrategy(EC2Client client, GetNodeMetadataStrategy getNode) {
|
protected EC2RebootNodeStrategy(EC2Client client,
|
||||||
|
GetNodeMetadataStrategy getNode) {
|
||||||
this.client = client.getInstanceServices();
|
this.client = client.getInstanceServices();
|
||||||
this.getNode = getNode;
|
this.getNode = getNode;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +305,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected final Map<RegionAndName, KeyPair> credentialsMap(CreateUniqueKeyPair in) {
|
protected final Map<RegionAndName, KeyPair> credentialsMap(
|
||||||
|
CreateUniqueKeyPair in) {
|
||||||
// doesn't seem to clear when someone issues remove(key)
|
// doesn't seem to clear when someone issues remove(key)
|
||||||
// return new MapMaker().makeComputingMap(in);
|
// return new MapMaker().makeComputingMap(in);
|
||||||
return Maps.newLinkedHashMap();
|
return Maps.newLinkedHashMap();
|
||||||
|
@ -296,7 +314,8 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected final Map<RegionAndName, String> securityGroupMap(CreateSecurityGroupIfNeeded in) {
|
protected final Map<RegionAndName, String> securityGroupMap(
|
||||||
|
CreateSecurityGroupIfNeeded in) {
|
||||||
// doesn't seem to clear when someone issues remove(key)
|
// doesn't seem to clear when someone issues remove(key)
|
||||||
// return new MapMaker().makeComputingMap(in);
|
// return new MapMaker().makeComputingMap(in);
|
||||||
return Maps.newLinkedHashMap();
|
return Maps.newLinkedHashMap();
|
||||||
|
@ -315,23 +334,45 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Set<? extends Size> provideSizes() {
|
Set<? extends Size> provideSizes(Set<? extends Location> locations,
|
||||||
return ImmutableSet.of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE,
|
@Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis) {
|
||||||
EC2Size.M1_SMALL, EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE,
|
Set<Size> sizes = Sets.newHashSet();
|
||||||
EC2Size.M2_4XLARGE);
|
for (String ccAmi : ccAmis) {
|
||||||
|
final String region = ccAmi.split("/")[0];
|
||||||
|
Location location = Iterables.find(locations,
|
||||||
|
new Predicate<Location>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Location input) {
|
||||||
|
return input.getScope() == LocationScope.REGION
|
||||||
|
&& input.getId().equals(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
sizes.add(new EC2Size(location, InstanceType.CC1_4XLARGE, 33.5,
|
||||||
|
23 * 1024, 1690, ccAmis));
|
||||||
|
}
|
||||||
|
sizes.addAll(ImmutableSet.<Size> of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE,
|
||||||
|
EC2Size.M1_LARGE, EC2Size.M1_SMALL, EC2Size.M1_XLARGE,
|
||||||
|
EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE, EC2Size.M2_4XLARGE));
|
||||||
|
return sizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
Set<? extends Location> provideLocations(Map<String, String> availabilityZoneToRegionMap,
|
Set<? extends Location> provideLocations(
|
||||||
|
Map<String, String> availabilityZoneToRegionMap,
|
||||||
@Provider String providerName) {
|
@Provider String providerName) {
|
||||||
Location ec2 = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
Location ec2 = new LocationImpl(LocationScope.PROVIDER, providerName,
|
||||||
|
providerName, null);
|
||||||
Set<Location> locations = Sets.newLinkedHashSet();
|
Set<Location> locations = Sets.newLinkedHashSet();
|
||||||
for (String zone : availabilityZoneToRegionMap.keySet()) {
|
for (String zone : availabilityZoneToRegionMap.keySet()) {
|
||||||
Location region = new LocationImpl(LocationScope.REGION, availabilityZoneToRegionMap
|
Location region = new LocationImpl(LocationScope.REGION,
|
||||||
.get(zone), availabilityZoneToRegionMap.get(zone), ec2);
|
availabilityZoneToRegionMap.get(zone),
|
||||||
|
availabilityZoneToRegionMap.get(zone), ec2);
|
||||||
locations.add(region);
|
locations.add(region);
|
||||||
locations.add(new LocationImpl(LocationScope.ZONE, zone, zone, region));
|
locations
|
||||||
|
.add(new LocationImpl(LocationScope.ZONE, zone, zone, region));
|
||||||
}
|
}
|
||||||
return locations;
|
return locations;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +393,17 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
protected Set<? extends Image> provideImages(Map<RegionAndName, ? extends Image> map) {
|
@Singleton
|
||||||
|
@Named(PROPERTY_EC2_CC_AMIs)
|
||||||
|
String[] ccAmis(@Named(PROPERTY_EC2_CC_AMIs) String ccAmis) {
|
||||||
|
if (ccAmis.trim().equals(""))
|
||||||
|
return new String[] {};
|
||||||
|
return Iterables.toArray(Splitter.on(',').split(ccAmis), String.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
protected Set<? extends Image> provideImages(
|
||||||
|
Map<RegionAndName, ? extends Image> map) {
|
||||||
return ImmutableSet.copyOf(map.values());
|
return ImmutableSet.copyOf(map.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,10 +416,12 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Map<RegionAndName, ? extends Image> provideImages(final EC2Client sync,
|
protected Map<RegionAndName, ? extends Image> provideImages(
|
||||||
@Region Map<String, URI> regionMap, final LogHolder holder,
|
final EC2Client sync, @Region Map<String, URI> regionMap,
|
||||||
Function<ComputeMetadata, String> indexer,
|
final LogHolder holder, Function<ComputeMetadata, String> indexer,
|
||||||
@Named(PROPERTY_EC2_AMI_OWNERS) final String[] amiOwners, final ImageParser parser,
|
@Named(PROPERTY_EC2_CC_AMIs) String[] ccAmis,
|
||||||
|
@Named(PROPERTY_EC2_AMI_OWNERS) final String[] amiOwners,
|
||||||
|
final ImageParser parser,
|
||||||
final ConcurrentMap<RegionAndName, Image> images,
|
final ConcurrentMap<RegionAndName, Image> images,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor)
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor)
|
||||||
throws InterruptedException, ExecutionException, TimeoutException {
|
throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
|
@ -384,30 +437,40 @@ public class EC2ComputeServiceContextModule extends AbstractModule {
|
||||||
else
|
else
|
||||||
options = ownedBy(amiOwners);
|
options = ownedBy(amiOwners);
|
||||||
for (final String region : regionMap.keySet()) {
|
for (final String region : regionMap.keySet()) {
|
||||||
parallelResponses.put(region, ConcurrentUtils.makeListenable(executor
|
parallelResponses.put(region, ConcurrentUtils.makeListenable(
|
||||||
.submit(new Callable<Void>() {
|
executor.submit(new Callable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
for (final org.jclouds.aws.ec2.domain.Image from : sync.getAMIServices()
|
for (final org.jclouds.aws.ec2.domain.Image from : sync
|
||||||
.describeImagesInRegion(region, options)) {
|
.getAMIServices().describeImagesInRegion(region,
|
||||||
|
options)) {
|
||||||
Image image = parser.apply(from);
|
Image image = parser.apply(from);
|
||||||
if (image != null)
|
if (image != null)
|
||||||
images
|
images.put(new RegionAndName(region, image
|
||||||
.put(new RegionAndName(region, image.getProviderId()),
|
.getProviderId()), image);
|
||||||
image);
|
|
||||||
else if (from.getImageType() == ImageType.MACHINE)
|
else if (from.getImageType() == ImageType.MACHINE)
|
||||||
holder.logger.trace("<< image(%s) didn't parse", from.getId());
|
holder.logger.trace("<< image(%s) didn't parse",
|
||||||
|
from.getId());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}), executor));
|
}), executor));
|
||||||
}
|
}
|
||||||
Map<String, Exception> exceptions = awaitCompletion(parallelResponses, executor, null,
|
Map<String, Exception> exceptions = awaitCompletion(parallelResponses,
|
||||||
holder.logger, "images");
|
executor, null, holder.logger, "images");
|
||||||
|
for (String ccAmi : ccAmis) {
|
||||||
|
String region = ccAmi.split("/")[0];
|
||||||
|
org.jclouds.aws.ec2.domain.Image from = Iterables
|
||||||
|
.getOnlyElement(sync.getAMIServices().describeImagesInRegion(
|
||||||
|
region, imageIds(ccAmi.split("/")[1])));
|
||||||
|
Image image = parser.apply(from);
|
||||||
|
if (image != null)
|
||||||
|
images.put(new RegionAndName(region, image.getProviderId()),
|
||||||
|
image);
|
||||||
|
}
|
||||||
if (exceptions.size() > 0)
|
if (exceptions.size() > 0)
|
||||||
throw new RuntimeException(String.format("error parsing images in regions: %s",
|
throw new RuntimeException(String.format(
|
||||||
exceptions));
|
"error parsing images in regions: %s", exceptions));
|
||||||
|
|
||||||
holder.logger.debug("<< images(%d)", images.size());
|
holder.logger.debug("<< images(%d)", images.size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,15 @@
|
||||||
package org.jclouds.aws.ec2.compute.domain;
|
package org.jclouds.aws.ec2.compute.domain;
|
||||||
|
|
||||||
import static org.jclouds.compute.predicates.ImagePredicates.architectureIn;
|
import static org.jclouds.compute.predicates.ImagePredicates.architectureIn;
|
||||||
|
import static org.jclouds.compute.predicates.ImagePredicates.idIn;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.domain.InstanceType;
|
import org.jclouds.aws.ec2.domain.InstanceType;
|
||||||
import org.jclouds.compute.domain.Architecture;
|
import org.jclouds.compute.domain.Architecture;
|
||||||
import org.jclouds.compute.domain.internal.SizeImpl;
|
import org.jclouds.compute.domain.internal.SizeImpl;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -39,13 +44,18 @@ public class EC2Size extends SizeImpl {
|
||||||
EC2Size(String instanceType, Double cores, Integer ram, Integer disk,
|
EC2Size(String instanceType, Double cores, Integer ram, Integer disk,
|
||||||
Iterable<Architecture> supportedArchitectures) {
|
Iterable<Architecture> supportedArchitectures) {
|
||||||
super(instanceType, instanceType, instanceType, null, null, ImmutableMap
|
super(instanceType, instanceType, instanceType, null, null, ImmutableMap
|
||||||
.<String, String> of(), cores, ram, disk, architectureIn(supportedArchitectures));
|
.<String, String> of(), cores, ram, disk,
|
||||||
|
architectureIn(supportedArchitectures));
|
||||||
this.instanceType = instanceType;
|
this.instanceType = instanceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
EC2Size(String instanceType, Integer cores, Integer ram, Integer disk,
|
public EC2Size(Location location, String instanceType, Double cores,
|
||||||
Iterable<Architecture> supportedArchitectures) {
|
Integer ram, Integer disk, String[] ids) {
|
||||||
this(instanceType, cores.doubleValue(), ram, disk, supportedArchitectures);
|
super(instanceType, instanceType, instanceType, location, null,
|
||||||
|
ImmutableMap.<String, String> of(), cores, ram, disk,
|
||||||
|
(ids.length == 0 ? architectureIn(Collections
|
||||||
|
.singleton(Architecture.X86_64)) : idIn(Arrays.asList(ids))));
|
||||||
|
this.instanceType = instanceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,49 +68,53 @@ public class EC2Size extends SizeImpl {
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M1_SMALL
|
* @see InstanceType#M1_SMALL
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M1_SMALL = new EC2Size(InstanceType.M1_SMALL, 1, 1740, 160,
|
public static final EC2Size M1_SMALL = new EC2Size(InstanceType.M1_SMALL,
|
||||||
ImmutableSet.of(Architecture.X86_32));
|
1.0, 1740, 160, ImmutableSet.of(Architecture.X86_32));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M1_LARGE
|
* @see InstanceType#M1_LARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M1_LARGE = new EC2Size(InstanceType.M1_LARGE, 4, 7680, 850,
|
public static final EC2Size M1_LARGE = new EC2Size(InstanceType.M1_LARGE,
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
4.0, 7680, 850, ImmutableSet.of(Architecture.X86_64));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M1_XLARGE
|
* @see InstanceType#M1_XLARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M1_XLARGE = new EC2Size(InstanceType.M1_XLARGE, 8, 15360, 1690,
|
public static final EC2Size M1_XLARGE = new EC2Size(InstanceType.M1_XLARGE,
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
8.0, 15360, 1690, ImmutableSet.of(Architecture.X86_64));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M2_XLARGE
|
* @see InstanceType#M2_XLARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M2_XLARGE = new EC2Size(InstanceType.M2_XLARGE, 6.5, 17510, 420,
|
public static final EC2Size M2_XLARGE = new EC2Size(InstanceType.M2_XLARGE,
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
6.5, 17510, 420, ImmutableSet.of(Architecture.X86_64));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M2_2XLARGE
|
* @see InstanceType#M2_2XLARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M2_2XLARGE = new EC2Size(InstanceType.M2_2XLARGE, 13, 35020, 850,
|
public static final EC2Size M2_2XLARGE = new EC2Size(
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
InstanceType.M2_2XLARGE, 13.0, 35020, 850, ImmutableSet
|
||||||
|
.of(Architecture.X86_64));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#M2_4XLARGE
|
* @see InstanceType#M2_4XLARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size M2_4XLARGE = new EC2Size(InstanceType.M2_4XLARGE, 26, 70041, 1690,
|
public static final EC2Size M2_4XLARGE = new EC2Size(
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
InstanceType.M2_4XLARGE, 26.0, 70041, 1690, ImmutableSet
|
||||||
|
.of(Architecture.X86_64));
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#C1_MEDIUM
|
* @see InstanceType#C1_MEDIUM
|
||||||
*/
|
*/
|
||||||
public static final EC2Size C1_MEDIUM = new EC2Size(InstanceType.C1_MEDIUM, 5, 1740, 350,
|
public static final EC2Size C1_MEDIUM = new EC2Size(InstanceType.C1_MEDIUM,
|
||||||
ImmutableSet.of(Architecture.X86_32));
|
5.0, 1740, 350, ImmutableSet.of(Architecture.X86_32));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InstanceType#C1_XLARGE
|
* @see InstanceType#C1_XLARGE
|
||||||
*/
|
*/
|
||||||
public static final EC2Size C1_XLARGE = new EC2Size(InstanceType.C1_XLARGE, 20, 7168, 1690,
|
public static final EC2Size C1_XLARGE = new EC2Size(InstanceType.C1_XLARGE,
|
||||||
ImmutableSet.of(Architecture.X86_64));
|
20.0, 7168, 1690, ImmutableSet.of(Architecture.X86_64));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + ((instanceType == null) ? 0 : instanceType.hashCode());
|
result = prime * result
|
||||||
|
+ ((instanceType == null) ? 0 : instanceType.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,14 +58,22 @@ public class Image implements Comparable<Image> {
|
||||||
private final RootDeviceType rootDeviceType;
|
private final RootDeviceType rootDeviceType;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final String rootDeviceName;
|
private final String rootDeviceName;
|
||||||
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
private final Map<String, EbsBlockDevice> ebsBlockDevices = Maps
|
||||||
|
.newHashMap();
|
||||||
|
private final String virtualizationType;
|
||||||
|
|
||||||
public Image(String region, Architecture architecture, @Nullable String name,
|
public String getVirtualizationType() {
|
||||||
@Nullable String description, String imageId, String imageLocation,
|
return virtualizationType;
|
||||||
String imageOwnerId, ImageState imageState, ImageType imageType, boolean isPublic,
|
}
|
||||||
Iterable<String> productCodes, @Nullable String kernelId, @Nullable String platform,
|
|
||||||
|
public Image(String region, Architecture architecture,
|
||||||
|
@Nullable String name, @Nullable String description, String imageId,
|
||||||
|
String imageLocation, String imageOwnerId, ImageState imageState,
|
||||||
|
ImageType imageType, boolean isPublic, Iterable<String> productCodes,
|
||||||
|
@Nullable String kernelId, @Nullable String platform,
|
||||||
@Nullable String ramdiskId, RootDeviceType rootDeviceType,
|
@Nullable String ramdiskId, RootDeviceType rootDeviceType,
|
||||||
@Nullable String rootDeviceName, Map<String, EbsBlockDevice> ebsBlockDevices) {
|
@Nullable String rootDeviceName,
|
||||||
|
Map<String, EbsBlockDevice> ebsBlockDevices, String virtualizationType) {
|
||||||
this.region = checkNotNull(region, "region");
|
this.region = checkNotNull(region, "region");
|
||||||
this.architecture = checkNotNull(architecture, "architecture");
|
this.architecture = checkNotNull(architecture, "architecture");
|
||||||
this.imageId = checkNotNull(imageId, "imageId");
|
this.imageId = checkNotNull(imageId, "imageId");
|
||||||
|
@ -79,10 +87,14 @@ public class Image implements Comparable<Image> {
|
||||||
this.isPublic = isPublic;
|
this.isPublic = isPublic;
|
||||||
this.kernelId = kernelId;
|
this.kernelId = kernelId;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
Iterables.addAll(this.productCodes, checkNotNull(productCodes, "productCodes"));
|
Iterables.addAll(this.productCodes, checkNotNull(productCodes,
|
||||||
|
"productCodes"));
|
||||||
this.ramdiskId = ramdiskId;
|
this.ramdiskId = ramdiskId;
|
||||||
this.rootDeviceType = checkNotNull(rootDeviceType, "rootDeviceType");
|
this.rootDeviceType = checkNotNull(rootDeviceType, "rootDeviceType");
|
||||||
this.ebsBlockDevices.putAll(checkNotNull(ebsBlockDevices, "ebsBlockDevices"));
|
this.ebsBlockDevices.putAll(checkNotNull(ebsBlockDevices,
|
||||||
|
"ebsBlockDevices"));
|
||||||
|
this.virtualizationType = checkNotNull(virtualizationType,
|
||||||
|
"virtualizationType");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
|
@ -160,7 +172,8 @@ public class Image implements Comparable<Image> {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + (deleteOnTermination ? 1231 : 1237);
|
result = prime * result + (deleteOnTermination ? 1231 : 1237);
|
||||||
result = prime * result + ((snapshotId == null) ? 0 : snapshotId.hashCode());
|
result = prime * result
|
||||||
|
+ ((snapshotId == null) ? 0 : snapshotId.hashCode());
|
||||||
result = prime * result + (int) (volumeSize ^ (volumeSize >>> 32));
|
result = prime * result + (int) (volumeSize ^ (volumeSize >>> 32));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -188,8 +201,9 @@ public class Image implements Comparable<Image> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EbsBlockDevice [deleteOnTermination=" + deleteOnTermination + ", snapshotId="
|
return "EbsBlockDevice [deleteOnTermination=" + deleteOnTermination
|
||||||
+ snapshotId + ", volumeSize=" + volumeSize + "]";
|
+ ", snapshotId=" + snapshotId + ", volumeSize=" + volumeSize
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -231,9 +245,10 @@ public class Image implements Comparable<Image> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current state of the AMI. If the operation returns available, the image is successfully
|
* Current state of the AMI. If the operation returns available, the image is
|
||||||
* registered and avail able for launching. If the operation returns deregistered, the image is
|
* successfully registered and avail able for launching. If the operation
|
||||||
* deregistered and no longer available for launching.
|
* returns deregistered, the image is deregistered and no longer available
|
||||||
|
* for launching.
|
||||||
*/
|
*/
|
||||||
public ImageState getImageState() {
|
public ImageState getImageState() {
|
||||||
return imageState;
|
return imageState;
|
||||||
|
@ -247,15 +262,16 @@ public class Image implements Comparable<Image> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this image has public launch permissions. Returns false if it only has
|
* Returns true if this image has public launch permissions. Returns false if
|
||||||
* implicit and explicit launch permissions.
|
* it only has implicit and explicit launch permissions.
|
||||||
*/
|
*/
|
||||||
public boolean isPublic() {
|
public boolean isPublic() {
|
||||||
return isPublic;
|
return isPublic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The kernel associated with the image, if any. Only applicable for machine images.
|
* The kernel associated with the image, if any. Only applicable for machine
|
||||||
|
* images.
|
||||||
*/
|
*/
|
||||||
public String getKernelId() {
|
public String getKernelId() {
|
||||||
return kernelId;
|
return kernelId;
|
||||||
|
@ -276,7 +292,8 @@ public class Image implements Comparable<Image> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The RAM disk associated with the image, if any. Only applicable for machine images.
|
* The RAM disk associated with the image, if any. Only applicable for
|
||||||
|
* machine images.
|
||||||
*/
|
*/
|
||||||
public String getRamdiskId() {
|
public String getRamdiskId() {
|
||||||
return ramdiskId;
|
return ramdiskId;
|
||||||
|
@ -291,8 +308,8 @@ public class Image implements Comparable<Image> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return The root device type used by the AMI. The AMI can use an Amazon EBS or instance store
|
* @return The root device type used by the AMI. The AMI can use an Amazon
|
||||||
* root device.
|
* EBS or instance store root device.
|
||||||
*/
|
*/
|
||||||
public RootDeviceType getRootDeviceType() {
|
public RootDeviceType getRootDeviceType() {
|
||||||
return rootDeviceType;
|
return rootDeviceType;
|
||||||
|
@ -318,23 +335,37 @@ public class Image implements Comparable<Image> {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((architecture == null) ? 0 : architecture.hashCode());
|
result = prime * result
|
||||||
result = prime * result + ((description == null) ? 0 : description.hashCode());
|
+ ((architecture == null) ? 0 : architecture.hashCode());
|
||||||
result = prime * result + ((ebsBlockDevices == null) ? 0 : ebsBlockDevices.hashCode());
|
result = prime * result
|
||||||
|
+ ((description == null) ? 0 : description.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((ebsBlockDevices == null) ? 0 : ebsBlockDevices.hashCode());
|
||||||
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
|
result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
|
||||||
result = prime * result + ((imageLocation == null) ? 0 : imageLocation.hashCode());
|
result = prime * result
|
||||||
result = prime * result + ((imageOwnerId == null) ? 0 : imageOwnerId.hashCode());
|
+ ((imageLocation == null) ? 0 : imageLocation.hashCode());
|
||||||
result = prime * result + ((imageState == null) ? 0 : imageState.hashCode());
|
result = prime * result
|
||||||
result = prime * result + ((imageType == null) ? 0 : imageType.hashCode());
|
+ ((imageOwnerId == null) ? 0 : imageOwnerId.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((imageState == null) ? 0 : imageState.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((imageType == null) ? 0 : imageType.hashCode());
|
||||||
result = prime * result + (isPublic ? 1231 : 1237);
|
result = prime * result + (isPublic ? 1231 : 1237);
|
||||||
result = prime * result + ((kernelId == null) ? 0 : kernelId.hashCode());
|
result = prime * result + ((kernelId == null) ? 0 : kernelId.hashCode());
|
||||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||||
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
|
result = prime * result + ((platform == null) ? 0 : platform.hashCode());
|
||||||
result = prime * result + ((productCodes == null) ? 0 : productCodes.hashCode());
|
result = prime * result
|
||||||
result = prime * result + ((ramdiskId == null) ? 0 : ramdiskId.hashCode());
|
+ ((productCodes == null) ? 0 : productCodes.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((ramdiskId == null) ? 0 : ramdiskId.hashCode());
|
||||||
result = prime * result + ((region == null) ? 0 : region.hashCode());
|
result = prime * result + ((region == null) ? 0 : region.hashCode());
|
||||||
result = prime * result + ((rootDeviceName == null) ? 0 : rootDeviceName.hashCode());
|
result = prime * result
|
||||||
result = prime * result + ((rootDeviceType == null) ? 0 : rootDeviceType.hashCode());
|
+ ((rootDeviceName == null) ? 0 : rootDeviceName.hashCode());
|
||||||
|
result = prime * result
|
||||||
|
+ ((rootDeviceType == null) ? 0 : rootDeviceType.hashCode());
|
||||||
|
result = prime
|
||||||
|
* result
|
||||||
|
+ ((virtualizationType == null) ? 0 : virtualizationType.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,19 +460,26 @@ public class Image implements Comparable<Image> {
|
||||||
return false;
|
return false;
|
||||||
} else if (!rootDeviceType.equals(other.rootDeviceType))
|
} else if (!rootDeviceType.equals(other.rootDeviceType))
|
||||||
return false;
|
return false;
|
||||||
|
if (virtualizationType == null) {
|
||||||
|
if (other.virtualizationType != null)
|
||||||
|
return false;
|
||||||
|
} else if (!virtualizationType.equals(other.virtualizationType))
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Image [architecture=" + architecture + ", description=" + description
|
return "Image [architecture=" + architecture + ", description="
|
||||||
+ ", ebsBlockDevices=" + ebsBlockDevices + ", imageId=" + imageId
|
+ description + ", ebsBlockDevices=" + ebsBlockDevices
|
||||||
+ ", imageLocation=" + imageLocation + ", imageOwnerId=" + imageOwnerId
|
+ ", imageId=" + imageId + ", imageLocation=" + imageLocation
|
||||||
+ ", imageState=" + imageState + ", imageType=" + imageType + ", isPublic="
|
+ ", imageOwnerId=" + imageOwnerId + ", imageState=" + imageState
|
||||||
+ isPublic + ", kernelId=" + kernelId + ", name=" + name + ", platform=" + platform
|
+ ", imageType=" + imageType + ", isPublic=" + isPublic
|
||||||
+ ", productCodes=" + productCodes + ", ramdiskId=" + ramdiskId + ", region="
|
+ ", kernelId=" + kernelId + ", name=" + name + ", platform="
|
||||||
+ region + ", rootDeviceName=" + rootDeviceName + ", rootDeviceType="
|
+ platform + ", productCodes=" + productCodes + ", ramdiskId="
|
||||||
+ rootDeviceType + "]";
|
+ ramdiskId + ", region=" + region + ", rootDeviceName="
|
||||||
|
+ rootDeviceName + ", rootDeviceType=" + rootDeviceType
|
||||||
|
+ ", virtualizationType=" + virtualizationType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.ec2.domain;
|
package org.jclouds.aws.ec2.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.EC2AsyncClient;
|
import org.jclouds.aws.ec2.EC2AsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +68,8 @@ public class InstanceType {
|
||||||
* High-Memory Extra Large Instance
|
* High-Memory Extra Large Instance
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>17.1 GB of memory</li>
|
* <li>17.1 GB of memory</li>
|
||||||
* <li>6.5 EC2 Compute Units (2 virtual cores with 3.25 EC2 Compute Units each)</li>
|
* <li>6.5 EC2 Compute Units (2 virtual cores with 3.25 EC2 Compute Units
|
||||||
|
* each)</li>
|
||||||
* <li>420 GB of instance storage</li>
|
* <li>420 GB of instance storage</li>
|
||||||
* <li>64-bit platform</li>
|
* <li>64-bit platform</li>
|
||||||
* <li>I/O Performance: Moderate</li>
|
* <li>I/O Performance: Moderate</li>
|
||||||
|
@ -81,7 +80,8 @@ public class InstanceType {
|
||||||
* High-Memory Double Extra Large Instance
|
* High-Memory Double Extra Large Instance
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>34.2 GB of memory</li>
|
* <li>34.2 GB of memory</li>
|
||||||
* <li>13 EC2 Compute Units (4 virtual cores with 3.25 EC2 Compute Units each)</li>
|
* <li>13 EC2 Compute Units (4 virtual cores with 3.25 EC2 Compute Units
|
||||||
|
* each)</li>
|
||||||
* <li>850 GB of instance storage</li>
|
* <li>850 GB of instance storage</li>
|
||||||
* <li>64-bit platform</li>
|
* <li>64-bit platform</li>
|
||||||
* <li>I/O Performance: High</li>
|
* <li>I/O Performance: High</li>
|
||||||
|
@ -92,7 +92,8 @@ public class InstanceType {
|
||||||
* High-Memory Quadruple Extra Large Instance
|
* High-Memory Quadruple Extra Large Instance
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>68.4 GB of memory</li>
|
* <li>68.4 GB of memory</li>
|
||||||
* <li>26 EC2 Compute Units (8 virtual cores with 3.25 EC2 Compute Units each)</li>
|
* <li>26 EC2 Compute Units (8 virtual cores with 3.25 EC2 Compute Units
|
||||||
|
* each)</li>
|
||||||
* <li>1690 GB of instance storage</li>
|
* <li>1690 GB of instance storage</li>
|
||||||
* <li>64-bit platform</li>
|
* <li>64-bit platform</li>
|
||||||
* <li>I/O Performance: High</li>
|
* <li>I/O Performance: High</li>
|
||||||
|
@ -114,7 +115,8 @@ public class InstanceType {
|
||||||
* High-CPU Extra Large Instance
|
* High-CPU Extra Large Instance
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>7 GB of memory</li>
|
* <li>7 GB of memory</li>
|
||||||
* <li>20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each)</li>
|
* <li>20 EC2 Compute Units (8 virtual cores with 2.5 EC2 Compute Units each)
|
||||||
|
* </li>
|
||||||
* <li>1690 GB of instance storage</li>
|
* <li>1690 GB of instance storage</li>
|
||||||
* <li>64-bit platform</li>
|
* <li>64-bit platform</li>
|
||||||
* <li>I/O Performance: High</li>
|
* <li>I/O Performance: High</li>
|
||||||
|
@ -122,12 +124,18 @@ public class InstanceType {
|
||||||
*/
|
*/
|
||||||
public static final String C1_XLARGE = "c1.xlarge";
|
public static final String C1_XLARGE = "c1.xlarge";
|
||||||
|
|
||||||
public static String fromValue(String type) {
|
/**
|
||||||
return checkNotNull(type, "type").replaceAll("\\.", "_").toUpperCase();
|
* Cluster Compute Instance
|
||||||
}
|
* <ul>
|
||||||
|
* <li>23 GB of memory</li>
|
||||||
public static String toDotSeparatorLowercaseNotation(String type) {
|
* <li>33.5 EC2 Compute Units (2 x Intel Xeon X5570, quad-core "Nehalem"
|
||||||
return checkNotNull(type, "type").replaceAll("_", "\\.").toLowerCase();
|
* architecture)</li>
|
||||||
}
|
* <li>1690 GB of 64-bit storage (2 x 840 GB, plus 10 GB root partition)</li>
|
||||||
|
* <li>10 Gbps Ethernet</li>
|
||||||
|
* <li>64-bit platform</li>
|
||||||
|
* <li>I/O Performance: High</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public static final String CC1_4XLARGE = "cc1.4xlarge";
|
||||||
|
|
||||||
}
|
}
|
|
@ -208,7 +208,7 @@ public class RunningInstance implements Comparable<RunningInstance> {
|
||||||
* more information, go to the Metadata section of the Amazon Elastic Compute Cloud Developer
|
* more information, go to the Metadata section of the Amazon Elastic Compute Cloud Developer
|
||||||
* Guide.
|
* Guide.
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2009-11-30/DeveloperGuide/" />
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2010-06-15/DeveloperGuide/" />
|
||||||
*/
|
*/
|
||||||
public String getAmiLaunchIndex() {
|
public String getAmiLaunchIndex() {
|
||||||
return amiLaunchIndex;
|
return amiLaunchIndex;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import static org.jclouds.compute.reference.ComputeServiceConstants.LOCAL_PARTIT
|
||||||
* describe what partitions are formatted initially. To format/mount an available device, refer to
|
* describe what partitions are formatted initially. To format/mount an available device, refer to
|
||||||
* <a href="http://meinit.nl/howto-use-amazon-elastic-compute-cloud-ec2">this article</a>.
|
* <a href="http://meinit.nl/howto-use-amazon-elastic-compute-cloud-ec2">this article</a>.
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2009-11-30/UserGuide/index.html?instance-storage-concepts.html" />
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2010-06-15/UserGuide/index.html?instance-storage-concepts.html" />
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html" />
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html" />
|
||||||
*
|
*
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
|
@ -76,7 +76,7 @@ public class RunningInstanceToStorageMappingUnix implements Function<RunningInst
|
||||||
* @param instanceType for which the root partition size is to be determined
|
* @param instanceType for which the root partition size is to be determined
|
||||||
* @return size in GB
|
* @return size in GB
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2009-11-30/UserGuide/index.html?instance-storage-concepts.html" />
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/2010-06-15/UserGuide/index.html?instance-storage-concepts.html" />
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html" />
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instance-types.html" />
|
||||||
*/
|
*/
|
||||||
public int getRootPartitionSizeForInstanceType(String instanceType) {
|
public int getRootPartitionSizeForInstanceType(String instanceType) {
|
||||||
|
|
|
@ -33,4 +33,11 @@ public interface EC2Constants{
|
||||||
public static final String PROPERTY_EC2_AMI_OWNERS = "jclouds.ec2.ami-owners";
|
public static final String PROPERTY_EC2_AMI_OWNERS = "jclouds.ec2.ami-owners";
|
||||||
public static final String PROPERTY_ELB_ENDPOINT = "jclouds.elb.endpoint";
|
public static final String PROPERTY_ELB_ENDPOINT = "jclouds.elb.endpoint";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* amis that work on the cluster instance type
|
||||||
|
*
|
||||||
|
* @see InstanceType.CC1_4XLARGE
|
||||||
|
*/
|
||||||
|
public static final String PROPERTY_EC2_CC_AMIs = "jclouds.ec2.cc-amis";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import com.google.common.collect.Sets;
|
||||||
/**
|
/**
|
||||||
* Parses the following XML document:
|
* Parses the following XML document:
|
||||||
* <p/>
|
* <p/>
|
||||||
* DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"
|
* DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeImages.html"
|
||||||
|
@ -83,6 +83,8 @@ public class DescribeImagesResponseHandler extends
|
||||||
private Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
private Map<String, EbsBlockDevice> ebsBlockDevices = Maps.newHashMap();
|
||||||
private String deviceName;
|
private String deviceName;
|
||||||
private String snapshotId;
|
private String snapshotId;
|
||||||
|
private String virtualizationType = "paravirtual";
|
||||||
|
|
||||||
private int volumeSize;
|
private int volumeSize;
|
||||||
private boolean deleteOnTermination = true;// correct default is true.
|
private boolean deleteOnTermination = true;// correct default is true.
|
||||||
|
|
||||||
|
@ -143,6 +145,8 @@ public class DescribeImagesResponseHandler extends
|
||||||
rootDeviceType = RootDeviceType.fromValue(currentText.toString().trim());
|
rootDeviceType = RootDeviceType.fromValue(currentText.toString().trim());
|
||||||
} else if (qName.equals("rootDeviceName")) {
|
} else if (qName.equals("rootDeviceName")) {
|
||||||
rootDeviceName = currentText.toString().trim();
|
rootDeviceName = currentText.toString().trim();
|
||||||
|
} else if (qName.equals("virtualizationType")) {
|
||||||
|
virtualizationType = currentText.toString().trim();
|
||||||
} else if (qName.equals("item")) {
|
} else if (qName.equals("item")) {
|
||||||
if (inBlockDeviceMapping) {
|
if (inBlockDeviceMapping) {
|
||||||
ebsBlockDevices.put(deviceName, new Image.EbsBlockDevice(snapshotId, volumeSize,
|
ebsBlockDevices.put(deviceName, new Image.EbsBlockDevice(snapshotId, volumeSize,
|
||||||
|
@ -159,7 +163,7 @@ public class DescribeImagesResponseHandler extends
|
||||||
contents.add(new Image(region, architecture, this.name, description, imageId,
|
contents.add(new Image(region, architecture, this.name, description, imageId,
|
||||||
imageLocation, imageOwnerId, imageState, imageType, isPublic, productCodes,
|
imageLocation, imageOwnerId, imageState, imageType, isPublic, productCodes,
|
||||||
kernelId, platform, ramdiskId, rootDeviceType, rootDeviceName,
|
kernelId, platform, ramdiskId, rootDeviceType, rootDeviceName,
|
||||||
ebsBlockDevices));
|
ebsBlockDevices, virtualizationType));
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
logger.warn(e, "malformed image: %s", imageId);
|
logger.warn(e, "malformed image: %s", imageId);
|
||||||
}
|
}
|
||||||
|
@ -179,6 +183,7 @@ public class DescribeImagesResponseHandler extends
|
||||||
this.rootDeviceType = null;
|
this.rootDeviceType = null;
|
||||||
this.rootDeviceName = null;
|
this.rootDeviceName = null;
|
||||||
this.ebsBlockDevices = Maps.newHashMap();
|
this.ebsBlockDevices = Maps.newHashMap();
|
||||||
|
this.virtualizationType = "paravirtual";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses: DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"
|
* Parses: DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeKeyPairs.html"
|
||||||
* />
|
* />
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.xml.sax.Attributes;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses: DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"
|
* Parses: DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
*
|
*
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeSecurityGroups.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?ApiReference-query-DescribeSecurityGroups.html"
|
||||||
* />
|
* />
|
||||||
|
|
|
@ -35,9 +35,9 @@ import com.google.common.collect.Sets;
|
||||||
/**
|
/**
|
||||||
* Parses the following XML document:
|
* Parses the following XML document:
|
||||||
* <p/>
|
* <p/>
|
||||||
* TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"
|
* TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
* StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/" StopInstancesResponse
|
* StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2010-06-15/" StopInstancesResponse
|
||||||
* xmlns="http://ec2.amazonaws.com/doc/2009-11-30/"
|
* xmlns="http://ec2.amazonaws.com/doc/2010-06-15/"
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-TerminateInstancesResponseInfoType.html"
|
* @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemType-TerminateInstancesResponseInfoType.html"
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.EC2Client;
|
import org.jclouds.aws.ec2.EC2Client;
|
||||||
import org.jclouds.aws.ec2.compute.options.EC2TemplateOptions;
|
import org.jclouds.aws.ec2.compute.options.EC2TemplateOptions;
|
||||||
|
import org.jclouds.aws.ec2.domain.InstanceType;
|
||||||
import org.jclouds.aws.ec2.domain.IpProtocol;
|
import org.jclouds.aws.ec2.domain.IpProtocol;
|
||||||
import org.jclouds.aws.ec2.domain.KeyPair;
|
import org.jclouds.aws.ec2.domain.KeyPair;
|
||||||
import org.jclouds.aws.ec2.domain.RunningInstance;
|
import org.jclouds.aws.ec2.domain.RunningInstance;
|
||||||
|
@ -32,7 +33,10 @@ import org.jclouds.aws.ec2.services.InstanceClient;
|
||||||
import org.jclouds.aws.ec2.services.KeyPairClient;
|
import org.jclouds.aws.ec2.services.KeyPairClient;
|
||||||
import org.jclouds.aws.ec2.services.SecurityGroupClient;
|
import org.jclouds.aws.ec2.services.SecurityGroupClient;
|
||||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
|
import org.jclouds.compute.domain.Size;
|
||||||
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.compute.predicates.NodePredicates;
|
import org.jclouds.compute.predicates.NodePredicates;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
|
@ -40,6 +44,7 @@ import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
@ -61,6 +66,33 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
|
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
|
||||||
|
public void testTemplateChoiceForInstanceByCCSizeId() throws Exception {
|
||||||
|
Set<? extends Size> sizes = context.getComputeService().listSizes();
|
||||||
|
assert Iterables.any(sizes, new Predicate<Size>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Size arg0) {
|
||||||
|
return arg0.getProviderId().equals(InstanceType.CC1_4XLARGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}) : sizes;
|
||||||
|
Set<? extends Image> images = context.getComputeService().listImages();
|
||||||
|
assert Iterables.any(images, new Predicate<Image>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Image arg0) {
|
||||||
|
return arg0.getId().equals("us-east-1/ami-7ea24a17");
|
||||||
|
}
|
||||||
|
|
||||||
|
}) : images;
|
||||||
|
Template template = context.getComputeService().templateBuilder()
|
||||||
|
.fastest().build();
|
||||||
|
assert template != null : "The returned template was null, but it should have a value.";
|
||||||
|
assertEquals(template.getSize().getProviderId(), InstanceType.CC1_4XLARGE);
|
||||||
|
assertEquals(template.getImage().getId(), "us-east-1/ami-7ea24a17");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(enabled = true, dependsOnMethods = "testTemplateChoiceForInstanceByCCSizeId")
|
||||||
public void testExtendedOptionsAndLogin() throws Exception {
|
public void testExtendedOptionsAndLogin() throws Exception {
|
||||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
||||||
context.getProviderSpecificContext().getApi())
|
context.getProviderSpecificContext().getApi())
|
||||||
|
@ -132,7 +164,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
|
@Test(enabled = true, dependsOnMethods = "testTemplateChoiceForInstanceByCCSizeId")
|
||||||
public void testExtendedOptionsNoKeyPair() throws Exception {
|
public void testExtendedOptionsNoKeyPair() throws Exception {
|
||||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
||||||
context.getProviderSpecificContext().getApi())
|
context.getProviderSpecificContext().getApi())
|
||||||
|
@ -190,13 +222,12 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
|
@Test(enabled = true, dependsOnMethods = "testTemplateChoiceForInstanceByCCSizeId")
|
||||||
public void testExtendedOptionsWithSubnetId() throws Exception {
|
public void testExtendedOptionsWithSubnetId() throws Exception {
|
||||||
|
|
||||||
String subnetId = System.getProperty("jclouds.test.subnetId");
|
String subnetId = System.getProperty("jclouds.test.subnetId");
|
||||||
if(subnetId == null)
|
if (subnetId == null) {
|
||||||
{
|
// Skip test and return
|
||||||
//Skip test and return
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
SecurityGroupClient securityGroupClient = EC2Client.class.cast(
|
||||||
|
@ -214,7 +245,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
TemplateOptions options = client.templateOptions();
|
TemplateOptions options = client.templateOptions();
|
||||||
|
|
||||||
//options.as(EC2TemplateOptions.class).securityGroups(tag);
|
// options.as(EC2TemplateOptions.class).securityGroups(tag);
|
||||||
options.as(EC2TemplateOptions.class).keyPair(tag);
|
options.as(EC2TemplateOptions.class).keyPair(tag);
|
||||||
options.as(EC2TemplateOptions.class).subnetId(subnetId);
|
options.as(EC2TemplateOptions.class).subnetId(subnetId);
|
||||||
|
|
||||||
|
@ -224,7 +255,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||||
cleanupExtendedStuff(securityGroupClient, keyPairClient, tag);
|
cleanupExtendedStuff(securityGroupClient, keyPairClient, tag);
|
||||||
|
|
||||||
// create the security group
|
// create the security group
|
||||||
//securityGroupClient.createSecurityGroupInRegion(null, tag, tag);
|
// securityGroupClient.createSecurityGroupInRegion(null, tag, tag);
|
||||||
|
|
||||||
// create a keypair to pass in as well
|
// create a keypair to pass in as well
|
||||||
keyPairClient.createKeyPairInRegion(null, tag);
|
keyPairClient.createKeyPairInRegion(null, tag);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import java.util.Set;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
|
||||||
import org.jclouds.aws.ec2.compute.domain.EC2Size;
|
import org.jclouds.aws.ec2.compute.domain.EC2Size;
|
||||||
|
import org.jclouds.aws.ec2.domain.InstanceType;
|
||||||
import org.jclouds.compute.domain.Architecture;
|
import org.jclouds.compute.domain.Architecture;
|
||||||
import org.jclouds.compute.domain.ComputeMetadata;
|
import org.jclouds.compute.domain.ComputeMetadata;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
|
@ -65,6 +66,10 @@ import com.google.inject.util.Providers;
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
*/
|
*/
|
||||||
public class EC2ComputeServiceTest {
|
public class EC2ComputeServiceTest {
|
||||||
|
private static final Location location = new LocationImpl(LocationScope.REGION, "us-east-1", "us east", null);
|
||||||
|
|
||||||
|
private static final EC2Size CC1_4XLARGE = new EC2Size(location,
|
||||||
|
InstanceType.CC1_4XLARGE, 33.5, 23 * 1024, 1690, new String[]{"us-east-1/cc-image"});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
||||||
|
@ -83,6 +88,17 @@ public class EC2ComputeServiceTest {
|
||||||
String.valueOf(template.getSize()));
|
String.valueOf(template.getSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTemplateChoiceForInstanceByCCSizeId() throws Exception {
|
||||||
|
Template template = newTemplateBuilder().fastest().build();
|
||||||
|
|
||||||
|
assert template != null : "The returned template was null, but it should have a value.";
|
||||||
|
assert CC1_4XLARGE.equals(template.getSize()) : format(
|
||||||
|
"Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE.getId(),
|
||||||
|
String.valueOf(template.getSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
* Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based
|
||||||
* on physical attributes (# of cores, ram, etc).
|
* on physical attributes (# of cores, ram, etc).
|
||||||
|
@ -121,7 +137,6 @@ public class EC2ComputeServiceTest {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private TemplateBuilder newTemplateBuilder() {
|
private TemplateBuilder newTemplateBuilder() {
|
||||||
Location location = new LocationImpl(LocationScope.REGION, "us-east-1", "us east", null);
|
|
||||||
|
|
||||||
Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
|
Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
|
||||||
Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);
|
Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class);
|
||||||
|
@ -129,7 +144,7 @@ public class EC2ComputeServiceTest {
|
||||||
|
|
||||||
expect(optionsProvider.get()).andReturn(defaultOptions);
|
expect(optionsProvider.get()).andReturn(defaultOptions);
|
||||||
|
|
||||||
Image image = new ImageImpl("ami-image", "image", "us-east-1/ami-image", location, null, Maps
|
Image image = new ImageImpl("cc-image", "image", "us-east-1/cc-image", location, null, Maps
|
||||||
.<String, String> newHashMap(), "description", "1.0", null, "ubuntu",
|
.<String, String> newHashMap(), "description", "1.0", null, "ubuntu",
|
||||||
Architecture.X86_64, new Credentials("root", null));
|
Architecture.X86_64, new Credentials("root", null));
|
||||||
replay(optionsProvider);
|
replay(optionsProvider);
|
||||||
|
@ -141,7 +156,7 @@ public class EC2ComputeServiceTest {
|
||||||
Provider<Set<? extends Size>> sizes = Providers.<Set<? extends Size>> of(ImmutableSet
|
Provider<Set<? extends Size>> sizes = Providers.<Set<? extends Size>> of(ImmutableSet
|
||||||
.<Size> of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL,
|
.<Size> of(EC2Size.C1_MEDIUM, EC2Size.C1_XLARGE, EC2Size.M1_LARGE, EC2Size.M1_SMALL,
|
||||||
EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE,
|
EC2Size.M1_XLARGE, EC2Size.M2_XLARGE, EC2Size.M2_2XLARGE,
|
||||||
EC2Size.M2_4XLARGE));
|
EC2Size.M2_4XLARGE, CC1_4XLARGE ));
|
||||||
|
|
||||||
return new TemplateBuilderImpl(locations, images, sizes, location, optionsProvider,
|
return new TemplateBuilderImpl(locations, images, sizes, location, optionsProvider,
|
||||||
templateBuilderProvider) {
|
templateBuilderProvider) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=CreateImage&InstanceId=instanceId&Name=name",
|
"Version=2010-06-15&Action=CreateImage&InstanceId=instanceId&Name=name",
|
||||||
"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);
|
||||||
|
@ -80,7 +80,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true",
|
"Version=2010-06-15&Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -97,12 +97,12 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeImages",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeImages",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
filter.filter(request);
|
filter.filter(request);
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Action=DescribeImages&Signature=IYist5Mfzd44GO3%2BX8WJ4Ti%2BWe3UmrZQC10XdCkT5Fk%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2009-11-30&AWSAccessKeyId=identity",
|
"Action=DescribeImages&Signature=qE4vexSFJqS0UWK%2BccV3s%2BP9woL3M5HI5bTBoM7s%2FLY%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -123,7 +123,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeImages&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2",
|
"Version=2010-06-15&Action=DescribeImages&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -140,7 +140,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DeregisterImage&ImageId=imageId",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DeregisterImage&ImageId=imageId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -160,7 +160,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=RegisterImage&ImageLocation=pathToManifest&Name=name",
|
"Version=2010-06-15&Action=RegisterImage&ImageLocation=pathToManifest&Name=name",
|
||||||
"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);
|
||||||
|
@ -181,7 +181,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description",
|
"Version=2010-06-15&Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -202,7 +202,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName",
|
"Version=2010-06-15&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName",
|
||||||
"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);
|
||||||
|
@ -225,7 +225,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fdevice&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=%2Fdev%2Fnewdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100",
|
"Version=2010-06-15&Action=RegisterImage&RootDeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fdevice&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=%2Fdev%2Fnewdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -245,7 +245,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeImageAttribute&Attribute=productCodes&ImageId=imageId",
|
"Version=2010-06-15&Action=DescribeImageAttribute&Attribute=productCodes&ImageId=imageId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -265,7 +265,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId",
|
"Version=2010-06-15&Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -285,7 +285,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
"Version=2010-06-15&Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -306,12 +306,12 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
"Version=2010-06-15&Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
filter.filter(request);
|
filter.filter(request);
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Action=ModifyImageAttribute&Attribute=launchPermission&ImageId=imageId&OperationType=add&Signature=Nf2oLuEQ%2BDgwhAxNt7Cdicjacz3PYTVR08%2BaGuXMfwU%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&UserGroup.1=all&UserId.1=bob&UserId.2=sue&Version=2009-11-30&AWSAccessKeyId=identity",
|
"Action=ModifyImageAttribute&Attribute=launchPermission&ImageId=imageId&OperationType=add&Signature=WZzNWOC1KHbuySvXEuLTiBA%2BVUfKpSBN2Lud6MrhlCQ%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&UserGroup.1=all&UserId.1=bob&UserId.2=sue&Version=2010-06-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);
|
||||||
|
@ -332,7 +332,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
"Version=2010-06-15&Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
||||||
"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);
|
||||||
|
@ -351,7 +351,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
"Version=2010-06-15&Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
||||||
"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);
|
||||||
|
@ -371,7 +371,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyImageAttribute&OperationType=add&Attribute=productCodes&ImageId=imageId&ProductCode.1=code1&ProductCode.2=code2",
|
"Version=2010-06-15&Action=ModifyImageAttribute&OperationType=add&Attribute=productCodes&ImageId=imageId&ProductCode.1=code1&ProductCode.2=code2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -392,7 +392,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyImageAttribute&OperationType=remove&Attribute=productCodes&ImageId=imageId&ProductCode.1=code1&ProductCode.2=code2",
|
"Version=2010-06-15&Action=ModifyImageAttribute&OperationType=remove&Attribute=productCodes&ImageId=imageId&ProductCode.1=code1&ProductCode.2=code2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-west-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-west-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-west-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-west-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Version=2009-11-30&Action=DescribeAvailabilityZones",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeAvailabilityZones",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -78,7 +78,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeAvailabilityZones&ZoneName.1=us-east-1a&ZoneName.2=us-east-1b",
|
"Version=2010-06-15&Action=DescribeAvailabilityZones&ZoneName.1=us-east-1a&ZoneName.2=us-east-1b",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -95,7 +95,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeRegions",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeRegions",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -116,7 +116,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeRegions&RegionName.1=us-east-1&RegionName.2=us-west-1",
|
"Version=2010-06-15&Action=DescribeRegions&RegionName.1=us-east-1&RegionName.2=us-west-1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=CreateVolume&AvailabilityZone=us-east-1a&Size=20",
|
"Version=2010-06-15&Action=CreateVolume&AvailabilityZone=us-east-1a&Size=20",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -83,7 +83,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=CreateVolume&AvailabilityZone=us-east-1a&SnapshotId=snapshotId",
|
"Version=2010-06-15&Action=CreateVolume&AvailabilityZone=us-east-1a&SnapshotId=snapshotId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -104,7 +104,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=CreateVolume&AvailabilityZone=us-east-1a&SnapshotId=snapshotId&Size=15",
|
"Version=2010-06-15&Action=CreateVolume&AvailabilityZone=us-east-1a&SnapshotId=snapshotId&Size=15",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -121,7 +121,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DeleteVolume&VolumeId=id",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DeleteVolume&VolumeId=id",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -138,7 +138,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeVolumes",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeVolumes",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -157,7 +157,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeVolumes&VolumeId.1=1&VolumeId.2=2",
|
"Version=2010-06-15&Action=DescribeVolumes&VolumeId.1=1&VolumeId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -176,7 +176,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=AttachVolume&InstanceId=instanceId&VolumeId=id&Device=%2Fdevice",
|
"Version=2010-06-15&Action=AttachVolume&InstanceId=instanceId&VolumeId=id&Device=%2Fdevice",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -195,7 +195,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DetachVolume&Force=false&VolumeId=id",
|
"Version=2010-06-15&Action=DetachVolume&Force=false&VolumeId=id",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -217,7 +217,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DetachVolume&Force=true&VolumeId=id&InstanceId=instanceId&Device=%2Fdevice",
|
"Version=2010-06-15&Action=DetachVolume&Force=true&VolumeId=id&InstanceId=instanceId&Device=%2Fdevice",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -235,7 +235,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=CreateSnapshot&VolumeId=volumeId",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=CreateSnapshot&VolumeId=volumeId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -257,7 +257,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=CreateSnapshot&VolumeId=volumeId&Description=description",
|
"Version=2010-06-15&Action=CreateSnapshot&VolumeId=volumeId&Description=description",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -274,7 +274,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeSnapshots",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeSnapshots",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -295,7 +295,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeSnapshots&Owner.1=o1&Owner.2=o2&RestorableBy.1=r1&RestorableBy.2=r2&SnapshotId.1=s1&SnapshotId.2=s2",
|
"Version=2010-06-15&Action=DescribeSnapshots&Owner.1=o1&Owner.2=o2&RestorableBy.1=r1&RestorableBy.2=r2&SnapshotId.1=s1&SnapshotId.2=s2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -315,7 +315,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeSnapshotAttribute&Attribute=createVolumePermission&SnapshotId=snapshotId",
|
"Version=2010-06-15&Action=DescribeSnapshotAttribute&Attribute=createVolumePermission&SnapshotId=snapshotId",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -337,7 +337,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifySnapshotAttribute&OperationType=add&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
"Version=2010-06-15&Action=ModifySnapshotAttribute&OperationType=add&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -359,7 +359,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifySnapshotAttribute&OperationType=remove&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
"Version=2010-06-15&Action=ModifySnapshotAttribute&OperationType=remove&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
||||||
"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);
|
||||||
|
@ -378,7 +378,7 @@ public class ElasticBlockStoreAsyncClientTest extends
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ResetSnapshotAttribute&Attribute=createVolumePermission&SnapshotId=snapshotId",
|
"Version=2010-06-15&Action=ResetSnapshotAttribute&Attribute=createVolumePermission&SnapshotId=snapshotId",
|
||||||
"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);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ElasticIPAddressAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DisassociateAddress&PublicIp=127.0.0.1",
|
"Version=2010-06-15&Action=DisassociateAddress&PublicIp=127.0.0.1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -68,7 +68,7 @@ public class ElasticIPAddressAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=AssociateAddress&InstanceId=me&PublicIp=127.0.0.1",
|
"Version=2010-06-15&Action=AssociateAddress&InstanceId=me&PublicIp=127.0.0.1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -85,7 +85,7 @@ public class ElasticIPAddressAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=ReleaseAddress&PublicIp=127.0.0.1",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=ReleaseAddress&PublicIp=127.0.0.1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -103,7 +103,7 @@ public class ElasticIPAddressAsyncClientTest extends
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeAddresses&PublicIp.1=127.0.0.1",
|
"Version=2010-06-15&Action=DescribeAddresses&PublicIp.1=127.0.0.1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -120,7 +120,7 @@ public class ElasticIPAddressAsyncClientTest extends
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=AllocateAddress",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=AllocateAddress",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeInstances",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeInstances",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -79,7 +79,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeInstances&InstanceId.1=1&InstanceId.2=2",
|
"Version=2010-06-15&Action=DescribeInstances&InstanceId.1=1&InstanceId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -98,7 +98,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=TerminateInstances&InstanceId.1=1&InstanceId.2=2",
|
"Version=2010-06-15&Action=TerminateInstances&InstanceId.1=1&InstanceId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -117,7 +117,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=RunInstances&ImageId=ami-voo&MinCount=1&MaxCount=1",
|
"Version=2010-06-15&Action=RunInstances&ImageId=ami-voo&MinCount=1&MaxCount=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -141,7 +141,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"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",
|
"Version=2010-06-15&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",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -159,7 +159,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=StopInstances&Force=true&InstanceId.1=1&InstanceId.2=2",
|
"Version=2010-06-15&Action=StopInstances&Force=true&InstanceId.1=1&InstanceId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -177,7 +177,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=RebootInstances&InstanceId.1=1&InstanceId.2=2",
|
"Version=2010-06-15&Action=RebootInstances&InstanceId.1=1&InstanceId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -195,7 +195,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=StartInstances&InstanceId.1=1&InstanceId.2=2",
|
"Version=2010-06-15&Action=StartInstances&InstanceId.1=1&InstanceId.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -215,7 +215,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=userData&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=userData&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -235,7 +235,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=rootDeviceName&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=rootDeviceName&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -255,7 +255,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=ramdisk&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=ramdisk&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -275,7 +275,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=disableApiTermination&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=disableApiTermination&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -294,7 +294,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=kernel&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=kernel&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -314,7 +314,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=instanceType&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=instanceType&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -335,7 +335,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -355,7 +355,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=DescribeInstanceAttribute&Attribute=blockDeviceMapping&InstanceId=1",
|
"Version=2010-06-15&Action=DescribeInstanceAttribute&Attribute=blockDeviceMapping&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -375,12 +375,12 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
filter.filter(request);// ensure encoding worked properly
|
filter.filter(request);// ensure encoding worked properly
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Action=ModifyInstanceAttribute&Attribute=userData&InstanceId=1&Signature=ch%2BpeYTRad241GAhjH9Wo2vKWlkgfNa3txM0lhPCBSM%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Value=dGVzdA%3D%3D&Version=2009-11-30&AWSAccessKeyId=identity",
|
"Action=ModifyInstanceAttribute&Attribute=userData&InstanceId=1&Signature=LfUmzLM5DsACR5nQcEfGF5FPdznOwwhJ7tjhBWfHtGs%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Value=dGVzdA%3D%3D&Version=2010-06-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);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -399,7 +399,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=ramdisk&Value=test&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=ramdisk&Value=test&InstanceId=1",
|
||||||
"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);
|
||||||
|
@ -418,7 +418,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=kernel&Value=test&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=kernel&Value=test&InstanceId=1",
|
||||||
"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);
|
||||||
|
@ -438,7 +438,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=disableApiTermination&Value=true&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=disableApiTermination&Value=true&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -458,7 +458,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=instanceType&Value=c1.medium&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=instanceType&Value=c1.medium&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -480,7 +480,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&Value=terminate&InstanceId=1",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&Value=terminate&InstanceId=1",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -505,12 +505,12 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=ModifyInstanceAttribute&InstanceId=1&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true",
|
"Version=2010-06-15&Action=ModifyInstanceAttribute&InstanceId=1&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
filter.filter(request);// ensure encoding worked properly
|
filter.filter(request);// ensure encoding worked properly
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Action=ModifyInstanceAttribute&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fsda1&BlockDeviceMapping.1.Ebs.DeleteOnTermination=true&BlockDeviceMapping.1.Ebs.VolumeId=vol-test1&InstanceId=1&Signature=QOd9dFUmgBAsz3b5rWOE2wWgoB85vmhsVM9yNO2s7cE%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2009-11-30&AWSAccessKeyId=identity",
|
"Action=ModifyInstanceAttribute&BlockDeviceMapping.1.DeviceName=%2Fdev%2Fsda1&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);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DeleteKeyPair&KeyName=mykey",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DeleteKeyPair&KeyName=mykey",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -63,7 +63,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeKeyPairs",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeKeyPairs",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -82,7 +82,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeKeyPairs&KeyName.1=1&KeyName.2=2",
|
"Version=2010-06-15&Action=DescribeKeyPairs&KeyName.1=1&KeyName.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest<Monitoring
|
||||||
HttpRequest request = processor.createRequest(method, null, "instance1", "instance2");
|
HttpRequest request = processor.createRequest(method, null, "instance1", "instance2");
|
||||||
|
|
||||||
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");
|
||||||
String payload = "Version=2009-11-30&Action=UnmonitorInstances&InstanceId.0=instance1&InstanceId.1=instance2";
|
String payload = "Version=2010-06-15&Action=UnmonitorInstances&InstanceId.0=instance1&InstanceId.1=instance2";
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, payload, "application/x-www-form-urlencoded", false);
|
assertPayloadEquals(request, payload, "application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class MonitoringAsyncClientTest extends BaseEC2AsyncClientTest<Monitoring
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=MonitorInstances&InstanceId.0=instance1&InstanceId.1=instance2",
|
"Version=2010-06-15&Action=MonitorInstances&InstanceId.0=instance1&InstanceId.1=instance2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DeleteSecurityGroup&GroupName=name",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DeleteSecurityGroup&GroupName=name",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -70,7 +70,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=CreateSecurityGroup&GroupDescription=description&GroupName=name",
|
"Version=2010-06-15&Action=CreateSecurityGroup&GroupDescription=description&GroupName=name",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -88,7 +88,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
|
|
||||||
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, "Version=2009-11-30&Action=DescribeSecurityGroups",
|
assertPayloadEquals(request, "Version=2010-06-15&Action=DescribeSecurityGroups",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -107,7 +107,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
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,
|
assertPayloadEquals(request,
|
||||||
"Version=2009-11-30&Action=DescribeSecurityGroups&GroupName.1=1&GroupName.2=2",
|
"Version=2010-06-15&Action=DescribeSecurityGroups&GroupName.1=1&GroupName.2=2",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -129,7 +129,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=AuthorizeSecurityGroupIngress&GroupName=group&SourceSecurityGroupOwnerId=sourceUser&SourceSecurityGroupName=sourceGroup",
|
"Version=2010-06-15&Action=AuthorizeSecurityGroupIngress&GroupName=group&SourceSecurityGroupOwnerId=sourceUser&SourceSecurityGroupName=sourceGroup",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -151,7 +151,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=AuthorizeSecurityGroupIngress&CidrIp=0.0.0.0%2F0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
"Version=2010-06-15&Action=AuthorizeSecurityGroupIngress&CidrIp=0.0.0.0%2F0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -173,7 +173,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=RevokeSecurityGroupIngress&GroupName=group&SourceSecurityGroupOwnerId=sourceUser&SourceSecurityGroupName=sourceGroup",
|
"Version=2010-06-15&Action=RevokeSecurityGroupIngress&GroupName=group&SourceSecurityGroupOwnerId=sourceUser&SourceSecurityGroupName=sourceGroup",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -195,7 +195,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(
|
||||||
request,
|
request,
|
||||||
"Version=2009-11-30&Action=RevokeSecurityGroupIngress&CidrIp=0.0.0.0%2F0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
"Version=2010-06-15&Action=RevokeSecurityGroupIngress&CidrIp=0.0.0.0%2F0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class DescribeImagesResponseHandlerTest extends BaseEC2HandlerTest {
|
||||||
"ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml", "206029621532",
|
"ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml", "206029621532",
|
||||||
ImageState.AVAILABLE, ImageType.MACHINE, false,
|
ImageState.AVAILABLE, ImageType.MACHINE, false,
|
||||||
Sets.<String> newHashSet("9961934F"), "aki-4438dd2d", null, "ari-4538dd2c",
|
Sets.<String> newHashSet("9961934F"), "aki-4438dd2d", null, "ari-4538dd2c",
|
||||||
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()));
|
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(),"paravirtual"));
|
||||||
|
|
||||||
Set<Image> result = parseImages(is);
|
Set<Image> result = parseImages(is);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class DescribeImagesResponseHandlerTest extends BaseEC2HandlerTest {
|
||||||
"aws-solutions-amis/SqlSvrStd2003r2-x86_64-Win_SFWBasic5.1-v1.0.manifest.xml",
|
"aws-solutions-amis/SqlSvrStd2003r2-x86_64-Win_SFWBasic5.1-v1.0.manifest.xml",
|
||||||
"771350841976", ImageState.AVAILABLE, ImageType.MACHINE, true, Sets
|
"771350841976", ImageState.AVAILABLE, ImageType.MACHINE, true, Sets
|
||||||
.<String> newHashSet("5771E9A6"), null, "windows", null,
|
.<String> newHashSet("5771E9A6"), null, "windows", null,
|
||||||
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of()));
|
RootDeviceType.INSTANCE_STORE, null, ImmutableMap.<String, EbsBlockDevice> of(),"paravirtual"));
|
||||||
|
|
||||||
Set<Image> result = parseImages(is);
|
Set<Image> result = parseImages(is);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class DescribeImagesResponseHandlerTest extends BaseEC2HandlerTest {
|
||||||
"windows", null, RootDeviceType.EBS, "/dev/sda1", ImmutableMap
|
"windows", null, RootDeviceType.EBS, "/dev/sda1", ImmutableMap
|
||||||
.<String, EbsBlockDevice> of("/dev/sda1", new EbsBlockDevice(
|
.<String, EbsBlockDevice> of("/dev/sda1", new EbsBlockDevice(
|
||||||
"snap-d01272b9", 30, true), "xvdf", new EbsBlockDevice(
|
"snap-d01272b9", 30, true), "xvdf", new EbsBlockDevice(
|
||||||
"snap-d31272ba", 250, false))));
|
"snap-d31272ba", 250, false)),"hvm"));
|
||||||
|
|
||||||
Set<Image> result = parseImages(is);
|
Set<Image> result = parseImages(is);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest {
|
||||||
public void testEuc() {
|
public void testEuc() {
|
||||||
|
|
||||||
InputStream is = Utils
|
InputStream is = Utils
|
||||||
.toInputStream("<DescribeRegionsResponse xmlns=\"http://ec2.amazonaws.com/doc/2009-11-30/\"><requestId>6a3b36f9-9ff4-47cf-87e3-285b08fbe5e5</requestId><regionInfo><item><regionName>Eucalyptus</regionName><regionEndpoint>http://173.205.188.130:8773/services/Eucalyptus</regionEndpoint></item><item><regionName>Walrus</regionName><regionEndpoint>http://173.205.188.130:8773/services/Walrus</regionEndpoint></item></regionInfo></DescribeRegionsResponse>");
|
.toInputStream("<DescribeRegionsResponse xmlns=\"http://ec2.amazonaws.com/doc/2010-06-15/\"><requestId>6a3b36f9-9ff4-47cf-87e3-285b08fbe5e5</requestId><regionInfo><item><regionName>Eucalyptus</regionName><regionEndpoint>http://173.205.188.130:8773/services/Eucalyptus</regionEndpoint></item><item><regionName>Walrus</regionName><regionEndpoint>http://173.205.188.130:8773/services/Walrus</regionEndpoint></item></regionInfo></DescribeRegionsResponse>");
|
||||||
|
|
||||||
Map<String, URI> expected = ImmutableMap.<String, URI> of("Eucalyptus",
|
Map<String, URI> expected = ImmutableMap.<String, URI> of("Eucalyptus",
|
||||||
URI.create("http://173.205.188.130:8773/services/Eucalyptus"));
|
URI.create("http://173.205.188.130:8773/services/Eucalyptus"));
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class FormSignerTest extends BaseEC2AsyncClientTest<String> {
|
||||||
"AWSAccessKeyId", "foo").put("Action", "DescribeImages").put("Expires",
|
"AWSAccessKeyId", "foo").put("Action", "DescribeImages").put("Expires",
|
||||||
"2008-02-10T12:00:00Z").put("ImageId.1", "ami-2bb65342").put(
|
"2008-02-10T12:00:00Z").put("ImageId.1", "ami-2bb65342").put(
|
||||||
"SignatureMethod", "HmacSHA256").put("SignatureVersion", "2").put(
|
"SignatureMethod", "HmacSHA256").put("SignatureVersion", "2").put(
|
||||||
"Version", "2009-11-30").build()),
|
"Version", "2010-06-15").build()),
|
||||||
"AWSAccessKeyId=foo&Action=DescribeImages&Expires=2008-02-10T12%3A00%3A00Z&ImageId.1=ami-2bb65342&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=2009-11-30");
|
"AWSAccessKeyId=foo&Action=DescribeImages&Expires=2008-02-10T12%3A00%3A00Z&ImageId.1=ami-2bb65342&SignatureMethod=HmacSHA256&SignatureVersion=2&Version=2010-06-15");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<ramdiskId>ari-4538dd2c</ramdiskId>
|
<ramdiskId>ari-4538dd2c</ramdiskId>
|
||||||
<rootDeviceType>instance-store</rootDeviceType>
|
<rootDeviceType>instance-store</rootDeviceType>
|
||||||
<blockDeviceMapping />
|
<blockDeviceMapping />
|
||||||
|
<virtualizationType>paravirtual</virtualizationType>
|
||||||
</item>
|
</item>
|
||||||
</imagesSet>
|
</imagesSet>
|
||||||
</DescribeImagesResponse>
|
</DescribeImagesResponse>
|
|
@ -34,6 +34,7 @@
|
||||||
</ebs>
|
</ebs>
|
||||||
</item>
|
</item>
|
||||||
</blockDeviceMapping>
|
</blockDeviceMapping>
|
||||||
|
<virtualizationType>hvm</virtualizationType>
|
||||||
</item>
|
</item>
|
||||||
</imagesSet>
|
</imagesSet>
|
||||||
</DescribeImagesResponse>
|
</DescribeImagesResponse>
|
|
@ -16,6 +16,7 @@
|
||||||
<platform>windows</platform>
|
<platform>windows</platform>
|
||||||
<rootDeviceType>instance-store</rootDeviceType>
|
<rootDeviceType>instance-store</rootDeviceType>
|
||||||
<blockDeviceMapping/>
|
<blockDeviceMapping/>
|
||||||
|
<virtualizationType>paravirtual</virtualizationType>
|
||||||
</item>
|
</item>
|
||||||
</imagesSet>
|
</imagesSet>
|
||||||
</DescribeImagesResponse>
|
</DescribeImagesResponse>
|
|
@ -37,7 +37,7 @@ public enum OsFamily {
|
||||||
/**
|
/**
|
||||||
* Oracle Enterprise Linux
|
* Oracle Enterprise Linux
|
||||||
*/
|
*/
|
||||||
OEL, RHEL, FEDORA, DEBIAN, UBUNTU, TTYLINUX, ARCH, SUSE, GENTOO, WINDOWS;
|
OEL, RHEL, FEDORA, DEBIAN, UBUNTU, TTYLINUX, ARCH, SUSE, SOLARIS, GENTOO, WINDOWS;
|
||||||
public String value() {
|
public String value() {
|
||||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public enum OsFamily {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OsFamily fromValue(String operatingSystem) {
|
public static OsFamily fromValue(String operatingSystem) {
|
||||||
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(
|
return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE,
|
||||||
operatingSystem, "region")));
|
checkNotNull(operatingSystem, "region")));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -462,7 +462,13 @@ public class TemplateBuilderImpl implements TemplateBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Image input) {
|
public boolean apply(Image input) {
|
||||||
return size.supportsImage(input);
|
boolean returnVal = size
|
||||||
|
.supportsImage(input);
|
||||||
|
if (!returnVal && input.getId().equals("us-east-1/ami-7ea24a17")) {
|
||||||
|
System.err.println("goo");
|
||||||
|
}
|
||||||
|
return returnVal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,28 @@ import com.google.common.collect.Sets;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class ImagePredicates {
|
public class ImagePredicates {
|
||||||
|
/**
|
||||||
|
* evaluates true if the Image
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* ids of the images
|
||||||
|
* @return predicate
|
||||||
|
*/
|
||||||
|
public static Predicate<Image> idIn(Iterable<String> ids) {
|
||||||
|
checkNotNull(ids, "ids must be defined");
|
||||||
|
final Set<String> search = Sets.newHashSet(ids);
|
||||||
|
return new Predicate<Image>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(Image image) {
|
||||||
|
return search.contains(image.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "idIn(" + search + ")";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* evaluates true if the Image
|
* evaluates true if the Image
|
||||||
|
@ -61,7 +83,8 @@ public class ImagePredicates {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Predicate<Image> architectureIn(Iterable<Architecture> architectures) {
|
public static Predicate<Image> architectureIn(
|
||||||
|
Iterable<Architecture> architectures) {
|
||||||
checkNotNull(architectures, "architectures must be defined");
|
checkNotNull(architectures, "architectures must be defined");
|
||||||
final Set<Architecture> search = Sets.newHashSet(architectures);
|
final Set<Architecture> search = Sets.newHashSet(architectures);
|
||||||
return new Predicate<Image>() {
|
return new Predicate<Image>() {
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
|
||||||
*
|
|
||||||
* ====================================================================
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ====================================================================
|
|
||||||
*/
|
|
||||||
package org.jclouds.rest.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import javax.inject.Qualifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply this to implementation classes when you want Access to items from the
|
|
||||||
* scope of a delegate.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER , ElementType.FIELD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Qualifier
|
|
||||||
public @interface Caller {
|
|
||||||
}
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.rest.config;
|
package org.jclouds.rest.config;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
@ -36,7 +35,6 @@ import org.jclouds.internal.ClassMethodArgs;
|
||||||
import org.jclouds.rest.AsyncClientFactory;
|
import org.jclouds.rest.AsyncClientFactory;
|
||||||
import org.jclouds.rest.HttpAsyncClient;
|
import org.jclouds.rest.HttpAsyncClient;
|
||||||
import org.jclouds.rest.HttpClient;
|
import org.jclouds.rest.HttpClient;
|
||||||
import org.jclouds.rest.annotations.Caller;
|
|
||||||
import org.jclouds.rest.internal.AsyncRestClientProxy;
|
import org.jclouds.rest.internal.AsyncRestClientProxy;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
|
|
||||||
|
@ -47,7 +45,6 @@ import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.Module;
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
@ -85,10 +82,6 @@ public class RestModule extends AbstractModule {
|
||||||
private final Injector injector;
|
private final Injector injector;
|
||||||
private final AsyncRestClientProxy.Factory factory;
|
private final AsyncRestClientProxy.Factory factory;
|
||||||
|
|
||||||
@Caller
|
|
||||||
@Inject(optional = true)
|
|
||||||
Module callerModule = new CallerScopedBindingModule();
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
CreateAsyncClientForCaller(Injector injector,
|
CreateAsyncClientForCaller(Injector injector,
|
||||||
AsyncRestClientProxy.Factory factory) {
|
AsyncRestClientProxy.Factory factory) {
|
||||||
|
@ -101,22 +94,12 @@ public class RestModule extends AbstractModule {
|
||||||
public Object apply(final ClassMethodArgs from) {
|
public Object apply(final ClassMethodArgs from) {
|
||||||
Class clazz = from.getAsyncClass();
|
Class clazz = from.getAsyncClass();
|
||||||
TypeLiteral typeLiteral = TypeLiteral.get(clazz);
|
TypeLiteral typeLiteral = TypeLiteral.get(clazz);
|
||||||
Injector injector = this.injector.createChildInjector(callerModule,
|
|
||||||
new AbstractModule() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
bind(ClassMethodArgs.class).annotatedWith(Caller.class)
|
|
||||||
.toInstance(from);
|
|
||||||
install(callerModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
RestAnnotationProcessor util = (RestAnnotationProcessor) injector
|
RestAnnotationProcessor util = (RestAnnotationProcessor) injector
|
||||||
.getInstance(Key.get(TypeLiteral.get(Types.newParameterizedType(
|
.getInstance(Key.get(TypeLiteral.get(Types.newParameterizedType(
|
||||||
RestAnnotationProcessor.class, clazz))));
|
RestAnnotationProcessor.class, clazz))));
|
||||||
// not sure why we have to go back and re-inject this...
|
// cannot use child injectors due to the super coarse guice lock on
|
||||||
injector.injectMembers(util);
|
// Singleton
|
||||||
|
util.setCaller(from);
|
||||||
ConcurrentMap<ClassMethodArgs, Object> delegateMap = injector
|
ConcurrentMap<ClassMethodArgs, Object> delegateMap = injector
|
||||||
.getInstance(Key.get(
|
.getInstance(Key.get(
|
||||||
new TypeLiteral<ConcurrentMap<ClassMethodArgs, Object>>() {
|
new TypeLiteral<ConcurrentMap<ClassMethodArgs, Object>>() {
|
||||||
|
@ -128,26 +111,6 @@ public class RestModule extends AbstractModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public static class CallerScopedBindingModule extends AbstractModule {
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Caller
|
|
||||||
URI provideCallerScopedURI(Injector injector, @Caller ClassMethodArgs args) {
|
|
||||||
try {
|
|
||||||
return RestAnnotationProcessor.getEndpointFor(args.getMethod(),
|
|
||||||
args.getArgs(), injector);
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Factory implements AsyncRestClientProxy.Factory {
|
private static class Factory implements AsyncRestClientProxy.Factory {
|
||||||
@Inject
|
@Inject
|
||||||
private TransformingHttpCommandExecutorService executorService;
|
private TransformingHttpCommandExecutorService executorService;
|
||||||
|
|
|
@ -69,8 +69,8 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Inject
|
@Inject
|
||||||
public AsyncRestClientProxy(Injector injector, Factory factory, RestAnnotationProcessor<T> util,
|
public AsyncRestClientProxy(Injector injector, Factory factory,
|
||||||
TypeLiteral<T> typeLiteral,
|
RestAnnotationProcessor<T> util, TypeLiteral<T> typeLiteral,
|
||||||
@Named("async") ConcurrentMap<ClassMethodArgs, Object> delegateMap) {
|
@Named("async") ConcurrentMap<ClassMethodArgs, Object> delegateMap) {
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
this.annotationProcessor = util;
|
this.annotationProcessor = util;
|
||||||
|
@ -79,7 +79,8 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
||||||
this.delegateMap = delegateMap;
|
this.delegateMap = delegateMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object invoke(Object o, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object o, Method method, Object[] args)
|
||||||
|
throws Throwable {
|
||||||
if (method.getName().equals("equals")) {
|
if (method.getName().equals("equals")) {
|
||||||
return this.equals(o);
|
return this.equals(o);
|
||||||
} else if (method.getName().equals("toString")) {
|
} else if (method.getName().equals("toString")) {
|
||||||
|
@ -89,22 +90,27 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
||||||
} else if (method.getName().startsWith("new")) {
|
} else if (method.getName().startsWith("new")) {
|
||||||
return injector.getInstance(method.getReturnType());
|
return injector.getInstance(method.getReturnType());
|
||||||
} else if (method.isAnnotationPresent(Delegate.class)) {
|
} else if (method.isAnnotationPresent(Delegate.class)) {
|
||||||
return delegateMap.get(new ClassMethodArgs(method.getReturnType(), method, args));
|
return delegateMap.get(new ClassMethodArgs(method.getReturnType(),
|
||||||
|
method, args));
|
||||||
} else if (annotationProcessor.getDelegateOrNull(method) != null
|
} else if (annotationProcessor.getDelegateOrNull(method) != null
|
||||||
&& ListenableFuture.class.isAssignableFrom(method.getReturnType())) {
|
&& ListenableFuture.class.isAssignableFrom(method.getReturnType())) {
|
||||||
return createFuture(method, args);
|
return createFuture(method, args);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("method is intended solely to set constants: " + method);
|
throw new RuntimeException(
|
||||||
|
"method is intended solely to set constants: " + method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private ListenableFuture<?> createFuture(Method method, Object[] args) throws ExecutionException {
|
private ListenableFuture<?> createFuture(Method method, Object[] args)
|
||||||
|
throws ExecutionException {
|
||||||
method = annotationProcessor.getDelegateOrNull(method);
|
method = annotationProcessor.getDelegateOrNull(method);
|
||||||
logger.trace("Converting %s.%s", declaring.getSimpleName(), method.getName());
|
logger.trace("Converting %s.%s", declaring.getSimpleName(), method
|
||||||
|
.getName());
|
||||||
Function<Exception, ?> exceptionParser = annotationProcessor
|
Function<Exception, ?> exceptionParser = annotationProcessor
|
||||||
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method);
|
.createExceptionParserOrThrowResourceNotFoundOn404IfNoAnnotation(method);
|
||||||
// in case there is an exception creating the request, we should at least pass in args
|
// in case there is an exception creating the request, we should at least
|
||||||
|
// pass in args
|
||||||
if (exceptionParser instanceof InvocationContext) {
|
if (exceptionParser instanceof InvocationContext) {
|
||||||
((InvocationContext) exceptionParser).setContext(null);
|
((InvocationContext) exceptionParser).setContext(null);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +118,8 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
||||||
try {
|
try {
|
||||||
request = annotationProcessor.createRequest(method, args);
|
request = annotationProcessor.createRequest(method, args);
|
||||||
if (exceptionParser instanceof InvocationContext) {
|
if (exceptionParser instanceof InvocationContext) {
|
||||||
((InvocationContext) exceptionParser).setContext((GeneratedHttpRequest<T>) request);
|
((InvocationContext) exceptionParser)
|
||||||
|
.setContext((GeneratedHttpRequest<T>) request);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
if (exceptionParser != null) {
|
if (exceptionParser != null) {
|
||||||
|
@ -124,20 +131,24 @@ public class AsyncRestClientProxy<T> implements InvocationHandler {
|
||||||
}
|
}
|
||||||
return Futures.immediateFailedFuture(e);
|
return Futures.immediateFailedFuture(e);
|
||||||
}
|
}
|
||||||
logger.trace("Converted %s.%s to %s", declaring.getSimpleName(), method.getName(), request
|
logger.trace("Converted %s.%s to %s", declaring.getSimpleName(), method
|
||||||
.getRequestLine());
|
.getName(), request.getRequestLine());
|
||||||
|
|
||||||
Function<HttpResponse, ?> transformer = annotationProcessor.createResponseParser(method,
|
Function<HttpResponse, ?> transformer = annotationProcessor
|
||||||
request);
|
.createResponseParser(method, request);
|
||||||
logger.trace("Response from %s.%s is parsed by %s", declaring.getSimpleName(), method
|
logger.trace("Response from %s.%s is parsed by %s", declaring
|
||||||
.getName(), transformer.getClass().getSimpleName());
|
.getSimpleName(), method.getName(), transformer.getClass()
|
||||||
|
.getSimpleName());
|
||||||
|
|
||||||
logger.debug("Invoking %s.%s", declaring.getSimpleName(), method.getName());
|
logger.debug("Invoking %s.%s", declaring.getSimpleName(), method
|
||||||
ListenableFuture<?> result = commandFactory.create(request, transformer).execute();
|
.getName());
|
||||||
|
ListenableFuture<?> result = commandFactory.create(request, transformer)
|
||||||
|
.execute();
|
||||||
|
|
||||||
if (exceptionParser != null) {
|
if (exceptionParser != null) {
|
||||||
logger.trace("Exceptions from %s.%s are parsed by %s", declaring.getSimpleName(), method
|
logger.trace("Exceptions from %s.%s are parsed by %s", declaring
|
||||||
.getName(), exceptionParser.getClass().getSimpleName());
|
.getSimpleName(), method.getName(), exceptionParser.getClass()
|
||||||
|
.getSimpleName());
|
||||||
result = new FutureExceptionParser(result, exceptionParser);
|
result = new FutureExceptionParser(result, exceptionParser);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -90,7 +90,6 @@ import org.jclouds.rest.Binder;
|
||||||
import org.jclouds.rest.InputParamValidator;
|
import org.jclouds.rest.InputParamValidator;
|
||||||
import org.jclouds.rest.InvocationContext;
|
import org.jclouds.rest.InvocationContext;
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
import org.jclouds.rest.annotations.Caller;
|
|
||||||
import org.jclouds.rest.annotations.Delegate;
|
import org.jclouds.rest.annotations.Delegate;
|
||||||
import org.jclouds.rest.annotations.Endpoint;
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
import org.jclouds.rest.annotations.EndpointParam;
|
import org.jclouds.rest.annotations.EndpointParam;
|
||||||
|
@ -375,18 +374,18 @@ public class RestAnnotationProcessor<T> {
|
||||||
|
|
||||||
final Injector injector;
|
final Injector injector;
|
||||||
|
|
||||||
ClassMethodArgs caller;
|
private ClassMethodArgs caller;
|
||||||
|
private URI callerEndpoint;
|
||||||
|
|
||||||
@Inject(optional = true)
|
public void setCaller(ClassMethodArgs caller) {
|
||||||
public void setCaller(@Caller ClassMethodArgs caller) {
|
|
||||||
seedCache(caller.getMethod().getDeclaringClass());
|
seedCache(caller.getMethod().getDeclaringClass());
|
||||||
this.caller = caller;
|
this.caller = caller;
|
||||||
|
try {
|
||||||
|
callerEndpoint = getEndpointFor(caller.getMethod(), caller.getArgs(),
|
||||||
|
injector);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(optional = true)
|
|
||||||
@Caller
|
|
||||||
@Nullable
|
|
||||||
URI callerEndpoint;
|
|
||||||
|
|
||||||
public GeneratedHttpRequest<T> createRequest(Method method, Object... args) {
|
public GeneratedHttpRequest<T> createRequest(Method method, Object... args) {
|
||||||
inputParamValidator.validateMethodParametersOrThrow(method, args);
|
inputParamValidator.validateMethodParametersOrThrow(method, args);
|
||||||
|
@ -680,7 +679,8 @@ public class RestAnnotationProcessor<T> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static URI getEndpointFor(Method method, Object[] args, Injector injector) {
|
public static URI getEndpointFor(Method method, Object[] args,
|
||||||
|
Injector injector) {
|
||||||
URI endpoint = getEndpointInParametersOrNull(method, args, injector);
|
URI endpoint = getEndpointInParametersOrNull(method, args, injector);
|
||||||
if (endpoint == null) {
|
if (endpoint == null) {
|
||||||
Endpoint annotation;
|
Endpoint annotation;
|
||||||
|
|
|
@ -61,14 +61,14 @@ public class HttpUtilsTest extends PerformanceTest {
|
||||||
|
|
||||||
public void testParseBase64InForm() {
|
public void testParseBase64InForm() {
|
||||||
Multimap<String, String> expects = LinkedListMultimap.create();
|
Multimap<String, String> expects = LinkedListMultimap.create();
|
||||||
expects.put("Version", "2009-11-30");
|
expects.put("Version", "2010-06-15");
|
||||||
expects.put("Action", "ModifyInstanceAttribute");
|
expects.put("Action", "ModifyInstanceAttribute");
|
||||||
expects.put("Attribute", "userData");
|
expects.put("Attribute", "userData");
|
||||||
expects.put("Value", "dGVzdA==");
|
expects.put("Value", "dGVzdA==");
|
||||||
expects.put("InstanceId", "1");
|
expects.put("InstanceId", "1");
|
||||||
assertEquals(
|
assertEquals(
|
||||||
expects,
|
expects,
|
||||||
parseQueryToMap("Version=2009-11-30&Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1"));
|
parseQueryToMap("Version=2010-06-15&Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.lang.reflect.Type;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.gogrid.domain.Server;
|
import org.jclouds.gogrid.domain.Server;
|
||||||
|
@ -39,6 +40,7 @@ import com.google.gson.reflect.TypeToken;
|
||||||
/**
|
/**
|
||||||
* @author Oleksiy Yarmula
|
* @author Oleksiy Yarmula
|
||||||
*/
|
*/
|
||||||
|
@Singleton
|
||||||
public class ParseServerNameToCredentialsMapFromJsonResponse extends
|
public class ParseServerNameToCredentialsMapFromJsonResponse extends
|
||||||
ParseJson<Map<String, Credentials>> {
|
ParseJson<Map<String, Credentials>> {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue