mirror of https://github.com/apache/jclouds.git
changed single instance spot syntax to only return a single value
This commit is contained in:
parent
25db134edc
commit
77d91f6e1a
|
@ -37,8 +37,9 @@ import org.jclouds.aws.ec2.domain.Spot;
|
||||||
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
|
||||||
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
||||||
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
||||||
import org.jclouds.aws.ec2.xml.SpotInstanceRequestsResponseHandler;
|
|
||||||
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
||||||
|
import org.jclouds.aws.ec2.xml.SpotInstanceHandler;
|
||||||
|
import org.jclouds.aws.ec2.xml.SpotInstancesHandler;
|
||||||
import org.jclouds.aws.filters.FormSigner;
|
import org.jclouds.aws.filters.FormSigner;
|
||||||
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
@ -71,31 +72,30 @@ public interface SpotInstanceAsyncClient {
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "DescribeSpotInstanceRequests")
|
@FormParams(keys = ACTION, values = "DescribeSpotInstanceRequests")
|
||||||
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
@ExceptionParser(ReturnEmptySetOnNotFoundOr404.class)
|
||||||
@XMLResponseParser(SpotInstanceRequestsResponseHandler.class)
|
@XMLResponseParser(SpotInstancesHandler.class)
|
||||||
ListenableFuture<? extends Set<SpotInstanceRequest>> describeSpotInstanceRequestsInRegion(
|
ListenableFuture<? extends Set<SpotInstanceRequest>> describeSpotInstanceRequestsInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@BinderParam(BindSpotInstanceRequestIdsToIndexedFormParams.class) String... requestIds);
|
@BinderParam(BindSpotInstanceRequestIdsToIndexedFormParams.class) String... requestIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SpotInstanceClient#requestSpotInstancesInRegion(String,float,String,String)
|
* @see SpotInstanceClient#requestSpotInstanceInRegion
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "RequestSpotInstances")
|
@FormParams(keys = ACTION, values = "RequestSpotInstances")
|
||||||
@XMLResponseParser(SpotInstanceRequestsResponseHandler.class)
|
@XMLResponseParser(SpotInstanceHandler.class)
|
||||||
ListenableFuture<? extends Set<SpotInstanceRequest>> requestSpotInstancesInRegion(
|
ListenableFuture<SpotInstanceRequest> requestSpotInstanceInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@FormParam("SpotPrice") float spotPrice, @FormParam("LaunchSpecification.ImageId") String imageId,
|
@FormParam("SpotPrice") float spotPrice, @FormParam("LaunchSpecification.ImageId") String imageId,
|
||||||
@FormParam("LaunchSpecification.InstanceType") String instanceType);
|
@FormParam("LaunchSpecification.InstanceType") String instanceType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SpotInstanceClient#requestSpotInstancesInRegion(String,float,int,
|
* @see SpotInstanceClient#requestSpotInstancesInRegion
|
||||||
* LaunchSpecification,RequestSpotInstancesOptions[])
|
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@Path("/")
|
@Path("/")
|
||||||
@FormParams(keys = ACTION, values = "RequestSpotInstances")
|
@FormParams(keys = ACTION, values = "RequestSpotInstances")
|
||||||
@XMLResponseParser(SpotInstanceRequestsResponseHandler.class)
|
@XMLResponseParser(SpotInstancesHandler.class)
|
||||||
ListenableFuture<? extends Set<SpotInstanceRequest>> requestSpotInstancesInRegion(
|
ListenableFuture<? extends Set<SpotInstanceRequest>> requestSpotInstancesInRegion(
|
||||||
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
@EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
|
||||||
@FormParam("SpotPrice") float spotPrice, @FormParam("InstanceCount") int instanceCount,
|
@FormParam("SpotPrice") float spotPrice, @FormParam("InstanceCount") int instanceCount,
|
||||||
|
|
|
@ -62,6 +62,24 @@ public interface SpotInstanceClient {
|
||||||
*/
|
*/
|
||||||
Set<SpotInstanceRequest> describeSpotInstanceRequestsInRegion(@Nullable String region, String... requestIds);
|
Set<SpotInstanceRequest> describeSpotInstanceRequestsInRegion(@Nullable String region, String... requestIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* request a single spot instance
|
||||||
|
*
|
||||||
|
* @param region
|
||||||
|
* Region where the spot instance service is running
|
||||||
|
* @param spotPrice
|
||||||
|
* Specifies the maximum hourly price for any Spot Instance launched to fulfill the
|
||||||
|
* request.
|
||||||
|
* @param imageId
|
||||||
|
* The AMI ID.
|
||||||
|
* @param instanceType
|
||||||
|
* The instance type (ex. m1.small)
|
||||||
|
* @return spot instance request
|
||||||
|
* @see #requestSpotInstancesInRegion
|
||||||
|
*/
|
||||||
|
SpotInstanceRequest requestSpotInstanceInRegion(@Nullable String region, float spotPrice, String imageId,
|
||||||
|
String instanceType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 starts on your
|
* Creates a Spot Instance request. Spot Instances are instances that Amazon EC2 starts on your
|
||||||
* behalf when the maximum price that you specify exceeds the current Spot Price. Amazon EC2
|
* behalf when the maximum price that you specify exceeds the current Spot Price. Amazon EC2
|
||||||
|
@ -74,10 +92,12 @@ public interface SpotInstanceClient {
|
||||||
* @param spotPrice
|
* @param spotPrice
|
||||||
* Specifies the maximum hourly price for any Spot Instance launched to fulfill the
|
* Specifies the maximum hourly price for any Spot Instance launched to fulfill the
|
||||||
* request.
|
* request.
|
||||||
* @param imageId
|
* @param instanceCount
|
||||||
* The AMI ID.
|
* number of instances to request
|
||||||
* @param instanceType
|
* @param launchSpec
|
||||||
* The instance type (ex. m1.small)
|
* includes at least The AMI ID and instance type (ex. m1.small)
|
||||||
|
* @param options
|
||||||
|
* options including expiration time or grouping
|
||||||
*
|
*
|
||||||
* @see #describeSpotInstanceRequestsInRegion
|
* @see #describeSpotInstanceRequestsInRegion
|
||||||
* @see #cancelSpotInstanceRequestsInRegion
|
* @see #cancelSpotInstanceRequestsInRegion
|
||||||
|
@ -85,10 +105,8 @@ public interface SpotInstanceClient {
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RequestSpotInstances.html"
|
* "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-RequestSpotInstances.html"
|
||||||
* />
|
* />
|
||||||
* @return TODO
|
* @return set of spot instance requests
|
||||||
*/
|
*/
|
||||||
Set<SpotInstanceRequest> requestSpotInstancesInRegion(@Nullable String region, float spotPrice, String imageId, String instanceType);
|
|
||||||
|
|
||||||
Set<SpotInstanceRequest> requestSpotInstancesInRegion(@Nullable String region, float spotPrice, int instanceCount,
|
Set<SpotInstanceRequest> requestSpotInstancesInRegion(@Nullable String region, float spotPrice, int instanceCount,
|
||||||
LaunchSpecification launchSpec, RequestSpotInstancesOptions... options);
|
LaunchSpecification launchSpec, RequestSpotInstancesOptions... options);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.xml.sax.Attributes;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SpotInstanceRequestHandler extends ParseSax.HandlerForGeneratedRequestWithResult<SpotInstanceRequest> {
|
public class SpotInstanceHandler extends ParseSax.HandlerForGeneratedRequestWithResult<SpotInstanceRequest> {
|
||||||
private StringBuilder currentText = new StringBuilder();
|
private StringBuilder currentText = new StringBuilder();
|
||||||
|
|
||||||
protected final DateService dateService;
|
protected final DateService dateService;
|
||||||
|
@ -43,7 +43,7 @@ public class SpotInstanceRequestHandler extends ParseSax.HandlerForGeneratedRequ
|
||||||
protected final LaunchSpecificationHandler launchSpecificationHandler;
|
protected final LaunchSpecificationHandler launchSpecificationHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SpotInstanceRequestHandler(DateService dateService, @Region String defaultRegion,
|
public SpotInstanceHandler(DateService dateService, @Region String defaultRegion,
|
||||||
LaunchSpecificationHandler launchSpecificationHandler, SpotInstanceRequest.Builder builder) {
|
LaunchSpecificationHandler launchSpecificationHandler, SpotInstanceRequest.Builder builder) {
|
||||||
this.dateService = dateService;
|
this.dateService = dateService;
|
||||||
this.defaultRegion = defaultRegion;
|
this.defaultRegion = defaultRegion;
|
|
@ -36,14 +36,14 @@ import com.google.common.collect.ImmutableSet.Builder;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class SpotInstanceRequestsResponseHandler extends ParseSax.HandlerWithResult<Set<SpotInstanceRequest>> {
|
public class SpotInstancesHandler extends ParseSax.HandlerWithResult<Set<SpotInstanceRequest>> {
|
||||||
|
|
||||||
private final Builder<SpotInstanceRequest> spotRequests = ImmutableSet.<SpotInstanceRequest> builder();
|
private final Builder<SpotInstanceRequest> spotRequests = ImmutableSet.<SpotInstanceRequest> builder();
|
||||||
private final SpotInstanceRequestHandler spotRequestHandler;
|
private final SpotInstanceHandler spotRequestHandler;
|
||||||
private int itemDepth;
|
private int itemDepth;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SpotInstanceRequestsResponseHandler(SpotInstanceRequestHandler spotRequestHandler) {
|
public SpotInstancesHandler(SpotInstanceHandler spotRequestHandler) {
|
||||||
this.spotRequestHandler = spotRequestHandler;
|
this.spotRequestHandler = spotRequestHandler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ import org.jclouds.aws.ec2.domain.LaunchSpecification;
|
||||||
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
import org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions;
|
||||||
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
import org.jclouds.aws.ec2.options.RequestSpotInstancesOptions;
|
||||||
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
import org.jclouds.aws.ec2.xml.DescribeSpotPriceHistoryResponseHandler;
|
||||||
import org.jclouds.aws.ec2.xml.SpotInstanceRequestsResponseHandler;
|
import org.jclouds.aws.ec2.xml.SpotInstanceHandler;
|
||||||
|
import org.jclouds.aws.ec2.xml.SpotInstancesHandler;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
@ -46,8 +47,8 @@ import com.google.inject.TypeLiteral;
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
||||||
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
||||||
public void testRequestSpotInstances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRequestSpotInstance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstancesInRegion", String.class,
|
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstanceInRegion", String.class,
|
||||||
float.class, String.class, String.class);
|
float.class, String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, 0.01f, "m1.small", "ami-voo");
|
HttpRequest request = processor.createRequest(method, null, 0.01f, "m1.small", "ami-voo");
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstanceRequestsResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, SpotInstanceHandler.class);
|
||||||
assertExceptionParserClassEquals(method, null);
|
assertExceptionParserClassEquals(method, null);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
@ -81,7 +82,7 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstanceRequestsResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
||||||
assertExceptionParserClassEquals(method, null);
|
assertExceptionParserClassEquals(method, null);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
@ -115,7 +116,7 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstanceRequestsResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
||||||
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
|
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
@ -134,7 +135,7 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, SpotInstanceRequestsResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, SpotInstancesHandler.class);
|
||||||
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
|
assertExceptionParserClassEquals(method, ReturnEmptySetOnNotFoundOr404.class);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
|
|
@ -158,11 +158,12 @@ public class SpotInstanceClientLiveTest {
|
||||||
if (launchGroup.equals(request.getLaunchGroup()))
|
if (launchGroup.equals(request.getLaunchGroup()))
|
||||||
client.getSpotInstanceServices().cancelSpotInstanceRequestsInRegion("us-west-1", request.getId());
|
client.getSpotInstanceServices().cancelSpotInstanceRequestsInRegion("us-west-1", request.getId());
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
|
|
||||||
requests = client.getSpotInstanceServices().requestSpotInstancesInRegion(
|
requests = client.getSpotInstanceServices().requestSpotInstancesInRegion(
|
||||||
"us-west-1",
|
"us-west-1",
|
||||||
0.03f,
|
0.03f,
|
||||||
1,
|
1,
|
||||||
LaunchSpecification.builder().instanceType(InstanceType.T1_MICRO).imageId("ami-595a0a1c").build(),
|
LaunchSpecification.builder().imageId("ami-595a0a1c").instanceType(InstanceType.T1_MICRO).build(),
|
||||||
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(new Date())
|
launchGroup(launchGroup).availabilityZoneGroup(launchGroup).validFrom(new Date())
|
||||||
.validUntil(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));
|
.validUntil(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(SPOT_DELAY_SECONDS))));
|
||||||
assertNotNull(requests);
|
assertNotNull(requests);
|
||||||
|
|
|
@ -43,13 +43,13 @@ import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code SpotInstanceRequestHandler}
|
* Tests behavior of {@code SpotInstanceHandler}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "SpotInstanceRequestHandlerTest")
|
@Test(groups = "unit", testName = "SpotInstanceHandlerTest")
|
||||||
public class SpotInstanceRequestHandlerTest extends BaseEC2HandlerTest {
|
public class SpotInstanceHandlerTest extends BaseEC2HandlerTest {
|
||||||
|
|
||||||
private DateService dateService;
|
private DateService dateService;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class SpotInstanceRequestHandlerTest extends BaseEC2HandlerTest {
|
||||||
.mapEphemeralDeviceToDevice("/dev/sda3", "vre1").monitoringEnabled(false).build())
|
.mapEphemeralDeviceToDevice("/dev/sda3", "vre1").monitoringEnabled(false).build())
|
||||||
.createTime(new SimpleDateFormatDateService().iso8601DateParse("2011-03-08T03:30:36.000Z"))
|
.createTime(new SimpleDateFormatDateService().iso8601DateParse("2011-03-08T03:30:36.000Z"))
|
||||||
.productDescription("Linux/UNIX").build();
|
.productDescription("Linux/UNIX").build();
|
||||||
SpotInstanceRequestHandler handler = injector.getInstance(SpotInstanceRequestHandler.class);
|
SpotInstanceHandler handler = injector.getInstance(SpotInstanceHandler.class);
|
||||||
addDefaultRegionToHandler(handler);
|
addDefaultRegionToHandler(handler);
|
||||||
SpotInstanceRequest result = factory.create(handler).parse(is);
|
SpotInstanceRequest result = factory.create(handler).parse(is);
|
||||||
assertEquals(result, expected);
|
assertEquals(result, expected);
|
|
@ -42,13 +42,13 @@ import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code SpotInstancesRequestsResponseHandler}
|
* Tests behavior of {@code SpotInstancesHandler}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "SpotInstancesRequestsResponseHandlerTest")
|
@Test(groups = "unit", testName = "SpotInstancesHandlerTest")
|
||||||
public class SpotInstancesRequestsResponseHandlerTest extends BaseEC2HandlerTest {
|
public class SpotInstancesHandlerTest extends BaseEC2HandlerTest {
|
||||||
|
|
||||||
private DateService dateService;
|
private DateService dateService;
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ public class SpotInstancesRequestsResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
public void testDescribe() {
|
public void testDescribe() {
|
||||||
|
|
||||||
InputStream is = getClass().getResourceAsStream("/describe_spot_instance_requests.xml");
|
InputStream is = getClass().getResourceAsStream("/describe_spot_instance_requests.xml");
|
||||||
SpotInstanceRequestsResponseHandler handler = injector
|
SpotInstancesHandler handler = injector
|
||||||
.getInstance(SpotInstanceRequestsResponseHandler.class);
|
.getInstance(SpotInstancesHandler.class);
|
||||||
addDefaultRegionToHandler(handler);
|
addDefaultRegionToHandler(handler);
|
||||||
Set<SpotInstanceRequest> result = factory.create(handler).parse(is);
|
Set<SpotInstanceRequest> result = factory.create(handler).parse(is);
|
||||||
assertEquals(result.size(), 18);
|
assertEquals(result.size(), 18);
|
||||||
|
@ -79,8 +79,8 @@ public class SpotInstancesRequestsResponseHandlerTest extends BaseEC2HandlerTest
|
||||||
public void testRequest() {
|
public void testRequest() {
|
||||||
|
|
||||||
InputStream is = getClass().getResourceAsStream("/request_spot_instances.xml");
|
InputStream is = getClass().getResourceAsStream("/request_spot_instances.xml");
|
||||||
SpotInstanceRequestsResponseHandler handler = injector
|
SpotInstancesHandler handler = injector
|
||||||
.getInstance(SpotInstanceRequestsResponseHandler.class);
|
.getInstance(SpotInstancesHandler.class);
|
||||||
addDefaultRegionToHandler(handler);
|
addDefaultRegionToHandler(handler);
|
||||||
Set<SpotInstanceRequest> result = factory.create(handler).parse(is);
|
Set<SpotInstanceRequest> result = factory.create(handler).parse(is);
|
||||||
assertEquals(result.size(), 3);
|
assertEquals(result.size(), 3);
|
Loading…
Reference in New Issue