Package org.jclouds.ec2.domain

Examples of org.jclouds.ec2.domain.PasswordData


      // password, and returns true if there is password data available.
      Predicate<String> passwordReady = new Predicate<String>() {
         @Override
         public boolean apply(@Nullable String s) {
            if (Strings.isNullOrEmpty(s)) return false;
            PasswordData data = ec2Client.getWindowsServices().getPasswordDataInRegion(region, s);
            if (data == null) return false;
            return !Strings.isNullOrEmpty(data.getPasswordData());
         }
      };

      // Now wait, using RetryablePredicate
      final int maxWait = 600;
View Full Code Here


   protected final DateService dateService = new SimpleDateFormatDateService();

   public void test() {
      InputStream is = getClass().getResourceAsStream("/get_passworddata.xml");

      PasswordData expected = expected();

      GetPasswordDataResponseHandler handler = injector.getInstance(GetPasswordDataResponseHandler.class);
      PasswordData result = factory.create(handler).parse(is);

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

   @Test
   public void testApply() throws Exception {
      WindowsLoginCredentialsFromEncryptedData f = new WindowsLoginCredentialsFromEncryptedData(new JCECrypto());

      PasswordData passwordData = PasswordData.builder()
                                              .instanceId("i-2574e22a")
                                              .timestamp(dateService.iso8601DateParse("2012-07-30T07:27:23.000+0000"))
                                              .passwordData(ENCRYPTED_PASSWORD).build();

      LoginCredentials credentials = f.apply(new PasswordDataAndPrivateKey(passwordData, PRIVATE_KEY));
View Full Code Here

      // password, and returns true if there is password data available.
      Predicate<String> passwordReady = new Predicate<String>() {
         @Override
         public boolean apply(@Nullable String s) {
            if (Strings.isNullOrEmpty(s)) return false;
            PasswordData data = ec2Client.getWindowsServices().getPasswordDataInRegion(region, s);
            if (data == null) return false;
            return !Strings.isNullOrEmpty(data.getPasswordData());
         }
      };

      // Now wait, using RetryablePredicate
      final int maxWait = 600;
View Full Code Here

   protected final DateService dateService = new SimpleDateFormatDateService();

   public void test() {
      InputStream is = getClass().getResourceAsStream("/get_passworddata.xml");

      PasswordData expected = expected();

      GetPasswordDataResponseHandler handler = injector.getInstance(GetPasswordDataResponseHandler.class);
      PasswordData result = factory.create(handler).parse(is);

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

   @Test
   public void testApply() throws Exception {
      WindowsLoginCredentialsFromEncryptedData f = new WindowsLoginCredentialsFromEncryptedData(new JCECrypto());

      PasswordData passwordData = PasswordData.builder()
                                              .instanceId("i-2574e22a")
                                              .timestamp(dateService.iso8601DateParse("2012-07-30T07:27:23.000+0000"))
                                              .passwordData(ENCRYPTED_PASSWORD).build();

      LoginCredentials credentials = f.apply(new PasswordDataAndPrivateKey(passwordData, PRIVATE_KEY));
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.PasswordData

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.