Examples of EC2Api


Examples of org.jclouds.ec2.EC2Api

   public void testConditionallyDeleteWhenResponseIs2xx() throws Exception {

      HttpResponse conditionallyDeleteResponse = HttpResponse.builder().statusCode(200).build();

      EC2Api apiWhenExist = requestSendsResponse(conditionallyDelete, conditionallyDeleteResponse);

      apiWhenExist.getTagApi().get().conditionallyDeleteFromResources(ImmutableMap.of("tag", "value"), ImmutableSet.of("i-43532"));
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   @Test(expectedExceptions = ResourceNotFoundException.class)
   public void testConditionallyDeleteWhenResponseIs404() throws Exception {

      HttpResponse conditionallyDeleteResponse = HttpResponse.builder().statusCode(404).build();

      EC2Api apiWhenDontExist = requestSendsResponse(conditionallyDelete, conditionallyDeleteResponse);

      apiWhenDontExist.getTagApi().get().conditionallyDeleteFromResources(ImmutableMap.of("tag", "value"), ImmutableSet.of("i-43532"));
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   public void testGetPasswordDataWhenResponseIs2xx() throws Exception {

      HttpResponse getResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResourceWithContentType("/get_passworddata.xml", "text/xml")).build();

      EC2Api apiWhenExist = requestSendsResponse(get, getResponse);

      assertEquals(apiWhenExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a").toString(), new GetPasswordDataResponseTest().expected().toString());
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   public void testGetPasswordDataWhenResponseIs404() throws Exception {

      HttpResponse getResponse = HttpResponse.builder().statusCode(404).build();

      EC2Api apiWhenDontExist = requestSendsResponse(get, getResponse);

      assertNull(apiWhenDontExist.getWindowsApi().get().getPasswordDataForInstance("i-2574e22a"));
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   public void testListWhenResponseIs2xx() throws Exception {

      HttpResponse listResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResourceWithContentType("/describe_subnets.xml", "text/xml")).build();

      EC2Api apiWhenExist = requestSendsResponse(
            list, listResponse);

      assertEquals(apiWhenExist.getSubnetApi().get().list().toString(), new DescribeSubnetsResponseTest().expected().toString());
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   public void testListWhenResponseIs404() throws Exception {

      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

      EC2Api apiWhenDontExist = requestSendsResponse(
            list, listResponse);

      assertEquals(apiWhenDontExist.getSubnetApi().get().list().toSet(), ImmutableSet.of());
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

   public void testFilterWhenResponseIs2xx() throws Exception {
     
      HttpResponse filterResponse = HttpResponse.builder().statusCode(200)
               .payload(payloadFromResourceWithContentType("/describe_subnets.xml", "text/xml")).build();

      EC2Api apiWhenExist = requestSendsResponse(filter, filterResponse);

      assertEquals(apiWhenExist.getSubnetApi().get().filter(ImmutableMultimap.<String, String> builder()
                                                         .put("subnet-id", "subnet-9d4a7b6c")
                                                         .build()).toString(),
               new DescribeSubnetsResponseTest().expected().toString());
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

  
   public void testFilterWhenResponseIs404() throws Exception {

      HttpResponse filterResponse = HttpResponse.builder().statusCode(404).build();

      EC2Api apiWhenDontExist = requestSendsResponse(filter, filterResponse);

      assertEquals(apiWhenDontExist.getSubnetApi().get().filter(ImmutableMultimap.<String, String> builder()
                                                                .put("subnet-id", "subnet-9d4a7b6c")
                                                                .build()).toSet(), ImmutableSet.of());
   }
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

      verify(strategy.utils);
   }

   @SuppressWarnings("unchecked")
   private EC2CreateNodesInGroupThenAddToSet setupStrategy(final NodeMetadata node) {
      EC2Api client = createMock(EC2Api.class);
      CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
      PresentInstances presentInstances = createMock(PresentInstances.class);
      RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
      LoadingCache<RunningInstance, Optional<LoginCredentials>> instanceToCredentials = createMock(LoadingCache.class);
      LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
View Full Code Here

Examples of org.jclouds.ec2.EC2Api

         assertFalse(InetAddresses2.isPrivateIPAddress(ip));
         HostAndPort socket = HostAndPort.fromParts(ip, 22);
         assertTrue(socketTester.apply(socket), String.format("failed to open socket %s on node %s", socket, node));

         // check that there is an elastic ip correlating to it
         EC2Api ec2 = context.unwrapApi(EC2Api.class);
         Set<PublicIpInstanceIdPair> ipidpairs =
               ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, publicIps.toArray(new String[0]));
         assertEquals(ipidpairs.size(), 1, String.format("there should only be one address pair (%s)",
               Iterables.toString(ipidpairs)));

         // check that the elastic ip is in node.publicAddresses
         PublicIpInstanceIdPair ipidpair = Iterables.get(ipidpairs, 0);
         assertEquals(region + "/" + ipidpair.getInstanceId(), node.getId());
        
         // delete the node
         context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));

         // check that the ip is deallocated
         Set<PublicIpInstanceIdPair> ipidcheck =
                 ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, ipidpair.getPublicIp());
         assertTrue(Iterables.isEmpty(ipidcheck), String.format("there should be no address pairs (%s)",
               Iterables.toString(ipidcheck)));
      } finally {
         context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
         if (context != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.