@Test(
      description = "PUT /vApp/{id}/virtualHardwareSection/networkCards",
      dependsOnMethods = {"testGetVirtualHardwareSectionNetworkCards"})
  public void testEditVirtualHardwareSectionNetworkCards() {
    RasdItemsList oldSection = vmApi.getVirtualHardwareSectionNetworkCards(vmUrn);
    RasdItemsList newSection = oldSection.toBuilder().build();

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

    // Retrieve the modified section
    RasdItemsList modified = vmApi.getVirtualHardwareSectionNetworkCards(vmUrn);

    // Check the retrieved object is well formed
    checkRasdItemsList(modified);

    // TODO What is modifiable? What can we change, so we can assert the change took effect?
    // I tried changing "elementName" of one of the items, but it continued to have the old value
    // when looked up post-edit.
    // See the description in testEditVirtualHardwareSectionDisks
  }
  @Test(
      description = "PUT /vApp/{id}/virtualHardwareSection/disks",
      dependsOnMethods = {"testGetVirtualHardwareSectionDisks"})
  public void testEditVirtualHardwareSectionDisks() {
    // Copy the existing items list and edit the name of an item
    RasdItemsList oldSection = vmApi.getVirtualHardwareSectionDisks(vmUrn);
    RasdItemsList newSection = oldSection.toBuilder().build();

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

    // Retrieve the modified section
    RasdItemsList modified = vmApi.getVirtualHardwareSectionDisks(vmUrn);

    // Check the retrieved object is well formed
    checkRasdItemsList(modified);

    // TODO What is modifiable? What can we change, so we can assert the change took effect?
    // I tried changing "elementName" of one of the items, but it continued to have the old value
    // when looked up post-edit.
    //
    // List<ResourceAllocationSettingData> newItems = new
    // ArrayList<ResourceAllocationSettingData>(oldSection.getItems());
    // ResourceAllocationSettingData item0 = newItems.get(0);
    // String item0InstanceId = item0.getInstanceID().getValue();
    // String item0ElementName =
    // item0.getElementName().getValue()+"-"+random.nextInt(Integer.MAX_VALUE);
    // newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build());
    // RasdItemsList newSection = oldSection.toBuilder()
    // .items(newItems)
    // .build();
    // ...
    // long weight = random.nextInt(Integer.MAX_VALUE);
    // ResourceAllocationSettingData newSection = origSection.toBuilder()
    // .weight(newCimUnsignedInt(weight))
    // .build();
    // ...
    // checkHasMatchingItem("virtualHardwareSection/disk", modified, item0InstanceId,
    // item0ElementName);
  }
Beispiel #3
0
 public B fromRasdItemsList(RasdItemsList in) {
   return fromResourceType(in).items(in.getItems());
 }
  public static RasdItemsList getVirtualHardwareSectionSerialPorts() {
    RasdItemsList serialPorts = RasdItemsList.builder().build();

    return serialPorts;
  }
  public static RasdItemsList getVirtualHardwareSectionNetworkCards() {
    RasdItemsList networkCards = RasdItemsList.builder().build();

    return networkCards;
  }
  public static RasdItemsList getVirtualHardwareSectionMedia() {
    RasdItemsList media = RasdItemsList.builder().build();

    return media;
  }
  public static RasdItemsList getVirtualHardwareSectionDisks() {
    RasdItemsList disks = RasdItemsList.builder().build();

    return disks;
  }