Search in sources :

Example 1 with UpdateVolumeGroupResponse

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

the class VnfVolumeAdapterClientIT method updateVolumeGroupTest.

@Test
public void updateVolumeGroupTest() throws VnfAdapterClientException {
    UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
    UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse();
    mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID);
    VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
    AdapterRestClient mockClient = mock(AdapterRestClient.class);
    doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
    when(mockClient.put(request, UpdateVolumeGroupResponse.class)).thenReturn(mockResponse);
    MockitoAnnotations.initMocks(this);
    UpdateVolumeGroupResponse response = client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request);
    assertEquals("Testing DeleteVfModule response", mockResponse.getVolumeGroupId(), response.getVolumeGroupId());
}
Also used : AdapterRestClient(org.onap.so.client.adapter.rest.AdapterRestClient) UpdateVolumeGroupResponse(org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse) UpdateVolumeGroupRequest(org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 2 with UpdateVolumeGroupResponse

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

the class VnfVolumeAdapterClientIT method updateVolumeGroupTestThrowException.

@Test(expected = VnfAdapterClientException.class)
public void updateVolumeGroupTestThrowException() throws VnfAdapterClientException {
    UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
    UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse();
    mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID);
    VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class);
    AdapterRestClient mockClient = mock(AdapterRestClient.class);
    doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID);
    when(mockClient.put(request, UpdateVolumeGroupResponse.class)).thenThrow(new InternalServerErrorException("Error in update volume group"));
    MockitoAnnotations.initMocks(this);
    client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request);
}
Also used : AdapterRestClient(org.onap.so.client.adapter.rest.AdapterRestClient) UpdateVolumeGroupResponse(org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) UpdateVolumeGroupRequest(org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Aggregations

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