use of com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState in project photon-model by vmware.
the class EndpointServiceTests method testShouldFailOnMissingData.
public void testShouldFailOnMissingData(EndpointService.EndpointState ep) throws Throwable {
ep.endpointProperties.clear();
EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
validateEndpoint.endpointState = ep;
validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
EndpointAllocationTaskState failedTask = this.host.waitForFailedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
assertEquals(failedTask.taskInfo.stage, TaskState.TaskStage.FAILED);
}
use of com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState 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;
}
use of com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState in project photon-model by vmware.
the class AzureSubscriptionsEnumerationServiceTest method createEndpoint.
private EndpointAllocationTaskState createEndpoint(EndpointState endpointState) throws Throwable {
EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
validateEndpoint.endpointState = endpointState;
validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
validateEndpoint.tenantLinks = Collections.singletonList(TENANT_ID);
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
EndpointAllocationTaskState taskState = getServiceSynchronously(outTask.documentSelfLink, EndpointAllocationTaskState.class);
return taskState;
}
use of com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState in project photon-model by vmware.
the class AzureSubscriptionEndpointsEnumerationServiceTest method setUp.
@Before
public void setUp() throws Exception {
this.host = VerificationHost.create(0);
this.isMock = true;
this.createdEndpointLinks = new ArrayList<>();
try {
this.host.start();
PhotonModelServices.startServices(this.host);
PhotonModelMetricServices.startServices(this.host);
PhotonModelAdaptersRegistryAdapters.startServices(this.host);
PhotonModelTaskServices.startServices(this.host);
this.host.startService(new AzureSubscriptionEndpointsEnumerationService());
AzureAdaptersTestUtils.startServicesSynchronouslyEaAzure(this.host);
this.host.waitForServiceAvailable(PhotonModelServices.LINKS);
this.host.waitForServiceAvailable(PhotonModelTaskServices.LINKS);
this.host.waitForServiceAvailable(PhotonModelMetricServices.LINKS);
this.host.waitForServiceAvailable(AzureSubscriptionEndpointsEnumerationService.SELF_LINK);
this.host.setTimeoutSeconds(600);
// Create an Azure endpoint which will act as Azure EA endpoint
EndpointState ep = createEndpointState();
EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
validateEndpoint.endpointState = ep;
validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
validateEndpoint.tenantLinks = Collections.singletonList(TENANT_ID);
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
EndpointAllocationTaskState taskState = getServiceSynchronously(outTask.documentSelfLink, EndpointAllocationTaskState.class);
this.endpointLink = taskState.endpointState.documentSelfLink;
this.computeLink = taskState.endpointState.computeLink;
this.compute = getServiceSynchronously(this.computeLink, ComputeState.class);
} catch (Throwable e) {
throw new Exception(e);
}
}
use of com.vmware.photon.controller.model.tasks.EndpointAllocationTaskService.EndpointAllocationTaskState in project photon-model by vmware.
the class AzureSubscriptionEndpointCreationServiceTest method setUp.
@Before
public void setUp() throws Exception {
try {
this.host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros(10));
PhotonModelServices.startServices(this.host);
PhotonModelAdaptersRegistryAdapters.startServices(this.host);
PhotonModelMetricServices.startServices(this.host);
PhotonModelTaskServices.startServices(this.host);
this.host.startService(new AzureSubscriptionEndpointCreationService());
AzureAdaptersTestUtils.startServicesSynchronouslyEaAzure(this.host);
this.host.setTimeoutSeconds(300);
this.host.waitForServiceAvailable(PhotonModelServices.LINKS);
this.host.waitForServiceAvailable(PhotonModelTaskServices.LINKS);
this.host.waitForServiceAvailable(AzureSubscriptionEndpointCreationService.SELF_LINK);
EndpointState ep = createEndpointState();
// Create the Azure Ea Endpoint for the test
EndpointAllocationTaskState validateEndpoint = new EndpointAllocationTaskState();
validateEndpoint.endpointState = ep;
validateEndpoint.options = this.isMock ? EnumSet.of(TaskOption.IS_MOCK) : null;
validateEndpoint.tenantLinks = Collections.singletonList(TENANT_ID);
EndpointAllocationTaskState outTask = TestUtils.doPost(this.host, validateEndpoint, EndpointAllocationTaskState.class, UriUtils.buildUri(this.host, EndpointAllocationTaskService.FACTORY_LINK));
this.host.waitForFinishedTask(EndpointAllocationTaskState.class, outTask.documentSelfLink);
EndpointAllocationTaskState taskState = getServiceSynchronously(outTask.documentSelfLink, EndpointAllocationTaskState.class);
this.eaEndPointLink = taskState.endpointState.documentSelfLink;
} catch (Throwable e) {
throw new Exception(e);
}
}
Aggregations