Package org.jclouds.ec2.domain

Examples of org.jclouds.ec2.domain.RunningInstance


   @Test
   public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFound() throws UnknownHostException {
      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
               .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());

      RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");

      assertEquals(parser.apply(server).toString(),
            new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
                  .publicAddresses(ImmutableSet.<String> of()).privateAddresses(ImmutableSet.of("10.243.42.70"))
                  .publicAddresses(ImmutableSet.of("174.129.81.68")).imageId("us-east-1/ami-82e4b5c7")
View Full Code Here


   @Test
   public void testApplyWhereTagDoesntMatchAndLocationFoundAndImageAndHardwareNotFound() throws UnknownHostException {
      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
               ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of());

      RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");
      NodeMetadata expected = new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
               .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
               .imageId("us-east-1/ami-82e4b5c7").id("us-east-1/i-0799056f").providerId("i-0799056f")
               .location(provider).build();
View Full Code Here

   @Test
   public void testApplyWhereTagDoesntMatchAndImageAndLocationFoundAndHardwareNotFound() throws UnknownHostException {
      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet.of(provider),
               EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap.<String, Credentials> of());

      RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");

      assertEquals(
            parser.apply(server).toString(),
            new NodeMetadataBuilder()
                  .status(Status.RUNNING).backendStatus("running")
View Full Code Here

   public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationFound() throws UnknownHostException {
      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
               .of(provider), EC2ImageParserTest.convertImages("/amzn_images.xml"), ImmutableMap
               .<String, Credentials> of());

      RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");

      assertEquals(
            parser.apply(server).toString(),
            new NodeMetadataBuilder()
                  .hostname("ip-10-243-42-70")
View Full Code Here

      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.of(m1_small().build()), ImmutableSet
               .of(provider), ImmutableMap.<String, Credentials> of(),
               EC2ComputeServiceDependenciesModule.toPortableNodeStatus, instanceToImage);

      RunningInstance server = firstInstanceFromResource("/describe_instances_running.xml");

      assertEquals(
            parser.apply(server).toString(),
            new NodeMetadataBuilder().hostname("ip-10-243-42-70").status(Status.RUNNING).backendStatus("running")
                  .privateAddresses(ImmutableSet.of("10.243.42.70")).publicAddresses(ImmutableSet.of("174.129.81.68"))
View Full Code Here

      for (String region : view.unwrapApi(EC2Api.class).getAvailabilityZoneAndRegionApi().get().describeRegions().keySet()) {
         Set<? extends Reservation<? extends RunningInstance>> allResults = client.describeInstancesInRegion(region);
         assertNotNull(allResults);

         if (!allResults.isEmpty())  {
            RunningInstance instance = getFirst(getFirst(allResults, null), null);

            assertNotNull(instance);

            Set<? extends Reservation<? extends RunningInstance>> filterResults = client.describeInstancesInRegionWithFilter(region,
                    ImmutableMultimap.<String, String>builder()
                            .put("key-name", instance.getKeyName())
                            .build());

            assertNotNull(filterResults);
            assertTrue(!filterResults.isEmpty(), "No results found for filter, but there should be.");
View Full Code Here


      EC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse,
              filter, filterResponse);

      RunningInstance instance = getOnlyElement(getOnlyElement(apiWhenExist.getInstanceApi().get().describeInstancesInRegionWithFilter("us-east-1",
              ImmutableMultimap.<String, String>builder()
                      .put("key-name", "adriancole.ec21")
                      .build())));
      assertNotNull(instance, "Instance should not be null");

      Assert.assertEquals(instance.getId(), "i-0799056f");
   }
View Full Code Here

      Set<? extends Reservation<? extends RunningInstance>> response = client.describeInstancesInRegion("nova");
     
      assertEquals(response.size(), 3);

      Reservation<? extends RunningInstance> target = Iterables.get(response, 2);
      RunningInstance runningInstance = Iterables.getOnlyElement(target);
      BlockDevice bd = Iterables.getOnlyElement(runningInstance.getEbsBlockDevices().values());
     
      // this is a '-' in the nova_ec2_describe_instances.xml
      assertNull(bd.getAttachTime());

      // double-check the other fields
View Full Code Here

   // terminates the instance.
   private Snapshot createSnapshot() throws RunNodesException {

      String instanceId = null;
      try {
         RunningInstance instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().runInstancesInRegion(
               regionId, null, imageId, 1, 1)));
         instanceId = instance.getId();
        
         assertTrue(runningTester.apply(instance), instanceId + "didn't achieve the state running!");

         instance = getOnlyElement(concat(ec2Api.getInstanceApi().get().describeInstancesInRegion(regionId,
               instanceId)));
         BlockDevice device = instance.getEbsBlockDevices().get("/dev/sda1");
         assertNotNull(device, "device: /dev/sda1 not present on: " + instance);
         Snapshot snapshot = ec2Api.getElasticBlockStoreApi().get().createSnapshotInRegion(regionId,
               device.getVolumeId());
         snapshotsToDelete.add(snapshot.getId());
         return snapshot;
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.getElasticIPAddressApi().get().allocateAddressInRegion(id.getRegion());
            // block until instance is running
            logger.debug(">> awaiting status running instance(%s)", id);
View Full Code Here

TOP

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

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.