private static ResourceDescriptionService.ResourceDescription createResourceDescription(
      TestHost host,
      ComputeDescriptionService.ComputeDescription cd,
      List<String> diskDescriptionLinks,
      List<String> networkDescriptionLinks)
      throws Throwable {
    ResourceDescriptionService.ResourceDescription rd =
        new ResourceDescriptionService.ResourceDescription();
    rd.computeType = ComputeType.VM_GUEST.toString();
    rd.computeDescriptionLink = cd.documentSelfLink;
    rd.diskDescriptionLinks = diskDescriptionLinks;
    rd.networkDescriptionLinks = networkDescriptionLinks;

    return host.postServiceSynchronously(
        ResourceDescriptionFactoryService.SELF_LINK,
        rd,
        ResourceDescriptionService.ResourceDescription.class);
  }
  private static ComputeService.ComputeState createParentCompute(
      TestHost host, String resourcePool, String zoneId) throws Throwable {
    // Create parent ComputeDescription
    ComputeDescriptionService.ComputeDescription cd =
        new ComputeDescriptionService.ComputeDescription();
    cd.bootAdapterReference = new URI("http://bootAdapterReference");
    cd.powerAdapterReference = new URI("http://powerAdapterReference");
    cd.instanceAdapterReference = new URI("http://instanceAdapterReference");
    cd.healthAdapterReference = null;
    cd.enumerationAdapterReference = new URI("http://enumerationAdapterReference");
    cd.supportedChildren = new ArrayList<>();
    cd.supportedChildren.add(ComputeType.VM_GUEST.toString());
    cd.environmentName = ComputeDescriptionService.ComputeDescription.ENVIRONMENT_NAME_ON_PREMISE;
    cd.costPerMinute = 1;
    cd.cpuMhzPerCore = 1000;
    cd.cpuCount = 2;
    cd.gpuCount = 1;
    cd.currencyUnit = "USD";
    cd.totalMemoryBytes = Integer.MAX_VALUE;
    cd.id = UUID.randomUUID().toString();
    cd.name = "friendly-name";
    cd.regionId = "provider-specific-regions";
    cd.zoneId = zoneId;
    ComputeDescriptionService.ComputeDescription cd1 =
        host.postServiceSynchronously(
            ComputeDescriptionFactoryService.SELF_LINK,
            cd,
            ComputeDescriptionService.ComputeDescription.class);

    // Create parent Compute
    ComputeService.ComputeState cs = new ComputeService.ComputeState();
    cs.id = UUID.randomUUID().toString();
    cs.descriptionLink = cd1.documentSelfLink;
    cs.resourcePoolLink = resourcePool;
    cs.adapterManagementReference = URI.create("https://esxhost-01:443/sdk");
    ComputeService.ComputeState cs1 =
        host.postServiceSynchronously(
            ComputeFactoryService.SELF_LINK, cs, ComputeService.ComputeState.class);

    return cs1;
  }
  private static ResourceAllocationTaskState createAllocationRequest(
      String resourcePool,
      String computeDescriptionLink,
      List<String> diskDescriptionLinks,
      List<String> networkDescriptionLinks) {
    ResourceAllocationTaskState state = new ResourceAllocationTaskState();
    state.taskSubStage =
        ResourceAllocationTaskService.SubStage.QUERYING_AVAILABLE_COMPUTE_RESOURCES;
    state.resourceCount = 2;
    state.resourcePoolLink = resourcePool;
    state.computeDescriptionLink = computeDescriptionLink;
    state.computeType = ComputeType.VM_GUEST.toString();
    state.customProperties = new HashMap<>();
    state.customProperties.put("testProp", "testValue");

    // For most tests, we override resourceDescription.
    state.resourceDescriptionLink = null;

    state.diskDescriptionLinks = diskDescriptionLinks;
    state.networkDescriptionLinks = networkDescriptionLinks;

    return state;
  }