Search in sources :

Example 1 with RollbackNetworkResponse

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());
}
Also used : RollbackNetworkResponse(org.onap.so.adapters.nwrest.RollbackNetworkResponse) NetworkRollback(org.onap.so.openstack.beans.NetworkRollback) RollbackNetworkRequest(org.onap.so.adapters.nwrest.RollbackNetworkRequest) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 2 with RollbackNetworkResponse

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));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) RollbackNetworkResponse(org.onap.so.adapters.nwrest.RollbackNetworkResponse) CreateNetworkResponse(org.onap.so.adapters.nwrest.CreateNetworkResponse) RollbackNetworkRequest(org.onap.so.adapters.nwrest.RollbackNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Map(java.util.Map) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 RollbackNetworkRequest (org.onap.so.adapters.nwrest.RollbackNetworkRequest)2 RollbackNetworkResponse (org.onap.so.adapters.nwrest.RollbackNetworkResponse)2 Map (java.util.Map)1 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)1 CreateNetworkResponse (org.onap.so.adapters.nwrest.CreateNetworkResponse)1 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)1 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)1 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)1 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)1 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)1 NetworkRollback (org.onap.so.openstack.beans.NetworkRollback)1