Search in sources :

Example 6 with UpdateNetworkResponse

use of org.onap.so.adapters.nwrest.UpdateNetworkResponse in project so by onap.

the class NetworkAdapterResourcesTest method updateNetworkTest.

@Test
public void updateNetworkTest() throws UnsupportedEncodingException, NetworkAdapterClientException {
    doReturn(new UpdateNetworkRequest()).when(MOCK_networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class));
    doReturn(new UpdateNetworkResponse()).when(MOCK_networkAdapterClient).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
    Optional<UpdateNetworkResponse> actualUpdateNetworkResponse = networkAdapterResources.updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
    verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
    verify(MOCK_networkAdapterClient, times(1)).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class));
    assertNotNull(actualUpdateNetworkResponse);
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) UpdateNetworkRequest(org.onap.so.adapters.nwrest.UpdateNetworkRequest) 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) UpdateNetworkResponse(org.onap.so.adapters.nwrest.UpdateNetworkResponse) Test(org.junit.Test)

Example 7 with UpdateNetworkResponse

use of org.onap.so.adapters.nwrest.UpdateNetworkResponse in project so by onap.

the class AAIUpdateTasksTest method updateNetworkUpdatedTest.

@Test
public void updateNetworkUpdatedTest() throws Exception {
    UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse();
    updateNetworkResponse.setNeutronNetworkId("testNeutronNetworkId");
    HashMap<String, String> subnetMap = new HashMap<>();
    subnetMap.put("testSubnetId", "testNeutronSubnetId");
    updateNetworkResponse.setSubnetMap(subnetMap);
    network.getSubnets().add(subnet);
    execution.setVariable("updateNetworkResponse", updateNetworkResponse);
    doNothing().when(aaiNetworkResources).updateNetwork(network);
    doNothing().when(aaiNetworkResources).updateSubnet(network, subnet);
    aaiUpdateTasks.updateNetworkUpdated(execution);
    verify(aaiNetworkResources, times(1)).updateNetwork(network);
    verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet);
    String neutronSubnetId = updateNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue();
    assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId());
}
Also used : HashMap(java.util.HashMap) UpdateNetworkResponse(org.onap.so.adapters.nwrest.UpdateNetworkResponse) Test(org.junit.Test)

Aggregations

UpdateNetworkResponse (org.onap.so.adapters.nwrest.UpdateNetworkResponse)7 Test (org.junit.Test)4 UpdateNetworkRequest (org.onap.so.adapters.nwrest.UpdateNetworkRequest)4 DeleteNetworkResponse (org.onap.so.adapters.nwrest.DeleteNetworkResponse)3 HashMap (java.util.HashMap)2 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)2 CreateNetworkResponse (org.onap.so.adapters.nwrest.CreateNetworkResponse)2 WireMock.aResponse (com.github.tomakehurst.wiremock.client.WireMock.aResponse)1 StringReader (java.io.StringReader)1 Map (java.util.Map)1 Response (javax.ws.rs.core.Response)1 JAXBException (javax.xml.bind.JAXBException)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1 CreateNetworkRequest (org.onap.so.adapters.nwrest.CreateNetworkRequest)1 DeleteNetworkRequest (org.onap.so.adapters.nwrest.DeleteNetworkRequest)1 QueryNetworkResponse (org.onap.so.adapters.nwrest.QueryNetworkResponse)1 RollbackNetworkRequest (org.onap.so.adapters.nwrest.RollbackNetworkRequest)1 RollbackNetworkResponse (org.onap.so.adapters.nwrest.RollbackNetworkResponse)1 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)1 CreateVolumeGroupRequest (org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest)1