Package org.jclouds.trmk.vcloud_0_8.domain

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


   @Test
   public void testWindows() throws IOException {
      InputStream is = getClass().getResourceAsStream("/windows_description.txt");
      String description = new String(ByteStreams.toByteArray(is));
      VAppTemplate template = createMock(VAppTemplate.class);
      expect(template.getDescription()).andReturn(description).atLeastOnce();
      replay(template);
      ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials(
               null, ImmutableMap.<String, Credentials> of(), ImmutableMap.<OsFamily, LoginCredentials> of());
      Credentials creds = converter.apply(template);
      assertEquals(creds.identity, "Administrator");
View Full Code Here


            .getHref());

      if (customizationOptions.canCustomizePassword())
         instantiateOptions.withPassword("robotsarefun");

      VAppTemplate vAppTemplate = api.getVAppTemplate(item.getEntity().getHref());

      assert vAppTemplate != null;

      // instantiate, noting vApp returned has minimal details
      vApp = api.instantiateVAppTemplateInVDC(vdc.getHref(), vAppTemplate.getHref(), serverName,
            instantiateOptions);

      assertEquals(vApp.getStatus(), Status.RESOLVED);

      // in terremark, this should be a no-op, as it should simply return the
View Full Code Here

            int... portsToOpen) {
      // we only get IP addresses after "deploy"
      if (portsToOpen.length > 0 && !options.shouldBlock())
         throw new IllegalArgumentException("We cannot open ports on terremark unless we can deploy the vapp");
      String password = null;
      VAppTemplate template = client.getVAppTemplate(templateId);
      if (template.getDescription().indexOf("Windows") != -1) {
         password = passwordGenerator.get();
         options.getProperties().put("password", password);
      }
      checkNotNull(options, "options");
      logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
View Full Code Here

   public LoginCredentials apply(Object resourceToAuthenticate) {
      if (creds != null)
         return creds;
      checkNotNull(resourceToAuthenticate);
      checkArgument(resourceToAuthenticate instanceof VAppTemplate, "Resource must be an VAppTemplate (for Terremark)");
      VAppTemplate template = (VAppTemplate) resourceToAuthenticate;
      String search = template.getDescription() != null ? template.getDescription() : template.getName();
      if (search.indexOf("Windows") >= 0) {
         return LoginCredentials.builder().user("Administrator").build();
      } else {
         Matcher matcher = USER_PASSWORD_PATTERN.matcher(search);
         if (matcher.find()) {
            return LoginCredentials.builder().user(matcher.group(1)).password(matcher.group(2)).authenticateSudo(true).build();
         } else {
            logger.warn("could not parse username/password for image: " + template.getHref() + "\n" + search);
            return null;
         }
      }
   }
View Full Code Here

   }

   @Override
   public Image getImage(String in) {
      URI id = URI.create(in);
      VAppTemplate from = client.getVAppTemplate(id);
      if (from == null)
         return null;
      return vAppToImage.apply(from);
   }
View Full Code Here

      try {
         final String token = parseTokenFromHeaders(from);
         final Map<String, ReferenceType> org = factory.create(orgHandlerProvider.get()).parse(
               checkNotNull(from.getPayload().getInput(), "no payload in http response to login request %s", from));

         return new VCloudSession() {
            @VCloudToken
            public String getVCloudToken() {
               return token;
            }
View Full Code Here

      }

      @Override
      protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
            AtomicReference<AuthorizationException> authException, TerremarkVCloudLoginClient login) {
         return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {

            @Override
            public Map<String, ReferenceType> getOrgs() {
               return ImmutableMap.<String, ReferenceType> of(ORG_REF.getName(), ORG_REF);
            }
View Full Code Here

   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/vdc.xml");
      Injector injector = Guice.createInjector(new SaxParserModule());
      Factory factory = injector.getInstance(ParseSax.Factory.class);

      VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
      assertEquals(result.getName(), "Miami Environment 1");
      assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
      assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of(
            "adriantest",
            new ReferenceTypeImpl("adriantest", TerremarkVCloudMediaType.VAPP_XML, URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")),
            "centos-53",
            new ReferenceTypeImpl("centos-53", TerremarkVCloudMediaType.VAPP_XML, URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120"))));

      assertEquals(result.getAvailableNetworks(), ImmutableMap.of(
            "10.114.34.128/26",
            new ReferenceTypeImpl("10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
      assertEquals(
            result.getCatalog(),
            new ReferenceTypeImpl("Miami Environment 1", CATALOG_XML, URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
      assertEquals(
            result.getPublicIps(),
            new ReferenceTypeImpl("Public IPs", "application/xml", URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps")));
      assertEquals(
            result.getInternetServices(),
            new ReferenceTypeImpl("Internet Services", "application/xml", URI
                  .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices")));
   }
View Full Code Here

         @Override
         public Map<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>> get() {
            return ImmutableMap.<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.Catalog>> of(ORG_REF
                  .getName(), ImmutableMap.<String, org.jclouds.trmk.vcloud_0_8.domain.Catalog> of(
                  CATALOG_REF.getName(),
                  new CatalogImpl(CATALOG_REF.getName(), CATALOG_REF.getType(), CATALOG_REF.getHref(), null,
                        ImmutableMap.<String, ReferenceType> of(
                              "item",
                              new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI
                                    .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1")),
                              "template",
View Full Code Here

                        ImmutableMap.<String, Map<String, ? extends org.jclouds.trmk.vcloud_0_8.domain.CatalogItem>> of(
                              CATALOG_REF.getName(),
                              ImmutableMap
                                    .<String, org.jclouds.trmk.vcloud_0_8.domain.CatalogItem> of(
                                          "template",
                                          new CatalogItemImpl(
                                                "template",
                                                URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"),
                                                "description",
                                                new ReferenceTypeImpl(
                                                      "template",
View Full Code Here

TOP

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

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.