Package org.jclouds.trmk.vcloud_0_8.domain.internal

Examples of org.jclouds.trmk.vcloud_0_8.domain.internal.VAppImpl


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

      VApp expects = new VAppImpl("centos53", URI
               .create("http://10.150.4.49/api/v0.8/vApp/10"), Status.ON, Long.valueOf(104857), new ReferenceTypeImpl(null,
               "application/vnd.vmware.vcloud.vdc+xml", URI.create("http://10.150.4.49/api/v0.8/vdc/4")),
               networkToAddresses, null, "Other Linux (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


               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

   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

            URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/1"),
            URI.create("https://vcloud/vAppTemplate/3"),
            "name",
            InstantiateVAppTemplateOptions.Builder.processorCount(2).memory(512).inGroup("group")
                  .withPassword("password").inRow("row")
                  .addNetworkConfig(new NetworkConfig(URI.create("http://network")))));

      assertRequestLineEquals(request,
            "POST https://vcloud.safesecureweb.com/api/v0.8/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
      assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
      assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
View Full Code Here

   }

   @Test
   public void testAddNetworkConfig() {
      InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
      options.addNetworkConfig(new NetworkConfig("default", URI.create("http://localhost"), FenceMode.ALLOW_IN_OUT));
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.ALLOW_IN_OUT);
   }
View Full Code Here

      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.ALLOW_IN_OUT);
   }

   @Test
   public void testAddNetworkConfigStatic() {
      InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("default",
            URI.create("http://localhost"), FenceMode.ALLOW_IN_OUT));
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
      assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.ALLOW_IN_OUT);
   }
View Full Code Here

      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);
      }
      try {
         return stringBinder.bindToRequest(request,
View Full Code Here

TOP

Related Classes of org.jclouds.trmk.vcloud_0_8.domain.internal.VAppImpl

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.