diff options
author | deepikasatheesh <deepika.s84@wipro.com> | 2022-02-22 11:58:53 +0000 |
---|---|---|
committer | deepikasatheesh <deepika.s84@wipro.com> | 2022-03-03 08:39:56 +0000 |
commit | f646731541eb0a720c83da2d7b8e70a33ca2fbe6 (patch) | |
tree | 453d4f1e81824c06cbf29cf5871d0384265da2db /bpmn/so-bpmn-infrastructure-common/src/test/groovy/org | |
parent | 8b0276d4f5b0d7a1a9167916b027b795f86d44e5 (diff) |
Implemented OOF call in TN NSSMF for deallocate flow
Issue-ID: SO-3864
Signed-off-by: deepikasatheesh <deepika.s84@wipro.com>
Change-Id: Ibb7342a2eb6adb44c5a03e717e908699997e79b4
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/groovy/org')
-rw-r--r-- | bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy index 31bd3b56f5..2bb2270928 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy @@ -32,8 +32,10 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.common.scripts.OofUtils import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* @@ -135,4 +137,41 @@ class DoDeallocateTnNssiTest extends MsoGroovyTest { obj.deleteServiceInstance(mockExecution) Mockito.verify(client, times(1)).delete(serviceInstanceUri) } + + @Test + void testPrepareOOFNssiTerminationRequest() { + when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("") + DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class) + OofUtils oofUtils = spy(OofUtils.class) + when(oofUtils.buildTerminateNxiRequest()).thenReturn(""" + { + "apiPath": "/api/oof/terminate/nxi/v1", + "requestDetails": "{\"type\":\"NSSI\",\"NxIId\":\"f78c1531-55a7-4dfa-8a12-1e2544c9b248\",\"requestInfo\":{\"transactionId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"requestId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"callbackUrl\":\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/TN_NSSITermination/863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"sourceId\":\"SO\",\"timeout\":600,\"addtnlArgs\":{\"serviceInstanceId\":\"fe6f0901-292d-4493-bcad-485793605781\"}}}" + }""".replaceAll("\\\\s+", "")) + obj.prepareOOFNssiTerminationRequest(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("oofTnNssiPayload"), captor.capture()) + String oofTnNssiPayload = captor.getValue() + assertNotNull(oofTnNssiPayload) + } + + @Test + void testPerformOofNSSITerminationCall() { + when(mockExecution.getVariable("oofTnNssiPayload")).thenReturn(""" + { + "reason": "", + "requestId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5", + "requestStatus": "success", + "terminateResponse": true, + "transactionId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5" + }""".replaceAll("\\\\s+", "")) + DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class) + when(obj.callOofAdapter()).thenReturn(true) + obj.performOofNSSITerminationCall(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("terminateTnNSSI"), captor.capture()) + String terminateTnNSSI = captor.getValue() + assertTrue(terminateTnNSSI) + } } |