Package org.jclouds.ec2.domain

Examples of org.jclouds.ec2.domain.ReservedInstancesOffering


   public ReservedInstancesOffering getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();

      ReservedInstancesOffering returnVal = new ReservedInstancesOffering(region, availabilityZone, duration,
            fixedPrice, instanceType, productDescription, id, usagePrice);
      this.availabilityZone = null;
      this.duration = 0;
      this.fixedPrice = 0;
      this.instanceType = null;
View Full Code Here


   public ReservedInstancesOffering getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();

      ReservedInstancesOffering returnVal = new ReservedInstancesOffering(region, availabilityZone, duration,
            fixedPrice, instanceType, productDescription, id, usagePrice);
      this.availabilityZone = null;
      this.duration = 0;
      this.fixedPrice = 0;
      this.instanceType = null;
View Full Code Here

@Test(groups = "unit", testName = "DescribeReservedInstancesOfferingResponseHandlerTest")
public class DescribeReservedInstancesOfferingResponseHandlerTest extends BaseEC2HandlerTest {
   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/describe_reserved_instances_offerings.xml");

      ReservedInstancesOffering expected = new ReservedInstancesOffering("us-east-1", "us-east-1a", 12, 0.0f, "m1.small",
            "m1.small offering in us-east-1a", "4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8", 0.0f);

      DescribeReservedInstancesOfferingResponseHandler handler = injector
            .getInstance(DescribeReservedInstancesOfferingResponseHandler.class);
      addDefaultRegionToHandler(handler);
      ReservedInstancesOffering result = Iterables.getOnlyElement(factory.create(handler).parse(is));

      assertEquals(result, expected);
   }
View Full Code Here

   public ReservedInstancesOffering getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();

      ReservedInstancesOffering returnVal = new ReservedInstancesOffering(region, availabilityZone, duration,
            fixedPrice, instanceType, productDescription, id, usagePrice);
      this.availabilityZone = null;
      this.duration = 0;
      this.fixedPrice = 0;
      this.instanceType = null;
View Full Code Here

@Test(groups = "unit", testName = "DescribeReservedInstancesOfferingResponseHandlerTest")
public class DescribeReservedInstancesOfferingResponseHandlerTest extends BaseEC2HandlerTest {
   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/describe_reserved_instances_offerings.xml");

      ReservedInstancesOffering expected = new ReservedInstancesOffering("us-east-1", "us-east-1a", 12, 0.0f, "m1.small",
            "m1.small offering in us-east-1a", "4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8", 0.0f);

      DescribeReservedInstancesOfferingResponseHandler handler = injector
            .getInstance(DescribeReservedInstancesOfferingResponseHandler.class);
      addDefaultRegionToHandler(handler);
      ReservedInstancesOffering result = Iterables.getOnlyElement(factory.create(handler).parse(is));

      assertEquals(result, expected);
   }
View Full Code Here

   public ReservedInstancesOffering getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();

      ReservedInstancesOffering returnVal = new ReservedInstancesOffering(region, availabilityZone, duration,
            fixedPrice, instanceType, productDescription, id, usagePrice);
      this.availabilityZone = null;
      this.duration = 0;
      this.fixedPrice = 0;
      this.instanceType = null;
View Full Code Here

      checkNotNull(id, "id");
      String[] parts = AWSUtils.parseHandle(id);
      String region = parts[0];
      String instanceId = parts[1];
      try {
         RunningInstance runningInstance = getRunningInstanceInRegion(region, instanceId);
         return runningInstanceToNodeMetadata.apply(runningInstance);
      } catch (NoSuchElementException e) {
         return null;
      }
   }
View Full Code Here

   private void blockUntilRunningAndAssignElasticIpsToInstancesOrPutIntoBadMap(Set<RunningInstance> input,
         Map<NodeMetadata, Exception> badNodes) {
      Map<RegionAndName, RunningInstance> instancesById = Maps.uniqueIndex(input, instanceToRegionAndName);
      for (Map.Entry<RegionAndName, RunningInstance> entry : instancesById.entrySet()) {
         RegionAndName id = entry.getKey();
         RunningInstance instance = entry.getValue();
         try {
            logger.debug("<< allocating elastic IP instance(%s)", id);
            String ip = client.getElasticIPAddressServices().allocateAddressInRegion(id.getRegion());
            // block until instance is running
            logger.debug(">> awaiting status running instance(%s)", id);
View Full Code Here

   void testDescribe() {
      for (String region : ec2Client.getConfiguredRegions()) {
         Set<SecurityGroup> allResults = client.describeSecurityGroupsInRegion(region);
         assertNotNull(allResults);
         if (allResults.size() >= 1) {
            final SecurityGroup group = getLast(allResults);
            // in case there are multiple groups with the same name, which is the case with VPC
            ImmutableSet<SecurityGroup> expected = FluentIterable.from(allResults)
                  .filter(new Predicate<SecurityGroup>() {
                     @Override
                     public boolean apply(SecurityGroup in) {
                        return group.getName().equals(in.getName());
                     }
                  }).toSet();
            ImmutableSet<SecurityGroup> result = ImmutableSet.copyOf(client.describeSecurityGroupsInRegion(region,
                  group.getName()));
            // the above command has a chance of returning less groups than the original
            assertTrue(expected.containsAll(result));
         }
      }
   }
View Full Code Here

   private void verifySecurityGroup(String groupName, String description) {
      Set<SecurityGroup> oneResult = client.describeSecurityGroupsInRegion(null, groupName);
      assertNotNull(oneResult);
      assertEquals(oneResult.size(), 1);
      SecurityGroup listPair = oneResult.iterator().next();
      assertEquals(listPair.getName(), groupName);
      assertEquals(listPair.getDescription(), description);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.ec2.domain.ReservedInstancesOffering

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.