Search in sources :

Example 1 with VpcService

use of com.cloud.network.vpc.VpcService in project cloudstack by apache.

the class AclOnPrivateGwTest method testExecuteFail.

@Test
public void testExecuteFail() {
    VpcService vpcService = Mockito.mock(VpcService.class);
    createPrivateGwCmd._vpcService = vpcService;
    try {
        Mockito.when(vpcService.applyVpcPrivateGateway(Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(null);
    } catch (ResourceUnavailableException e) {
        e.printStackTrace();
    } catch (ConcurrentOperationException e) {
        e.printStackTrace();
    }
    try {
        createPrivateGwCmd.execute();
    } catch (ServerApiException exception) {
        Assert.assertEquals("Failed to create private gateway", exception.getDescription());
    } catch (ResourceAllocationException e) {
        e.printStackTrace();
    } catch (InsufficientCapacityException e) {
        e.printStackTrace();
    } catch (ConcurrentOperationException e) {
        e.printStackTrace();
    } catch (ResourceUnavailableException e) {
        e.printStackTrace();
    }
}
Also used : VpcService(com.cloud.network.vpc.VpcService) ServerApiException(org.apache.cloudstack.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) Test(org.junit.Test)

Example 2 with VpcService

use of com.cloud.network.vpc.VpcService in project cosmic by MissionCriticalCloud.

the class AclOnPrivateGwTest method testExecuteFail.

@Test
public void testExecuteFail() {
    final VpcService vpcService = Mockito.mock(VpcService.class);
    createPrivateGwCmd._vpcService = vpcService;
    try {
        Mockito.when(vpcService.applyVpcPrivateGateway(Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(null);
    } catch (final ResourceUnavailableException e) {
        e.printStackTrace();
    } catch (final ConcurrentOperationException e) {
        e.printStackTrace();
    }
    try {
        createPrivateGwCmd.execute();
    } catch (final ServerApiException exception) {
        Assert.assertEquals("Failed to create private gateway", exception.getDescription());
    } catch (final ResourceAllocationException e) {
        e.printStackTrace();
    } catch (final InsufficientCapacityException e) {
        e.printStackTrace();
    } catch (final ConcurrentOperationException e) {
        e.printStackTrace();
    } catch (final ResourceUnavailableException e) {
        e.printStackTrace();
    }
}
Also used : VpcService(com.cloud.network.vpc.VpcService) ServerApiException(com.cloud.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) Test(org.junit.Test)

Aggregations

ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)2 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)2 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)2 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)2 VpcService (com.cloud.network.vpc.VpcService)2 Test (org.junit.Test)2 ServerApiException (com.cloud.api.ServerApiException)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1