Package org.jclouds.trmk.vcloud_0_8.options

Examples of org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions$Builder


               ResourceAllocationSettingData.builder().instanceID("9").elementName("Hard Disk 1").resourceType(
                        ResourceType.DISK_DRIVE).hostResource("10485760").addressOnParent("0").parent("3")
                        .virtualQuantity(10485760l).build());

      VApp expects = new VAppImpl("m1", URI.create("http://localhost:8000/api/v0.8/vApp/80"),
               Status.ON, Long.valueOf(10485760), new ReferenceTypeImpl(null, "application/vnd.vmware.vcloud.vdc+xml", URI
                        .create("http://localhost:8000/api/v0.8/vdc/28")), networkToAddresses, null,
               "Microsoft Windows XP Professional (32-bit)", system, resourceAllocations);
      assertEquals(result.getHref(), expects.getHref());
      assertEquals(result.getName(), expects.getName());
      assertEquals(result.getNetworkToAddresses(), expects.getNetworkToAddresses());
      assertEquals(result.getOperatingSystemDescription(), expects.getOperatingSystemDescription());
      assertEquals(result.getResourceAllocations().toString(), expects.getResourceAllocations().toString());
      assertEquals(result.getSize(), expects.getSize());
      assertEquals(result.getStatus(), expects.getStatus());
      assertEquals(result.getSystem().toString(), expects.getSystem().toString());
      assertEquals(result.getType(), expects.getType());
      assertEquals(result.getVDC(), expects.getVDC());
   }
View Full Code Here


   protected Long size;
   protected ReferenceType vDC;
   protected Set<ReferenceType> extendedInfo = Sets.newLinkedHashSet();

   public VApp getResult() {
      return new VAppImpl(name, location, status, size, vDC, networkToAddresses, osType, operatingSystemDescription,
            system, allocations, extendedInfo);
   }
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

   private ReferenceType catalog;
   private ReferenceType publicIps;
   private ReferenceType internetServices;

   public VDC getResult() {
      return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), description, catalog, publicIps,
            internetServices, resourceEntities, availableNetworks);
   }
View Full Code Here

      String name = checkNotNull(postParams.remove("name"), "name").toString();
      String template = checkNotNull(postParams.remove("template"), "template").toString();

      SortedMap<ResourceType, String> virtualHardwareQuantity = Maps.newTreeMap();

      InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
      String network = (defaultNetwork != null) ? defaultNetwork.get().getHref().toASCIIString() : null;
      String fenceMode = defaultFenceMode;
      String networkName = name;
      if (options != null) {
         if (options.getNetworkConfig().size() > 0) {
            NetworkConfig config = Iterables.get(options.getNetworkConfig(), 0);
            network = ifNullDefaultTo(config.getParentNetwork(), network);
            fenceMode = ifNullDefaultTo(config.getFenceMode(), defaultFenceMode);
            networkName = ifNullDefaultTo(config.getNetworkName(), networkName);
         }
         addQuantity(options, virtualHardwareQuantity);
View Full Code Here

   }

   ThreadLocal<Map<String, String>> propLocal = new ThreadLocal<Map<String, String>>();

   protected InstantiateVAppTemplateOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
      InstantiateVAppTemplateOptions options = null;
      for (Object arg : gRequest.getInvocation().getArgs()) {
         if (arg instanceof InstantiateVAppTemplateOptions) {
            options = (InstantiateVAppTemplateOptions) arg;
         } else if (arg instanceof InstantiateVAppTemplateOptions[]) {
            InstantiateVAppTemplateOptions[] optionsA = (InstantiateVAppTemplateOptions[]) arg;
            options = (optionsA.length > 0) ? optionsA[0] : null;
         }
      }
      if (options != null)
         propLocal.set(options.getProperties());
      return options;
   }
View Full Code Here

      this.credentialStore = checkNotNull(credentialStore, "credentialStore");
      this.prioritizeCredentialsFromTemplate = checkNotNull(prioritizeCredentialsFromTemplate, "prioritizeCredentialsFromTemplate");
   }
   @Override
   public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
      InstantiateVAppTemplateOptions options = getOptions.apply(template);
      NodeAndInitialCredentials<VApp> from = computeClient.startAndReturnCredentials(URI.create(template.getLocation().getId()), URI.create(template
               .getImage().getId()), name, options, template.getOptions().getInboundPorts());
      LoginCredentials fromNode = from.getCredentials();
      if (credentialStore.containsKey("group#" + group)) {
         fromNode = fromNode == null ? LoginCredentials.fromCredentials(credentialStore.get("group#" + group))
View Full Code Here

      VApp vApp = createMock(VApp.class);
      InternetServiceAndPublicIpAddressSupplier supplier = createMock(InternetServiceAndPublicIpAddressSupplier.class);
      expect(client.getVAppTemplate(templateURI)).andReturn(template);
      expect(
            client.instantiateVAppTemplateInVDC(vdcURI, templateURI, "name",
                  new InstantiateVAppTemplateOptions().productProperty("password", "password"))).andReturn(vApp);
      Task task = createMock(Task.class);
      URI vappLocation = URI.create("vapp");
      URI taskLocation = URI.create("task");

      expect(vApp.getHref()).andReturn(vappLocation).atLeastOnce();
      expect(vApp.getName()).andReturn("name").atLeastOnce();
      expect(client.deployVApp(vappLocation)).andReturn(task);
      expect(task.getHref()).andReturn(taskLocation).atLeastOnce();
      Predicate<URI> successTester = createMock(Predicate.class);
      expect(successTester.apply(taskLocation)).andReturn(true).atLeastOnce();
      expect(client.powerOnVApp(vappLocation)).andReturn(task);

      Predicate<VApp> notFoundTester = createMock(Predicate.class);
      Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus = createMock(Map.class);

      TerremarkVCloudComputeClient computeClient = new TerremarkVCloudComputeClient(client,
            new Provider<String>() {

               @Override
               public String get() {
                  return "password";
               }

            }, successTester, vAppStatusToNodeStatus, credentialStore, supplier);

      replay(vdc);
      replay(template);
      replay(vApp);
      replay(task);
      replay(client);
      replay(successTester);
      replay(notFoundTester);
      replay(vAppStatusToNodeStatus);

      NodeAndInitialCredentials<VApp> response = computeClient.startAndReturnCredentials(vdcURI, templateURI, "name", new InstantiateVAppTemplateOptions());

      assertEquals(response.getNodeId(), "vapp");
      assertEquals(response.getNode(),vApp);
      assertEquals(response.getCredentials(), LoginCredentials.builder().password("password").build());
View Full Code Here

      // lookup the datacenter you are deploying into
      vdc = api.findVDCInOrgNamed(null, null);

      // create an options object to collect the configuration we want.
      InstantiateVAppTemplateOptions instantiateOptions = createInstantiateOptions().sshKeyFingerprint(
            key.getFingerPrint());

      CatalogItem item = api.findCatalogItemInOrgCatalogNamed(null, null, itemName);

      assert item != null;

      // if this template supports setting the root password, let's add it to
      // our options
      CustomizationParameters customizationOptions = api.getCustomizationOptions(item.getCustomizationOptions()
            .getHref());

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

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

      assert vAppTemplate != null;
View Full Code Here

@Singleton
public class TemplateToInstantiateOptions implements Function<Template, InstantiateVAppTemplateOptions> {

   @Override
   public InstantiateVAppTemplateOptions apply(Template from) {
      InstantiateVAppTemplateOptions options = processorCount(Double.valueOf(getCores(from.getHardware())).intValue())
            .memory(from.getHardware().getRam());
      if (!from.getOptions().shouldBlockUntilRunning())
         options.block(false);
      String sshKeyFingerprint = TerremarkVCloudTemplateOptions.class.cast(from.getOptions()).getSshKeyFingerprint();
      if (sshKeyFingerprint != null)
         options.sshKeyFingerprint(sshKeyFingerprint);
      return options;
   }
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions$Builder

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.