Package org.jclouds.trmk.vcloud_0_8.domain

Examples of org.jclouds.trmk.vcloud_0_8.domain.Org


            return from.getHref();
         }

      });
      try {
         Org org = uriToOrg.get(from == null ? defaultOrg.get().getHref() : from);
         return getUriFromOrg(org);
      } catch (NullPointerException e) {
         throw new ResourceNotFoundException("org " + from + " not found in: " + uriToOrg, e);
      }
   }
View Full Code Here


   public void testApplyInputStream() {

      InputStream is = getClass().getResourceAsStream("/org.xml");

      Org result =  factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result.getName(), "adrian@jclouds.org");
      assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48"));
      assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
               "Miami Environment 1 Catalog", CATALOG_XML, URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/catalog"))));
      assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl(
               "Miami Environment 1", TerremarkVCloudMediaType.VDC_XML, URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"))));
      assertEquals(result.getTasksLists(), ImmutableMap.of(
            "Miami Environment 1 Tasks List",
            new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/tasksList"))));
      assertEquals(result.getKeys(), new ReferenceTypeImpl("Keys", "application/vnd.tmrk.vcloudExpress.keysList+xml",
               URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys")));

   }
View Full Code Here

   protected InstantiateVAppTemplateOptions createInstantiateOptions() {
      return processorCount(1).memory(512).sshKeyFingerprint(key.getFingerPrint());
   }

   protected void prepare() {
      Org org = api.findOrgNamed(null);
      try {
         key = api.generateKeyPairInOrg(org.getHref(), "livetest", false);
      } catch (IllegalStateException e) {
         key = api.findKeyPairInOrg(org.getHref(), "livetest");
         api.deleteKeyPair(key.getId());
         key = api.generateKeyPairInOrg(org.getHref(), "livetest", false);
      }
      assertNotNull(key);
      assertEquals(key.getName(), "livetest");
      assertNotNull(key.getPrivateKey());
      assertNotNull(key.getFingerPrint());
      assertEquals(key.isDefault(), false);
      assertEquals(key.getFingerPrint(), api.findKeyPairInOrg(org.getHref(), key.getName()).getFingerPrint());
   }
View Full Code Here

   }

   @Override
   public OrgAndName apply(NodeMetadata from) {
      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

   protected InstantiateVAppTemplateOptions createInstantiateOptions() {
      return processorCount(1).memory(512).sshKeyFingerprint(key.getFingerPrint());
   }

   protected void prepare() {
      Org org = api.findOrgNamed(null);
      try {
         key = api.generateKeyPairInOrg(org.getHref(), "livetest", false);
      } catch (IllegalStateException e) {
         key = api.findKeyPairInOrg(org.getHref(), "livetest");
         api.deleteKeyPair(key.getId());
         key = api.generateKeyPairInOrg(org.getHref(), "livetest", false);
      }
      assertNotNull(key);
      assertEquals(key.getName(), "livetest");
      assertNotNull(key.getPrivateKey());
      assertNotNull(key.getFingerPrint());
      assertEquals(key.isDefault(), false);
      assertEquals(key.getFingerPrint(), api.findKeyPairInOrg(org.getHref(), key.getName()).getFingerPrint());
   }
View Full Code Here

   public void testApplyInputStream() {

      InputStream is = getClass().getResourceAsStream("/org.xml");

      Org result =  factory.create(injector.getInstance(OrgHandler.class)).parse(is);
      assertEquals(result.getName(), "adrian@jclouds.org");
      assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/org/48"));
      assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
               "Miami Environment 1 Catalog", CATALOG_XML, URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/catalog"))));
      assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl(
               "Miami Environment 1", TerremarkVCloudMediaType.VDC_XML, URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"))));
      assertEquals(result.getTasksLists(), ImmutableMap.of(
            "Miami Environment 1 Tasks List",
            new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32/tasksList"))));
      assertEquals(result.getKeys(), new ReferenceTypeImpl("Keys", "application/vnd.tmrk.vcloudExpress.keysList+xml",
               URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys")));

   }
View Full Code Here

   }

   @Override
   public OrgAndName apply(NodeMetadata from) {
      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

            return from.getHref();
         }

      });
      try {
         Org org = uriToOrg.get(from == null ? defaultOrg.get().getHref() : from);
         return getUriFromOrg(org);
      } catch (NullPointerException e) {
         throw new ResourceNotFoundException("org " + from + " not found in: " + uriToOrg, e);
      }
   }
View Full Code Here

      InputStream is = getClass().getResourceAsStream("/InternetServices.xml");

      Set<InternetService> result = factory.create(injector.getInstance(InternetServicesHandler.class)).parse(is);
      assertEquals(result.toString(), ImmutableSet.of(new InternetService("IS_for_Jim2", URI
               .create("https://services.vcloudexpress.terremark.com/api/v0.8/InternetServices/524"),
               new PublicIpAddress("10.1.22.159", URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8/PublicIps/4208")), 45,
               Protocol.HTTP, false, 1, "Some test service")).toString());
   }
View Full Code Here

public class PublicIpAddressHandlerTest extends BaseHandlerTest {

   public void test1() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/PublicIpAddress.xml");

      PublicIpAddress result = factory.create(injector.getInstance(PublicIpAddressHandler.class)).parse(is);
      assertEquals(result, new PublicIpAddress("204.51.112.91", URI
            .create("https://services.vcloudexpress.terremark.com/api/v0.8/PublicIps/8720")));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.domain.Org

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.