Examples of VirtualHardwareSection


Examples of org.jclouds.ovf.VirtualHardwareSection

      // TODO make this work with composite vApps
      Vm vm = from.getChildren().isEmpty() ? null : Iterables.get(from.getChildren(), 0);
      if (vm == null)
         return null;

      VirtualHardwareSection hardware = vm.getVirtualHardwareSection();
      HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
      builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
      builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
               ImagePredicates.idEquals(from.getHref().toASCIIString()));
      builder.hypervisor("VMware");
      return builder.build();
View Full Code Here

Examples of org.jclouds.ovf.VirtualHardwareSection

   public VCloudVirtualHardwareHandler(VirtualHardwareSectionHandler hardwareHandler) {
      this.hardwareHandler = hardwareHandler;
   }

   public VCloudVirtualHardwareSection getResult() {
      VirtualHardwareSection hardware = hardwareHandler.getResult();
      return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware
                        .getTransports(), hardware.getSystem(), hardware.getItems());
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

      return task;
   }

   public static VirtualHardwareSection getVirtualHardwareSection() {
      VirtualHardwareSection section = VirtualHardwareSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

  
   @Inject private static SectionForVApp<VirtualHardwareSection> findVirtualHardwareSectionForVApp =
         new SectionForVApp<VirtualHardwareSection>(VirtualHardwareSection.class);

   public static String getVirtualSystemIdentifierOf(Vm vm) {
      VirtualHardwareSection virtualHardwareSection = findVirtualHardwareSectionForVApp.apply(vm);
      if (virtualHardwareSection != null && virtualHardwareSection.getSystem() != null)
         return virtualHardwareSection.getSystem().getVirtualSystemIdentifier();
      return null;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

      checkNotNull(from, "VApp");
      // TODO make this work with composite vApps
      if (from == null)
         return null;
     
      VirtualHardwareSection hardware = findVirtualHardwareSectionForVm.apply(from);
      HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
      builder.location(findLocationForResource.apply(Iterables.find(checkNotNull(from, "from").getLinks(),
            LinkPredicates.typeEquals(VCloudDirectorMediaType.VDC))));
      builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
               ImagePredicates.idEquals(from.getHref().toASCIIString()));
      builder.hypervisor("VMware");
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vApp/getVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
            .httpResponseBuilder().build());

      VirtualHardwareSection expected = getVirtualHardwareSection();

    assertEquals(api.getVmApi().getVirtualHardwareSection(vmURI), expected);
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

            .httpRequestBuilder().build(),
         new VcloudHttpResponsePrimer()
            .xmlFilePayload("/vApp/editVirtualHardwareSectionTask.xml", VCloudDirectorMediaType.TASK)
            .httpResponseBuilder().build());

      VirtualHardwareSection section = getVirtualHardwareSection().toBuilder()
            .build();

    Task expected = editVirtualHardwareSectionTask();

    assertEquals(api.getVmApi().editVirtualHardwareSection(vmURI, section), expected);
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

      return task;
   }

   public static VirtualHardwareSection getVirtualHardwareSection() {
      VirtualHardwareSection section = VirtualHardwareSection.builder()
            .build();

      return section;
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

   }

   @Test(description = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVm" })
   public void testGetVirtualHardwareSection() {
      // Method under test
      VirtualHardwareSection hardware = vmApi.getVirtualHardwareSection(vmUrn);

      // Check the retrieved object is well formed
      checkVirtualHardwareSection(hardware);
   }
View Full Code Here

Examples of org.jclouds.vcloud.director.v1_5.domain.section.VirtualHardwareSection

   public void testEditVirtualHardwareSection() {
      // Power off Vm
      vm = powerOffVm(vmUrn);

      // Copy existing section and edit fields
      VirtualHardwareSection oldSection = vmApi.getVirtualHardwareSection(vmUrn);
      Set<? extends ResourceAllocationSettingData> oldItems = oldSection.getItems();
      Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
      ResourceAllocationSettingData oldMemory = Iterables.find(oldItems,
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
               });
      ResourceAllocationSettingData newMemory = oldMemory.toBuilder().elementName("1024 MB of memory")
               .virtualQuantity(new BigInteger("1024")).build();
      newItems.remove(oldMemory);
      newItems.add(newMemory);
      VirtualHardwareSection newSection = oldSection.toBuilder().items(newItems).build();

      // The method under test
      Task editVirtualHardwareSection = vmApi.editVirtualHardwareSection(vmUrn, newSection);
      assertTrue(retryTaskSuccess.apply(editVirtualHardwareSection),
               String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSection"));

      // Retrieve the modified section
      VirtualHardwareSection modifiedSection = vmApi.getVirtualHardwareSection(vmUrn);

      // Check the retrieved object is well formed
      checkVirtualHardwareSection(modifiedSection);

      // Check the modified section fields are set correctly
      ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedSection.getItems(),
               new Predicate<ResourceAllocationSettingData>() {
                  @Override
                  public boolean apply(ResourceAllocationSettingData rasd) {
                     return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
                  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.