diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-06-14 09:26:20 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-06-14 09:26:26 -0400 |
commit | 8b06e24621ebfa9b34b39e7a325b0780dbad7a76 (patch) | |
tree | 0a7be1d892444ba19603e7227675b430bd634b03 /bpmn/so-bpmn-tasks/src/test | |
parent | 1f8aa8ef6deade96a53fa57c28d1aacab6cf7e5e (diff) |
support async operation for vf module operations
support async operation for vf module operations with sdnc
Update Junit comparison data to be valid for new code
Modify coded to support usage of ASYNC response sdnc
Change-Id: I95b955cb257dcead152d68cd4cc4fb0fbcdfd708
Issue-ID: SO-2015
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
10 files changed, 87 insertions, 61 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java index 4eb1432bbf..ffd4f74b63 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -29,6 +29,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.URI; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; @@ -85,7 +86,10 @@ public class SDNCActivateTaskTest extends BaseTaskTest { when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); + when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) + .thenReturn(serviceInstance); + when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090"); } @Test @@ -129,11 +133,12 @@ public class SDNCActivateTaskTest extends BaseTaskTest { @Test public void activateVfModuleTest() throws Exception { - doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).activateVfModule( + eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), + any(URI.class)); sdncActivateTasks.activateVfModule(execution); - verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + verify(sdncVfModuleResources, times(1)).activateVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -141,8 +146,8 @@ public class SDNCActivateTaskTest extends BaseTaskTest { @Test public void activateVfModuleTestException() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVfModuleResources).activateVfModule(eq(vfModule), eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncActivateTasks.activateVfModule(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index 7d8e94d1e9..982868dcbc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -28,6 +28,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.URI; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; @@ -89,6 +90,7 @@ public class SDNCAssignTasksTest extends BaseTaskTest { .thenReturn(serviceInstance); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID))) .thenReturn(volumeGroup); + when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090"); } @Test @@ -132,10 +134,11 @@ public class SDNCAssignTasksTest extends BaseTaskTest { @Test public void assignVfModuleTest() throws Exception { doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).assignVfModule( - vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + eq(vfModule), eq(volumeGroup), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), + eq(requestContext), any(URI.class)); sdncAssignTasks.assignVfModule(execution); - verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, - customer, cloudRegion, requestContext); + verify(sdncVfModuleResources, times(1)).assignVfModule(eq(vfModule), eq(volumeGroup), eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -143,8 +146,8 @@ public class SDNCAssignTasksTest extends BaseTaskTest { @Test public void assignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVfModuleResources).assignVfModule(eq(vfModule), eq(volumeGroup), + eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncAssignTasks.assignVfModule(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java index 1c1616a472..8c25bea801 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -27,6 +27,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.URI; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; @@ -74,6 +75,7 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest { when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); + when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090"); } @Test @@ -97,11 +99,12 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest { @Test public void changeAssignModelVfModuleTest() throws Exception { - doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).changeAssignVfModule( + eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), + any(URI.class)); sdncChangeAssignTasks.changeAssignModelVfModule(execution); - verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + verify(sdncVfModuleResources, times(1)).changeAssignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -109,8 +112,8 @@ public class SDNCChangeAssignTasksTest extends BaseTaskTest { @Test public void changeAssignModelVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVfModuleResources).changeAssignVfModule(eq(vfModule), eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncChangeAssignTasks.changeAssignModelVfModule(execution); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java index 08d4d196da..d8a1b0182e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -28,6 +28,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.URI; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; @@ -81,16 +82,17 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); - + when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090"); } @Test public void deactivateVfModuleTest() throws Exception { - doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).deactivateVfModule( + eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), + any(URI.class)); sdncDeactivateTasks.deactivateVfModule(execution); - verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, - cloudRegion, requestContext); + verify(sdncVfModuleResources, times(1)).deactivateVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), + eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -98,8 +100,8 @@ public class SDNCDeactivateTaskTest extends BaseTaskTest { @Test public void deactivateVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, - serviceInstance, customer, cloudRegion, requestContext); + doThrow(RuntimeException.class).when(sdncVfModuleResources).deactivateVfModule(eq(vfModule), eq(genericVnf), + eq(serviceInstance), eq(customer), eq(cloudRegion), eq(requestContext), any(URI.class)); sdncDeactivateTasks.deactivateVfModule(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index b5d34ea4c9..6a94b357e0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -23,8 +23,6 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import java.io.IOException; import java.io.StringReader; import java.nio.file.Files; @@ -39,7 +37,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; @@ -69,6 +66,7 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks { @Mock SDNCClient sdncClient; + @Spy private ExceptionBuilder exceptionBuilder; @@ -151,7 +149,7 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks { db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(new StringReader(sdncResponse))); - String finalMessageIndicator = getXmlElement(doc, "/input/ack-final-indicator"); + String finalMessageIndicator = getXmlElement(doc, "//*:ack-final-indicator"); String responseCode = getXmlElement(doc, "/input/response-code"); String responseMessage = getXmlElement(doc, "/input/response-message"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java index 968723c628..10c034dc36 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -29,6 +29,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.net.URI; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; @@ -81,6 +82,7 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); + when(env.getRequiredProperty("mso.workflow.message.endpoint")).thenReturn("http://localhost:9090"); } @Test @@ -105,9 +107,10 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVfModuleTest() throws Exception { doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .unassignVfModule(vfModule, genericVnf, serviceInstance); + .unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), any(URI.class)); sdncUnassignTasks.unassignVfModule(execution); - verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance); + verify(sdncVfModuleResources, times(1)).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), + any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -115,8 +118,8 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); - doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, - serviceInstance); + doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(eq(vfModule), eq(genericVnf), + eq(serviceInstance), any(URI.class)); sdncUnassignTasks.unassignVfModule(execution); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java index 2b45a3302c..57d6496a4f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java @@ -23,6 +23,8 @@ package org.onap.so.client.orchestration; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.net.URI; +import java.net.URISyntaxException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -62,6 +64,8 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup { private RequestContext requestContext; private GenericResourceApiVfModuleOperationInformation sdncReq; + private URI testURI; + @Before public void before() { vfModule = buildVfModule(); @@ -72,60 +76,67 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup { cloudRegion = buildCloudRegion(); requestContext = buildRequestContext(); sdncReq = new GenericResourceApiVfModuleOperationInformation(); + try { + testURI = new URI("http://localhost:9800"); + } catch (URISyntaxException e) { + + } } @Test public void assignVfModuleTest() throws MapperException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, - requestContext, null); + requestContext, null, testURI); sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, - requestContext); + requestContext, testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, - requestContext, null); + requestContext, null, testURI); } @Test public void unassignVfModuleTest() throws MapperException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null); - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null, testURI); + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null, testURI); } @Test public void activateVfModuleTest() throws MapperException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, - null); - sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + null, testURI); + sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, + testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, - null); + null, testURI); } @Test public void deactivateVfModuleTest() throws MapperException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, - null); - sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + null, testURI); + sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, + testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, vfModule, null, vnf, serviceInstance, customer, cloudRegion, requestContext, - null); + null, testURI); } @Test public void changeAssignVfModuleTest() throws MapperException, BadResponseException { doReturn(sdncReq).when(vfModuleTopologyMapper).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, - requestContext, null); + requestContext, null, testURI); sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, - requestContext); + requestContext, testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, vfModule, null, vnf, serviceInstance, customer, cloudRegion, - requestContext, null); + requestContext, null, testURI); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java index 275e9f7dbb..b71ddba63b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -25,6 +25,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.net.URI; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; @@ -38,6 +39,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -53,7 +55,6 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCSvcAction; import org.onap.so.client.sdnc.beans.SDNCSvcOperation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) @@ -134,9 +135,9 @@ public class VfModuleTopologyOperationRequestMapperTest { CloudRegion cloudRegion = new CloudRegion(); - GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = - mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, - volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext, null); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, + serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080")); String jsonToCompare = new String(Files.readAllBytes( Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json"))); @@ -145,7 +146,7 @@ public class VfModuleTopologyOperationRequestMapperTest { GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue(jsonToCompare, GenericResourceApiVfModuleOperationInformation.class); - assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + assertThat(vfModuleSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId()); } @@ -174,7 +175,7 @@ public class VfModuleTopologyOperationRequestMapperTest { GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, - vnf, serviceInstance, null, null, requestContext, null); + vnf, serviceInstance, null, null, requestContext, null, new URI("http://localhost:8080")); String jsonToCompare = new String(Files.readAllBytes( Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json"))); @@ -183,7 +184,7 @@ public class VfModuleTopologyOperationRequestMapperTest { GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue(jsonToCompare, GenericResourceApiVfModuleOperationInformation.class); - assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + assertThat(vfModuleSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId") .ignoring("requestInformation.requestId")); assertEquals("MsoRequestId", vfModuleSDNCrequest.getRequestInformation().getRequestId()); } @@ -211,7 +212,7 @@ public class VfModuleTopologyOperationRequestMapperTest { GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, - vnf, serviceInstance, null, null, requestContext, null); + vnf, serviceInstance, null, null, requestContext, null, new URI("http://localhost:8080")); assertNotNull(vfModuleSDNCrequest.getRequestInformation().getRequestId()); } @@ -271,9 +272,9 @@ public class VfModuleTopologyOperationRequestMapperTest { CloudRegion cloudRegion = new CloudRegion(); - GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = - mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, - vnf, serviceInstance, customer, cloudRegion, requestContext, null); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, + serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080")); assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); assertEquals("vnfModelCustomizationUuid", @@ -330,7 +331,7 @@ public class VfModuleTopologyOperationRequestMapperTest { expectedException.expectMessage(ERRORMESSAGE); mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, - serviceInstance, customer, cloudRegion, requestContext, null); + serviceInstance, customer, cloudRegion, requestContext, null, new URI("http://localhost:8080")); } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json index 777f3444d2..53c1997126 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json @@ -43,7 +43,7 @@ }, "sdnc-request-header" : { "svc-request-id" : "svcRequestId", - "svc-notification-url" : null, + "svc-notification-url" : "http://localhost:8080", "svc-action" : "assign" }, "vf-module-information" : { diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json index c28b0fa689..9f93c0df1f 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json @@ -17,7 +17,7 @@ }, "sdnc-request-header" : { "svc-request-id" : "svcRequestId", - "svc-notification-url" : null, + "svc-notification-url" : "http://localhost:8080", "svc-action" : "unassign" }, "vf-module-information" : { |