Search in sources :

Example 1 with ProvisionLoadBalancerTaskState

use of com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState in project photon-model by vmware.

the class AzureLoadBalancerServiceTest method testCreateLoadBalancerWithInvalidNICTarget.

@Test
public void testCreateLoadBalancerWithInvalidNICTarget() throws Throwable {
    if (!this.isMock) {
        LoadBalancerState loadBalancerState = createLoadBalancerState(this.loadBalancerName, LoadBalancerTargetType.INVALID);
        ProvisionLoadBalancerTaskState provisionLoadBalancerTaskState = startLoadBalancerProvisioning(LoadBalancerInstanceRequest.InstanceRequestType.CREATE, loadBalancerState, TaskStage.FAILED);
        assertTrue(provisionLoadBalancerTaskState.taskInfo.stage == TaskStage.FAILED);
        assertEquals("java.lang.IllegalArgumentException: Invalid target type specified", provisionLoadBalancerTaskState.taskInfo.failure.message);
    }
}
Also used : LoadBalancerState(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState) ProvisionLoadBalancerTaskState(com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState) AzureBaseTest(com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest) Test(org.junit.Test)

Example 2 with ProvisionLoadBalancerTaskState

use of com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState in project photon-model by vmware.

the class AzureLoadBalancerServiceTest method startLoadBalancerProvisioning.

private ProvisionLoadBalancerTaskState startLoadBalancerProvisioning(LoadBalancerInstanceRequest.InstanceRequestType requestType, LoadBalancerState loadBalancerState, TaskStage expectedTaskState) throws Throwable {
    ProvisionLoadBalancerTaskState taskState = new ProvisionLoadBalancerTaskState();
    taskState.requestType = requestType;
    taskState.loadBalancerLink = loadBalancerState.documentSelfLink;
    taskState.isMockRequest = this.isMock;
    // Start/Post lb provisioning task
    taskState = postServiceSynchronously(FACTORY_LINK, taskState, ProvisionLoadBalancerTaskState.class);
    // Wait for provisioning task to complete
    return waitForServiceState(ProvisionLoadBalancerTaskState.class, taskState.documentSelfLink, liveState -> testServiceState(liveState, expectedTaskState));
}
Also used : ProvisionLoadBalancerTaskState(com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState)

Example 3 with ProvisionLoadBalancerTaskState

use of com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState in project photon-model by vmware.

the class AWSLoadBalancerServiceTest method kickOffLoadBalancerProvision.

private ProvisionLoadBalancerTaskState kickOffLoadBalancerProvision(InstanceRequestType requestType, String loadBalancerLink, TaskStage expectedTaskState) throws Throwable {
    ProvisionLoadBalancerTaskState taskState = new ProvisionLoadBalancerTaskState();
    taskState.requestType = requestType;
    taskState.loadBalancerLink = loadBalancerLink;
    taskState.isMockRequest = this.isMock;
    // Start/Post load balancer provisioning task
    taskState = postServiceSynchronously(ProvisionLoadBalancerTaskService.FACTORY_LINK, taskState, ProvisionLoadBalancerTaskState.class);
    // Wait for the task to complete
    taskState = waitForFinishedTask(ProvisionLoadBalancerTaskState.class, taskState.documentSelfLink);
    assertEquals(expectedTaskState, taskState.taskInfo.stage);
    return taskState;
}
Also used : ProvisionLoadBalancerTaskState(com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState)

Aggregations

ProvisionLoadBalancerTaskState (com.vmware.photon.controller.model.tasks.ProvisionLoadBalancerTaskService.ProvisionLoadBalancerTaskState)3 AzureBaseTest (com.vmware.photon.controller.model.adapters.azure.base.AzureBaseTest)1 LoadBalancerState (com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState)1 Test (org.junit.Test)1