use of com.vmware.xenon.common.test.TestRequestSender in project photon-model by vmware.
the class TestVSphereComputeDiskDay2Service method sendRequest.
private void sendRequest(ResourceOperationRequest request, DiskService.DiskType diskType, VerificationHost.WaitHandler handler) {
Operation attachDiskOp = Operation.createPatch(UriUtils.buildUri(this.host, VSphereComputeDiskManagementService.SELF_LINK)).setBody(request).setReferer(this.host.getReferer());
TestRequestSender sender = new TestRequestSender(this.host);
sender.sendRequest(attachDiskOp);
this.host.log(String.format("Waiting for %s disk attach to complete", diskType.name()));
this.host.waitFor(String.format("%s %s disk failed.", request.operation, diskType.name()), handler);
}
use of com.vmware.xenon.common.test.TestRequestSender in project photon-model by vmware.
the class AWSVolumeTypeDiscoveryServiceTest method testVolumeTypeDiscovery.
@Test
public void testVolumeTypeDiscovery() {
Operation get = Operation.createGet(this.host, AWSVolumeTypeDiscoveryService.SELF_LINK + "?deviceType=ebs");
get = new TestRequestSender(this.host).sendAndWait(get);
VolumeTypeList volumes = get.getBody(AWSVolumeTypeDiscoveryService.VolumeTypeList.class);
Assert.assertEquals("The expected number of supported ebs volumes are not matching " + "the actual number volumes from the discovery service", 5, volumes.volumeTypes.size());
}
use of com.vmware.xenon.common.test.TestRequestSender in project photon-model by vmware.
the class AzureSubscriptionsEnumerationServiceTest method createAzureCostComputesForSubscriptions.
private void createAzureCostComputesForSubscriptions(Collection<AzureSubscription> subscriptions) {
AzureSubscriptionsEnumerationRequest request = getAzureCostComputeEnumRequestForSubscriptions(subscriptions);
TestRequestSender sender = new TestRequestSender(this.host);
Operation op = Operation.createPatch(this.host, AzureSubscriptionsEnumerationService.SELF_LINK).setBody(request);
sender.sendAndWait(op);
}
use of com.vmware.xenon.common.test.TestRequestSender in project photon-model by vmware.
the class AzureSubscriptionEndpointsEnumerationServiceTest method createAzureEndpointsForSubscriptions.
private void createAzureEndpointsForSubscriptions(Collection<AzureSubscription> subscriptions) {
AzureSubscriptionEndpointsEnumerationRequest request = new AzureSubscriptionEndpointsEnumerationRequest();
request.resourceReference = UriUtils.buildUri(this.host, this.computeLink);
request.azureSubscriptions = subscriptions;
TestRequestSender sender = new TestRequestSender(this.host);
Operation op = Operation.createPatch(this.host, AzureSubscriptionEndpointsEnumerationService.SELF_LINK).setBody(request);
sender.sendAndWait(op);
}
use of com.vmware.xenon.common.test.TestRequestSender in project photon-model by vmware.
the class BaseVSphereAdapterTest method deleteSnapshotAndWait.
protected void deleteSnapshotAndWait(ComputeState computeState) throws Throwable {
// Get the snapshot associated with the compute
SnapshotState snapshotState = querySnapshotState(computeState.documentSelfLink, true);
String taskLink = UUID.randomUUID().toString();
ResourceOperationRequest snapshotRequest = getDeleteOrRevertSnapshotRequest(ResourceOperation.DELETE_SNAPSHOT.operation, "DELETE", computeState.documentSelfLink, snapshotState.documentSelfLink, taskLink);
Operation deleteSnapshotOp = Operation.createPatch(UriUtils.buildUri(this.host, VSphereAdapterSnapshotService.SELF_LINK)).setBody(snapshotRequest).setReferer(this.host.getReferer()).setCompletion((o, e) -> Assert.assertNull(e));
TestRequestSender sender = new TestRequestSender(this.host);
sender.sendRequest(deleteSnapshotOp);
this.host.log("Waiting for the snapshot to be deleted");
this.host.waitFor("Delete snapshot request failed", () -> {
SnapshotState finalSnapshotState = querySnapshotState(computeState.documentSelfLink, true);
ComputeState finalComputeState = this.host.getServiceState(null, ComputeState.class, UriUtils.buildUri(this.host, computeState.documentSelfLink));
String hasSnapshot = finalComputeState.customProperties.get(ComputeProperties.CUSTOM_PROP_COMPUTE_HAS_SNAPSHOTS);
// snapshot. So hasSnapshot will still be true.
if (hasSnapshot != null && Boolean.parseBoolean(hasSnapshot) && finalSnapshotState == null) {
return true;
} else {
return false;
}
});
this.host.log("Delete snapshot operation completed successfully");
}
Aggregations