Package org.jclouds.domain

Examples of org.jclouds.domain.LoginCredentials


   }

   @Test
   public void testRefreshUpdatesAtomicReferenceOnRecheckPendingAcceptsNewCredentials() {
      LoginCredentials creds = LoginCredentials.builder().user("user").password("password").build();
      NodeMetadata newNode = new NodeMetadataBuilder().id("myid").status(Status.UNRECOGNIZED).credentials(creds).build();

      LoginCredentials creds2 = LoginCredentials.builder().user("user").password("password2").build();

      NodeMetadata pending = new NodeMetadataBuilder().id("myid").status(Status.PENDING).credentials(creds2).build();
     
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);
View Full Code Here


   }

   public void testWhenCredentialsNotPresentAndJcloudsPropertyHasUserAndPasswordAndSudo() {
      @SuppressWarnings("unchecked")
      Map<String, Credentials> credstore = createMock(Map.class);
      LoginCredentials expected = LoginCredentials.builder().user("ubuntu").password("password").authenticateSudo(true)
            .build();

      ValueOfConfigurationKeyOrNull config = createMock(ValueOfConfigurationKeyOrNull.class);

      expect(credstore.containsKey("image")).andReturn(false);
View Full Code Here

   }

   public void testWhenCredentialsNotPresentAndProviderPropertyHasUserAndPasswordAndSudo() {
      @SuppressWarnings("unchecked")
      Map<String, Credentials> credstore = createMock(Map.class);
      LoginCredentials expected = LoginCredentials.builder().user("ubuntu").password("password").authenticateSudo(true)
            .build();

      ValueOfConfigurationKeyOrNull config = createMock(ValueOfConfigurationKeyOrNull.class);

      expect(credstore.containsKey("image")).andReturn(false);
View Full Code Here

      String group = "group";
      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();

      // create mocks
      CreateNewKeyPairUnlessUserSpecifiedOtherwise strategy = setupStrategy();
      LoginCredentials keyPairCredentials = LoginCredentials.builder().privateKey(KeyPairHandlerTest.keyPair.getPrivateKey()).build();

      // setup expectations
      expect(strategy.credentialStore.containsKey("group#group")).andReturn(true);
      expect(strategy.credentialStore.get("group#group")).andReturn(keyPairCredentials);
View Full Code Here

      String systemGeneratedFingerprint = "systemGeneratedKeyPairfinger";
      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();

      // create mocks
      CreateNewKeyPairUnlessUserSpecifiedOtherwise strategy = setupStrategy();
      LoginCredentials keyPairCredentials = LoginCredentials.builder().privateKey(KeyPairHandlerTest.keyPair.getPrivateKey()).build();
      KeyPair keyPair = createMock(KeyPair.class);

      // setup expectations
      expect(strategy.credentialStore.containsKey("group#group")).andReturn(false);
      expect(strategy.createUniqueKeyPair.apply(new OrgAndName(org, "group"))).andReturn(keyPair);
View Full Code Here

   }

   public void testLoginConsistentAcrossMultipleInjectorsAndLooksNice() throws IOException {
      Map<String, InputStream> map = getMap(createInjector());
      LoginCredentials creds = LoginCredentials.builder().user("user").password("pass").build();
      put(map, getStore(createInjector()), "test", creds);
      checkConsistent(map, getStore(createInjector()), "test", creds, "{\"user\":\"user\",\"password\":\"pass\"}");
      checkConsistent(map, getStore(createInjector()), "test", creds, "{\"user\":\"user\",\"password\":\"pass\"}");
      remove(map, getStore(createInjector()), "test");
   }
View Full Code Here

      remove(map, getStore(createInjector()), "test");
   }

   public void testLoginConsistentAcrossMultipleInjectorsAndLooksNiceWithSudo() throws IOException {
      Map<String, InputStream> map = getMap(createInjector());
      LoginCredentials creds = LoginCredentials.builder().user("user").password("pass").authenticateSudo(true).build();
      put(map, getStore(createInjector()), "test", creds);
      checkConsistent(map, getStore(createInjector()), "test", creds,
            "{\"user\":\"user\",\"password\":\"pass\",\"authenticateSudo\":true}");
      checkConsistent(map, getStore(createInjector()), "test", creds,
            "{\"user\":\"user\",\"password\":\"pass\",\"authenticateSudo\":true}");
View Full Code Here

      TemplateOptions options = client.templateOptions().blockOnPort(22, 120);
      try {
         Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, options);
         NodeMetadata node = get(nodes, 0);
         LoginCredentials good = node.getCredentials();
         assert good.identity != null : nodes;
         assert good.credential != null : nodes;

         for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
               runningInGroup(group), "hostname",
View Full Code Here

      checkNotNull(name, "name should have %s encoded into it", group);
      checkNotNull(template, "template was null");
      checkNotNull(template.getOptions(), "template options was null");

      NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
      LoginCredentials fromNode = from.getCredentials();
      LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
      String credsKey = "node#" + from.getNodeId();
      if (creds != null) {
         credentialStore.put(credsKey, creds);
      } else {
         logger.trace("node(%s) creation did not return login credentials", from.getNodeId());
View Full Code Here

         authenticateSudo = config.apply("jclouds.image.authenticate-sudo");
      if (authenticateSudo != null) {
         builder.authenticateSudo(Boolean.valueOf(authenticateSudo));
      }

      LoginCredentials creds = builder.build();
      if (creds != null)
         credentialStore.put("image", creds);
      return creds;
   }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LoginCredentials

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.