Package org.jclouds.aws.ec2.compute.domain

Examples of org.jclouds.aws.ec2.compute.domain.RegionAndName


      ElasticIPAddressApi ipClient = createMock(ElasticIPAddressApi.class);
      InstanceApi instanceClient = createMock(InstanceApi.class);

      NodeMetadata node = createMock(NodeMetadata.class);

      expect(elasticIpCache.get(new RegionAndName("region", "i-blah"))).andThrow(new ExecutionException(null));

      expect(client.getInstanceApi()).andReturn((Optional) Optional.of(instanceClient)).atLeastOnce();
      expect(instanceClient.terminateInstancesInRegion("region", "i-blah")).andReturn(null);
      expect(getNode.getNode("region/i-blah")).andReturn(node);
View Full Code Here


         public Supplier<CacheLoader<RegionAndName, Image>> provideRegionAndNameToImageSupplierCacheLoader(RegionAndIdToImage delegate) {
            return super.provideRegionAndNameToImageSupplierCacheLoader(delegate);
         }
      };
     
      RegionAndName regionAndName = new RegionAndName("myregion", "myname");
      AuthorizationException authException = new AuthorizationException();
     
      RegionAndIdToImage mockRegionAndIdToImage = createMock(RegionAndIdToImage.class);
      expect(mockRegionAndIdToImage.load(regionAndName)).andThrow(authException).once();
      replay(mockRegionAndIdToImage);
View Full Code Here

      requestResponseMap.put(describeInstanceRequest, describeInstanceWithSGResponse);
     

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
     
      Set<SecurityGroup> groups = extension.listSecurityGroupsForNode(new RegionAndName(region, "i-2baa5550").slashEncode());
      assertEquals(1, groups.size());
   }
View Full Code Here

      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);
     

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
     
      SecurityGroup group = extension.getSecurityGroupById(new RegionAndName(region, "jclouds#some-group").slashEncode());
      assertEquals("sg-3c6ef654", group.getProviderId());
      assertEquals(region + "/jclouds#some-group", group.getId());
   }
View Full Code Here

      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);
     

      SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get();
     
      assertTrue(extension.removeSecurityGroup(new RegionAndName(region, "jclouds#some-group").slashEncode()));
   }
View Full Code Here

            .providerId("i-911444f0").tags(ImmutableSet.of("Empty")).userMetadata(ImmutableMap.of("Name", "foo"))
            .build();

   @Test
   public void testReturnsNodeWithElasticIpWhenFoundInCacheAndNodeHadAPublicIp() throws Exception {
      RegionAndName key = new RegionAndName("us-east-1", node.getProviderId());
      String val = "1.1.1.1";
      LoadingCache<RegionAndName, String> cache = cacheOf(key, val);

      AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache);
View Full Code Here

      assertEquals(fn.apply(node).getPublicAddresses(), ImmutableSet.of("1.1.1.1"));
   }

   @Test
   public void testReturnsNodeWithIpWhenFoundInCacheAndNodeHadNoPublicIp() throws Exception {
      RegionAndName key = new RegionAndName("us-east-1", node.getProviderId());
      String val = "1.1.1.1";
      LoadingCache<RegionAndName, String> cache = cacheOf(key, val);

      AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache);
View Full Code Here

               .getPublicAddresses(), ImmutableSet.of("1.1.1.1"));
   }

   @Test
   public void testReturnsSameNodeWhenNotFoundInCache() throws Exception {
      RegionAndName key = new RegionAndName("us-east-1", node.getProviderId());
      String val = null;
      LoadingCache<RegionAndName, String> cache = cacheOf(key, val);

      AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache);
View Full Code Here

      expect(options.getLoginPassword()).andReturn(null);
      expect(options.getLoginPrivateKey()).andReturn(null);
      expect(options.shouldAuthenticateSudo()).andReturn(null);
      expect(options.getRunScript()).andReturn(Statements.exec("echo foo"));

      expect(strategy.credentialsMap.containsKey(new RegionAndName(region, userSuppliedKeyPair))).andReturn(false);

      // replay mocks
      replay(options);
      replay(keyPair);
      replayStrategy(strategy);
View Full Code Here

      // setup expectations
      expect(options.getKeyPair()).andReturn(userSuppliedKeyPair);
      expect(options.getLoginPrivateKey()).andReturn(null);
      expect(options.getRunScript()).andReturn(Statements.exec("echo foo"));

      expect(strategy.credentialsMap.containsKey(new RegionAndName(region, userSuppliedKeyPair))).andReturn(true);

      // replay mocks
      replay(options);
      replay(keyPair);
      replayStrategy(strategy);
View Full Code Here

TOP

Related Classes of org.jclouds.aws.ec2.compute.domain.RegionAndName

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.