Examples of OrgAndName


Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

      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);
      expect(keyPair.getFingerPrint()).andReturn(KeyPairHandlerTest.keyPair.getFingerPrint()).atLeastOnce();
      expect(strategy.credentialStore.put("group#group", keyPairCredentials)).andReturn(null);

      // replay mocks
      replay(keyPair);
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

               checkState(creds.getOptionalPrivateKey().isPresent(),
                        "incorrect state: should have private key for: %s", creds);
               options.sshKeyFingerprint(SshKeys.fingerprintPrivateKey(creds.getPrivateKey()));
            } else {
               // otherwise create a new keypair and key it under the group
               KeyPair keyPair = createUniqueKeyPair.apply(new OrgAndName(org, group));
               credentialStore.put("group#" + group, LoginCredentials.builder().user(identity).privateKey(
                        keyPair.getPrivateKey()).build());
               options.sshKeyFingerprint(keyPair.getFingerPrint());
            }
         }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

      if (from.getGroup() != null) {
         Org org = client.findOrgNamed(vdcToOrg.get().get(from.getLocation().getId()));
         if (org == null) {
            logger.warn("did not find an association for vdc %s in %s", from.getLocation().getId(), vdcToOrg);
         } else {
            return new OrgAndName(org.getHref(), from.getGroup());
         }
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenStillRunningWithTag() {
      // create mocks
      CleanupOrphanKeys strategy = setupStrategy();
      NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
      Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
      OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");

      // setup expectations
      expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
      expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
               .andReturn(ImmutableSet.of(nodeMetadata));
      expect(nodeMetadata.getGroup()).andReturn(orgTag.getName()).atLeastOnce();
      expect(nodeMetadata.getStatus()).andReturn(Status.RUNNING).atLeastOnce();
      expectCleanupCredentialStore(strategy, nodeMetadata);

      // replay mocks
      replay(nodeMetadata);
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenTerminatedWithTag() {
      // create mocks
      CleanupOrphanKeys strategy = setupStrategy();
      NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
      Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
      OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");

      // setup expectations
      expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
      expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
               .andReturn(ImmutableSet.of(nodeMetadata));
      expect(nodeMetadata.getGroup()).andReturn(orgTag.getName()).atLeastOnce();
      expect(nodeMetadata.getStatus()).andReturn(Status.TERMINATED).atLeastOnce();
      strategy.deleteKeyPair.execute(orgTag);
      expectCleanupCredentialStore(strategy, nodeMetadata);

      // replay mocks
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenNoneLeftWithTag() {
      // create mocks
      CleanupOrphanKeys strategy = setupStrategy();
      NodeMetadata nodeMetadata = createMock(NodeMetadata.class);
      Iterable<? extends NodeMetadata> deadOnes = ImmutableSet.<NodeMetadata> of(nodeMetadata);
      OrgAndName orgTag = new OrgAndName(URI.create("location"), "group");

      // setup expectations
      expect(strategy.nodeToOrgAndName.apply(nodeMetadata)).andReturn(orgTag).atLeastOnce();
      expect((Object) strategy.listNodes.listDetailsOnNodesMatching(parentLocationId(orgTag.getOrg().toASCIIString())))
               .andReturn(ImmutableSet.of());
      strategy.deleteKeyPair.execute(orgTag);
      expectCleanupCredentialStore(strategy, nodeMetadata);

      // replay mocks
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenNoKeyPairsInOrg() {
      URI org = URI.create("org1");

      // setup constants
      OrgAndName orgTag = new OrgAndName(org, "tag");

      // create mocks
      DeleteKeyPair strategy = setupStrategy();

      // setup expectations
      expect(strategy.terremarkClient.listKeyPairsInOrg(orgTag.getOrg())).andReturn(ImmutableSet.<KeyPair> of());

      // replay mocks
      replayStrategy(strategy);

      // run
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenKeyPairMatches() {
      URI org = URI.create("org1");

      // setup constants
      OrgAndName orgTag = new OrgAndName(org, "tag");

      // create mocks
      DeleteKeyPair strategy = setupStrategy();
      KeyPair keyPair = createMock(KeyPair.class);

      // setup expectations
      expect(strategy.terremarkClient.listKeyPairsInOrg(orgTag.getOrg())).andReturn(ImmutableSet.<KeyPair> of(keyPair));
      expect(keyPair.getName()).andReturn("jclouds_" + orgTag.getName() + "_123").atLeastOnce();
      expect(keyPair.getId()).andReturn(URI.create("1245"));
      strategy.terremarkClient.deleteKeyPair(URI.create("1245"));
      expect(strategy.credentialStore.remove("group#tag")).andReturn(null);

      // replay mocks
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

   public void testWhenKeyPairDoesntMatch() {
      URI org = URI.create("org1");

      // setup constants
      OrgAndName orgTag = new OrgAndName(org, "tag");

      // create mocks
      DeleteKeyPair strategy = setupStrategy();
      KeyPair keyPair = createMock(KeyPair.class);

      // setup expectations
      expect(strategy.terremarkClient.listKeyPairsInOrg(orgTag.getOrg())).andReturn(ImmutableSet.<KeyPair> of(keyPair));
      expect(keyPair.getName()).andReturn("kclouds_" + orgTag.getName() + "_123");

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

Examples of org.jclouds.trmk.vcloud_0_8.compute.domain.OrgAndName

      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);
      expect(keyPair.getFingerPrint()).andReturn(KeyPairHandlerTest.keyPair.getFingerPrint()).atLeastOnce();
      expect(strategy.credentialStore.put("group#group", keyPairCredentials)).andReturn(null);

      // replay mocks
      replay(keyPair);
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.