diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-11 14:56:03 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-11 14:56:19 -0500 |
commit | a9ceeefef9a561937b42ed23bc5797930d5efefe (patch) | |
tree | 3e878cb893deecd8e8f310297cfa22078da3611e /bpmn/MSOCommonBPMN | |
parent | b80f29cbbeb5ec218b0278deef872f7b5350e292 (diff) |
restructured a&ai client
made generics a bit safer and updated groovy tests
Change-Id: I6d7a2567cd9bf795e0cfa4914a7674a4ed5f50c4
Issue-ID: SO-1493
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
3 files changed, 10 insertions, 10 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy index 55f68f665e..dac038fab3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleTest.groovy @@ -97,7 +97,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ @Test void testCreateGenericVnf(){ when(mockExecution.getVariable("CAAIVfMod_vnfName")).thenReturn("vnfName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createGenericVnf(mockExecution) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createGenericVnfResponse","Vnf Created") @@ -112,7 +112,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ when(mockExecution.getVariable("CAAIVfMod_personaId")).thenReturn("model1") when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createVfModule(mockExecution,false) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created") @@ -173,7 +173,7 @@ class CreateAAIVfModuleTest extends MsoGroovyTest{ Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnfVfModule.json"); when(mockExecution.getVariable("CAAIVfMod_queryGenericVnfResponse")).thenReturn(genericVnf.get()) when(mockExecution.getVariable("CAAIVfMod_moduleName")).thenReturn("vfModuleName") - Mockito.doNothing().when(client).create(any(AAIResourceUri.class),anyObject()) + Mockito.doNothing().when(client).create(any(AAIResourceUri.class) as AAIResourceUri,anyObject()) createAAIVfModule.createVfModule(mockExecution,true) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponseCode", 201) Mockito.verify(mockExecution).setVariable("CAAIVfMod_createVfModuleResponse","Vf Module Created") diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy index 4b6f8aa918..2a872511e7 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModuleTest.groovy @@ -92,7 +92,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ void testDeleteGenericVnf() { ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") - doNothing().when(client).delete(isA(AAIResourceUri.class)) + doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteGenericVnf(mockExecution) Mockito.verify(mockExecution).setVariable(prefix + "deleteGenericVnfResponseCode", 200) } @@ -169,7 +169,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") try { - doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class)) + doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteGenericVnf(mockExecution) } catch (Exception ex) { println " Test End - Handle catch-throw BpmnError()! " @@ -186,7 +186,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1") - doNothing().when(client).delete(isA(AAIResourceUri.class)) + doNothing().when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteVfModule(mockExecution) Mockito.verify(mockExecution).setVariable(prefix + "deleteVfModuleResponseCode", 200) } @@ -197,7 +197,7 @@ class DeleteAAIVfModuleTest extends MsoGroovyTest{ when(mockExecution.getVariable("DAAIVfMod_vnfId")).thenReturn("vnfId1") when(mockExecution.getVariable("DAAIVfMod_vfModuleId")).thenReturn("vfModuleId1") try { - doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class)) + doThrow(new NotFoundException("Vnf Not Found")).when(client).delete(isA(AAIResourceUri.class) as AAIResourceUri) deleteAAIVfModule.deleteVfModule(mockExecution) } catch (Exception ex) { println " Test End - Handle catch-throw BpmnError()! " diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy index 2d2f58b415..72bcfcf359 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModuleTest.groovy @@ -111,7 +111,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doNothing().when(client).update(isA(AAIResourceUri.class), anyObject()) + doNothing().when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 200) } @@ -126,7 +126,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class), anyObject()) + doThrow(new NotFoundException("Vf Module not found")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 404) @@ -143,7 +143,7 @@ class UpdateAAIVfModuleTest extends MsoGroovyTest { vfModule.setVfModuleId("supercool") vfModule.setResourceVersion("12345") when(mockExecution.getVariable(prefix + "getVfModuleResponse")).thenReturn(vfModule) - doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class), anyObject()) + doThrow(new IllegalStateException("Error in AAI client")).when(client).update(isA(AAIResourceUri.class) as AAIResourceUri, anyObject()) thrown.expect(BpmnError.class) updateAAIVfModule.updateVfModule(mockExecution) verify(mockExecution).setVariable("UAAIVfMod_updateVfModuleResponseCode", 500) |