Search in sources :

Example 16 with EndpointState

use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.

the class EndpointRemovalTaskServiceTest method createEndpointState.

private static EndpointState createEndpointState() {
    EndpointState endpoint = new EndpointState();
    endpoint.endpointType = "aws";
    endpoint.name = "aws_endpoint";
    endpoint.endpointProperties = new HashMap<>();
    endpoint.endpointProperties.put(REGION_KEY, "test-regionId");
    endpoint.endpointProperties.put(PRIVATE_KEY_KEY, "test-secreteKey");
    endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, "test-accessKey");
    endpoint.tenantLinks = Collections.singletonList("tenant-1");
    return endpoint;
}
Also used : EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState)

Example 17 with EndpointState

use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.

the class EndpointServiceTests method testCreateAndThenValidate.

public void testCreateAndThenValidate(EndpointService.EndpointState ep) throws Throwable {
    EndpointAllocationTaskState createEndpoint = new EndpointAllocationTaskState();
    createEndpoint.endpointState = ep;
    createEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
    EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, createEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
    EndpointAllocationTaskState taskState = getServiceSynchronously(outTask.documentSelfLink, EndpointAllocationTaskState.class);
    assertNotNull(taskState);
    assertNotNull(taskState.endpointState);
    ServiceDocument endpointState = taskState.endpointState;
    assertNotNull(endpointState.documentSelfLink);
    // check endpoint document was created
    EndpointService.EndpointState endpoint = getServiceSynchronously(endpointState.documentSelfLink, EndpointService.EndpointState.class);
    // now do validation
    EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
    validateEndpoint.endpointState = endpoint;
    validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : EnumSet.noneOf(TaskOption.class);
    validateEndpoint.options.add(TaskOption.VALIDATE_ONLY);
    EndpointAllocationTaskState validateEndpointTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(EndpointAllocationTaskState.class, validateEndpointTask.documentSelfLink);
}
Also used : EndpointAllocationTaskState(com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) EndpointService(com.vmware.photon.controller.model.resources.EndpointService) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState)

Example 18 with EndpointState

use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.

the class AWSPowerServiceTest method configureEndpoint.

private EndpointState configureEndpoint() throws Throwable {
    EndpointState ep = createEndpointState();
    EndpointAllocationTaskState configureEndpoint = new EndpointAllocationTaskState();
    configureEndpoint.endpointState = ep;
    configureEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
    configureEndpoint.taskInfo = new TaskState();
    configureEndpoint.taskInfo.isDirect = true;
    EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, configureEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
    // outTask.documentSelfLink);
    return outTask.endpointState;
}
Also used : EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) EndpointAllocationTaskState(com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState) EndpointAllocationTaskState(com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState) TaskState(com.vmware.xenon.common.TaskState) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) ResourceRemovalTaskState(com.vmware.photon.controller.model.tasks.ResourceRemovalTaskService.ResourceRemovalTaskState)

Example 19 with EndpointState

use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.

the class AWSPowerServiceTest method createEndpointState.

private EndpointState createEndpointState() {
    EndpointState endpoint = new EndpointState();
    endpoint.endpointType = EndpointType.aws.name();
    endpoint.name = EndpointType.aws.name();
    endpoint.endpointProperties = new HashMap<>();
    endpoint.endpointProperties.put(REGION_KEY, this.regionId);
    endpoint.endpointProperties.put(PRIVATE_KEY_KEY, this.secretKey);
    endpoint.endpointProperties.put(PRIVATE_KEYID_KEY, this.accessKey);
    return endpoint;
}
Also used : EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState)

Example 20 with EndpointState

use of com.vmware.photon.controller.model.resources.EndpointService.EndpointState in project photon-model by vmware.

the class BaseResourceOperationTest method createEndpointState.

private static EndpointState createEndpointState(String endpointType) {
    EndpointState endpoint = new EndpointState();
    endpoint.endpointType = endpointType;
    endpoint.name = endpointType;
    endpoint.tenantLinks = new ArrayList<>(1);
    endpoint.tenantLinks.add("tenant1-link");
    return endpoint;
}
Also used : EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState)

Aggregations

EndpointState (com.vmware.photon.controller.model.resources.EndpointService.EndpointState)69 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)23 Operation (com.vmware.xenon.common.Operation)22 Test (org.junit.Test)16 AuthCredentialsServiceState (com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)15 ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)14 EndpointAllocationTaskState (com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState)13 URI (java.net.URI)13 HashMap (java.util.HashMap)13 Query (com.vmware.xenon.services.common.QueryTask.Query)12 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)11 UriUtils (com.vmware.xenon.common.UriUtils)11 Utils (com.vmware.xenon.common.Utils)11 List (java.util.List)11 ImageState (com.vmware.photon.controller.model.resources.ImageService.ImageState)10 ServiceDocument (com.vmware.xenon.common.ServiceDocument)10 Collectors (java.util.stream.Collectors)10 ResourcePoolState (com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)9 ArrayList (java.util.ArrayList)9 HashSet (java.util.HashSet)9