diff options
author | Mcblain, Thomas <tom.mcblain@att.com> | 2019-07-17 18:42:01 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-07-17 18:42:07 -0400 |
commit | 6e6fff1598e03d24e3b528049534d3dfb2280e99 (patch) | |
tree | 4c32a48da6e81dc18730ed69ba861257b5496efa | |
parent | 785c77ae295b287678d4842269222c31b3e4c330 (diff) |
Add requestContext to unassignVfModule tasks and
Add requestContext to unassignVfModule tasks and tests
Issue-ID: SO-2115
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Change-Id: Ifddfe32fab9406afb69ad9192351500cfbed3610
4 files changed, 14 insertions, 10 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java index 7d5591af0f..4721bf56f1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java @@ -91,16 +91,18 @@ public class SDNCUnassignTasks { public void unassignVfModule(BuildingBlockExecution execution) { try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + RequestContext requestContext = gBBInput.getRequestContext(); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); SDNCRequest sdncRequest = new SDNCRequest(); UriBuilder builder = UriBuilder.fromPath(env.getRequiredProperty("mso.workflow.message.endpoint")) .path(sdncRequest.getCorrelationName()).path(sdncRequest.getCorrelationValue()); URI uri = builder.build(); GenericResourceApiVfModuleOperationInformation req = - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, uri); + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, uri); sdncRequest.setSDNCPayload(req); sdncRequest.setTopology(SDNCTopology.VFMODULE); execution.setVariable(SDNC_REQUEST, sdncRequest); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java index b83a4d5628..b3ea18df58 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java @@ -60,9 +60,9 @@ public class SDNCVfModuleResources { } public GenericResourceApiVfModuleOperationInformation unassignVfModule(VfModule vfModule, GenericVnf vnf, - ServiceInstance serviceInstance, URI callbackURI) throws MapperException { + ServiceInstance serviceInstance, RequestContext requestContext, URI callbackURI) throws MapperException { return sdncRM.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, - vnf, serviceInstance, null, null, null, null, callbackURI); + vnf, serviceInstance, null, null, requestContext, null, callbackURI); } public GenericResourceApiVfModuleOperationInformation deactivateVfModule(VfModule vfModule, GenericVnf vnf, 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 10c034dc36..b29d15c830 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 @@ -106,11 +106,11 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { @Test public void unassignVfModuleTest() throws Exception { - doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources) - .unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), any(URI.class)); + doReturn(new GenericResourceApiVfModuleOperationInformation()).when(sdncVfModuleResources).unassignVfModule( + eq(vfModule), eq(genericVnf), eq(serviceInstance), eq(requestContext), any(URI.class)); sdncUnassignTasks.unassignVfModule(execution); verify(sdncVfModuleResources, times(1)).unassignVfModule(eq(vfModule), eq(genericVnf), eq(serviceInstance), - any(URI.class)); + eq(requestContext), any(URI.class)); SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); assertEquals(SDNCTopology.VFMODULE, sdncRequest.getTopology()); } @@ -119,7 +119,7 @@ public class SDNCUnassignTasksTest extends BaseTaskTest { public void unassignVfModuleExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(sdncVfModuleResources).unassignVfModule(eq(vfModule), eq(genericVnf), - eq(serviceInstance), any(URI.class)); + eq(serviceInstance), eq(requestContext), 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 57d6496a4f..14e993281a 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 @@ -98,10 +98,12 @@ public class SDNCVfModuleResourcesTest extends TestDataSetup { @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, testURI); - sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, testURI); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null, + testURI); + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance, requestContext, testURI); verify(vfModuleTopologyMapper, times(1)).reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, - SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, null, null, testURI); + SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, null, requestContext, null, + testURI); } @Test |