use of com.vmware.xenon.common.TaskState in project photon-model by vmware.
the class AWSInstanceTypeServiceTest method createEndpointState.
private EndpointState createEndpointState() throws Throwable {
EndpointType endpointType = EndpointType.aws;
EndpointState endpoint;
{
endpoint = new EndpointState();
endpoint.endpointType = endpointType.name();
endpoint.id = endpointType.name() + "-id";
endpoint.name = endpointType.name() + "-name";
endpoint.endpointProperties = new HashMap<>();
endpoint.endpointProperties.put(PRIVATE_KEY_KEY, this.secretKey);
endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, this.accessKey);
endpoint.endpointProperties.put(REGION_KEY, Regions.US_EAST_1.getName());
}
EndpointAllocationTaskState allocateEndpoint = new EndpointAllocationTaskState();
allocateEndpoint.endpointState = endpoint;
allocateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
allocateEndpoint.taskInfo = new TaskState();
allocateEndpoint.taskInfo.isDirect = true;
allocateEndpoint.tenantLinks = Collections.singletonList(endpointType.name() + "-tenant");
allocateEndpoint = com.vmware.photon.controller.model.tasks.TestUtils.doPost(this.host, allocateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
return allocateEndpoint.endpointState;
}
use of com.vmware.xenon.common.TaskState in project photon-model by vmware.
the class MockAdapter method createCancelledTaskInfo.
public static TaskState createCancelledTaskInfo() {
TaskState taskState = new TaskState();
taskState.stage = TaskState.TaskStage.CANCELLED;
taskState.failure = ServiceErrorResponse.create(new IllegalStateException("Mock adapter cancelling task on purpose"), 500);
return taskState;
}
use of com.vmware.xenon.common.TaskState in project photon-model by vmware.
the class MockAdapter method createSuccessTaskInfo.
private static TaskState createSuccessTaskInfo() {
TaskState taskState = new TaskState();
taskState.stage = TaskState.TaskStage.FINISHED;
return taskState;
}
use of com.vmware.xenon.common.TaskState in project photon-model by vmware.
the class ResourceOperationResponse method response.
private static ResourceOperationResponse response(String resourceLink, TaskStage stage) {
ResourceOperationResponse r = new ResourceOperationResponse();
r.resourceLink = resourceLink;
r.taskInfo = new TaskState();
r.taskInfo.stage = stage;
return r;
}
use of com.vmware.xenon.common.TaskState in project photon-model by vmware.
the class TestAWSImageEnumerationTask method createEndpointState.
private EndpointState createEndpointState() throws Throwable {
EndpointType endpointType = EndpointType.aws;
EndpointState endpoint;
{
endpoint = new EndpointState();
endpoint.endpointType = endpointType.name();
endpoint.id = endpointType.name() + "-id";
endpoint.name = endpointType.name() + "-name";
endpoint.endpointProperties = new HashMap<>();
endpoint.endpointProperties.put(PRIVATE_KEY_KEY, this.secretKey);
endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, this.accessKey);
}
EndpointAllocationTaskState allocateEndpoint = new EndpointAllocationTaskState();
allocateEndpoint.endpointState = endpoint;
allocateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
allocateEndpoint.taskInfo = new TaskState();
allocateEndpoint.taskInfo.isDirect = true;
allocateEndpoint.tenantLinks = Arrays.asList(endpointType.name() + "-tenant");
allocateEndpoint = TestUtils.doPost(this.host, allocateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
return allocateEndpoint.endpointState;
}
Aggregations