Search in sources :

Example 76 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class EndpointRemovalTaskServiceTest method createDiskState.

private static void createDiskState(BaseModelTest test, String endpointLink, List<String> tenantLinks) throws Throwable {
    DiskState d = new DiskState();
    d.id = UUID.randomUUID().toString();
    d.type = DiskType.HDD;
    d.name = "disk";
    d.capacityMBytes = 100L;
    d.tenantLinks = tenantLinks;
    d.endpointLink = endpointLink;
    d.endpointLinks = new HashSet<String>();
    d.endpointLinks.add(endpointLink);
    test.postServiceSynchronously(DiskService.FACTORY_LINK, d, DiskState.class);
}
Also used : DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState)

Example 77 with DiskState

use of com.vmware.photon.controller.model.resources.DiskService.DiskState in project photon-model by vmware.

the class TagGroomerTaskServiceTest method createDisksWithTags.

/**
 * Create n computes associated with specific tags
 */
private void createDisksWithTags(int count, List<String> tagLinks) {
    DiskState diskState = new DiskState();
    diskState.descriptionLink = "description-link";
    diskState.id = UUID.randomUUID().toString();
    diskState.name = diskState.id;
    diskState.tagLinks = new HashSet<>();
    for (int i = 0; i < count; i++) {
        diskState.tagLinks.add(tagLinks.get(i));
        Operation op = Operation.createPost(UriUtils.buildUri(this.host, DiskService.FACTORY_LINK)).setBody(diskState);
        this.host.waitForResponse(op);
        // clear tagLinks and assign new one on the next round
        diskState.tagLinks.clear();
    }
}
Also used : DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) Operation(com.vmware.xenon.common.Operation)

Aggregations

DiskState (com.vmware.photon.controller.model.resources.DiskService.DiskState)77 ArrayList (java.util.ArrayList)24 Operation (com.vmware.xenon.common.Operation)23 DiskService (com.vmware.photon.controller.model.resources.DiskService)18 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)16 List (java.util.List)15 EnumerationAction (com.vmware.photon.controller.model.adapterapi.EnumerationAction)13 UriUtils (com.vmware.xenon.common.UriUtils)13 Utils (com.vmware.xenon.common.Utils)13 HashMap (java.util.HashMap)13 TimeUnit (java.util.concurrent.TimeUnit)13 QueryTask (com.vmware.xenon.services.common.QueryTask)12 Query (com.vmware.xenon.services.common.QueryTask.Query)12 HashSet (java.util.HashSet)12 Test (org.junit.Test)11 AzureConstants (com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants)10 PhotonModelUriUtils.createInventoryUri (com.vmware.photon.controller.model.util.PhotonModelUriUtils.createInventoryUri)10 ServiceDocumentQueryResult (com.vmware.xenon.common.ServiceDocumentQueryResult)10 AuthCredentialsService (com.vmware.xenon.services.common.AuthCredentialsService)10 Map (java.util.Map)10