use of org.onap.so.adapters.nwrest.RollbackNetworkResponse in project so by onap.
the class NetworkAdapterClientIT method rollbackNetworkTest.
@Test
public void rollbackNetworkTest() throws NetworkAdapterClientException, JsonProcessingException {
RollbackNetworkRequest request = new RollbackNetworkRequest();
NetworkRollback rollback = new NetworkRollback();
rollback.setCloudId(TESTING_ID);
request.setNetworkRollback(rollback);
RollbackNetworkResponse mockResponse = new RollbackNetworkResponse();
mockResponse.setNetworkRolledBack(true);
wireMockServer.stubFor(delete(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(mapper.writeValueAsString(mockResponse)).withStatus(200)));
RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request);
assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack());
}
use of org.onap.so.adapters.nwrest.RollbackNetworkResponse in project so by onap.
the class NetworkAdapterResourcesTest method rollbackCreateNetworkTest.
@Test
public void rollbackCreateNetworkTest() throws Exception {
String cloudRegionPo = "cloudRegionPo";
RollbackNetworkResponse expectedRollbackNetworkResponse = new RollbackNetworkResponse();
expectedRollbackNetworkResponse.setMessageId("messageId");
expectedRollbackNetworkResponse.setNetworkRolledBack(true);
RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
rollbackNetworkRequest.setMessageId("messageId");
RollbackNetworkResponse rollbackNetworkResponse = new RollbackNetworkResponse();
rollbackNetworkResponse.setMessageId("messageId");
rollbackNetworkResponse.setNetworkRolledBack(true);
CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse();
createNetworkResponse.setMessageId("messageId");
doReturn(rollbackNetworkResponse).when(MOCK_networkAdapterClient).rollbackNetwork(isA(String.class), isA(RollbackNetworkRequest.class));
doReturn(rollbackNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRollbackRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(CreateNetworkResponse.class));
RollbackNetworkResponse actualRollbackCreateNetwrokResponse = (networkAdapterResources.rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse)).get();
verify(MOCK_networkAdapterClient, times(1)).rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest);
verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse);
assertThat(expectedRollbackNetworkResponse, Matchers.sameBeanAs(actualRollbackCreateNetwrokResponse));
}
Aggregations