Package org.jclouds.trmk.vcloud_0_8.domain

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


   @Test
   public void testStartWindows() throws IOException {
      Map<String, Credentials> credentialStore = Maps.newHashMap();
      InputStream is = getClass().getResourceAsStream("/windows_description.txt");
      String description = new String(ByteStreams.toByteArray(is));
      VAppTemplate template = createMock(VAppTemplate.class);
      VDC vdc = createMock(VDC.class);
      URI templateURI = URI.create("template");
      URI vdcURI = URI.create("vdc");

      expect(template.getDescription()).andReturn(description).atLeastOnce();
      TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
      VApp vApp = createMock(VApp.class);
      InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
      expect(client.getVAppTemplate(templateURI)).andReturn(template);
      expect(
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

            .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

   @Test
   public void testStartWindows() throws IOException {
      Map<String, Credentials> credentialStore = Maps.newHashMap();
      InputStream is = getClass().getResourceAsStream("/windows_description.txt");
      String description = new String(ByteStreams.toByteArray(is));
      VAppTemplate template = createMock(VAppTemplate.class);
      VDC vdc = createMock(VDC.class);
      URI templateURI = URI.create("template");
      URI vdcURI = URI.create("vdc");

      expect(template.getDescription()).andReturn(description).atLeastOnce();
      TerremarkVCloudClient client = createMock(TerremarkVCloudClient.class);
      VApp vApp = createMock(VApp.class);
      InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
      expect(client.getVAppTemplate(templateURI)).andReturn(template);
      expect(
View Full Code Here

   public void testTerremark() {
      InputStream is = getClass().getResourceAsStream("/vAppTemplate-trmk.xml");
      injector = Guice.createInjector(new SaxParserModule());
      factory = injector.getInstance(ParseSax.Factory.class);
      VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
      assertEquals(result, new VAppTemplateImpl("CentOS 5.3 (32-bit)", URI
            .create("https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/5"),
            "description of CentOS 5.3 (32-bit)", null));
   }
View Full Code Here

   @Test
   public void testRhel() throws IOException {
      InputStream is = getClass().getResourceAsStream("/rhel_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, "vcloud");
View Full Code Here

   @Test
   public void testLamp() throws IOException {
      InputStream is = getClass().getResourceAsStream("/lamp_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, "ecloud");
View Full Code Here

   @Test
   public void testFt() throws IOException {
      InputStream is = getClass().getResourceAsStream("/ft_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, "vpncubed");
View Full Code Here

   @Test
   public void testEC() throws IOException {
      InputStream is = getClass().getResourceAsStream("/ec_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, "ecloud");
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.