Search in sources :

Example 1 with RollbackVolumeGroupResponse

use of org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse in project so by onap.

the class VnfVolumeAdapterClientIT method rollbackVolumeGroupTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void rollbackVolumeGroupTestThrowException() throws VnfAdapterClientException {
    RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
    RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse();
    mockResponse.setVolumeGroupRolledBack(true);
    VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
    AdapterRestClient mockClient = mock(AdapterRestClient.class);
    doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback");
    when(mockClient.delete(request, RollbackVolumeGroupResponse.class)).thenThrow(new InternalServerErrorException("Error in rollback volume group"));
    MockitoAnnotations.initMocks(this);
    client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request);
}
Also used : AdapterRestClient(org.onap.so.client.adapter.rest.AdapterRestClient) RollbackVolumeGroupRequest(org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) RollbackVolumeGroupResponse(org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 2 with RollbackVolumeGroupResponse

use of org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse in project so by onap.

the class VnfVolumeAdapterClientIT method rollbackVolumeGroupTest.

@Test
public void rollbackVolumeGroupTest() throws VnfAdapterClientException {
    RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
    RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse();
    mockResponse.setVolumeGroupRolledBack(true);
    VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
    AdapterRestClient mockClient = mock(AdapterRestClient.class);
    doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback");
    when(mockClient.delete(request, RollbackVolumeGroupResponse.class)).thenReturn(mockResponse);
    MockitoAnnotations.initMocks(this);
    RollbackVolumeGroupResponse response = client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request);
    assertEquals("Testing RollbackVolumeGroup response", mockResponse.getVolumeGroupRolledBack(), response.getVolumeGroupRolledBack());
}
Also used : AdapterRestClient(org.onap.so.client.adapter.rest.AdapterRestClient) RollbackVolumeGroupRequest(org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest) RollbackVolumeGroupResponse(org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Aggregations

Test (org.junit.Test)2 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 RollbackVolumeGroupRequest (org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest)2 RollbackVolumeGroupResponse (org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse)2 AdapterRestClient (org.onap.so.client.adapter.rest.AdapterRestClient)2 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)1