Example #1
0
  @Test(
      description = "PUT /vApp/{id}/virtualHardwareSection/cpu",
      dependsOnMethods = {"testGetVirtualHardwareSectionCpu"})
  public void testEditVirtualHardwareSectionCpu() {
    // Copy existing section and edit fields
    RasdItem oldItem = vmApi.getVirtualHardwareSectionCpu(vmUrn);
    RasdItem newItem =
        oldItem
            .toBuilder()
            .elementName("2 virtual CPU(s)")
            .virtualQuantity(new BigInteger("2"))
            .build();

    // Method under test
    Task editVirtualHardwareSectionCpu = vmApi.editVirtualHardwareSectionCpu(vmUrn, newItem);
    assertTrue(
        retryTaskSuccess.apply(editVirtualHardwareSectionCpu),
        String.format(TASK_COMPLETE_TIMELY, "editVirtualHardwareSectionCpu"));

    // Retrieve the modified section
    RasdItem modified = vmApi.getVirtualHardwareSectionCpu(vmUrn);

    // Check the retrieved object
    checkResourceAllocationSettingData(modified);

    // Check modified item
    assertEquals(
        modified.getVirtualQuantity(),
        new BigInteger("2"),
        String.format(
            OBJ_FIELD_EQ,
            "ResourceAllocationSettingData",
            "VirtualQuantity",
            "2",
            modified.getVirtualQuantity().toString()));
    assertEquals(modified, newItem);
  }
  public static RasdItem getVirtualHardwareSectionMemory() {
    RasdItem memory = RasdItem.builder().build();

    return memory;
  }
  public static RasdItem getVirtualHardwareSectionCpu() {
    RasdItem cpu = RasdItem.builder().build();

    return cpu;
  }