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);
}
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());
}
Aggregations