From cf90f6988c717eb609f5da7d1aee04c668b21fe9 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 10 Aug 2018 17:19:31 -0400 Subject: Casablana bugfixes updated mock in unassignnetworkbbtest instead of base added mock to extract pojos method in unassignnetwork Return gBuildingBlockExecution from calls to VnfAdapter subprocess Correct JUnit data to expect modelInfoVfModule Enable Spring Security for logging of unauthorized/bad credentials errors Fix handling of a case of no VF Modules in a VNF resource. fix populating lookupKeyMap with resource ids removed unnecessary test resources Issue-ID: SO-848 Change-Id: Id89f075dcac4042bf8fb1e207e66d289d079171f Signed-off-by: Benjamin, Max (mb388a) --- .../bpmn/subprocess/CreateVfModuleBBTest.java | 23 ++++++++++++++++++---- .../bpmn/subprocess/CreateVolumeGroupBBTest.java | 17 ++++++++++++++-- .../bpmn/subprocess/UnassignNetwork1802BBTest.java | 6 +++--- 3 files changed, 37 insertions(+), 9 deletions(-) (limited to 'bpmn/so-bpmn-building-blocks/src/test/java/org') diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java index a3c6a820bd..a94a4bb89a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java @@ -42,6 +42,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ "QueryVfModule", "CreateVfModule", "VnfAdapter", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); @@ -54,7 +55,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf") - .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -65,7 +66,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule") - .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -76,10 +77,24 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") - .hasNotPassed("VnfAdapter", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + .hasNotPassed("VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); assertThat(pi).isEnded(); } + @Test + public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId") + .hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + + } + @Test public void rainyDayCreateVfModuleUpdateVfModuleStatusError_Test() throws Exception { mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); @@ -87,7 +102,7 @@ public class CreateVfModuleBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleStatus") + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus") .hasNotPassed("CreateVfModuleBB_End"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java index 980e609e97..eb372fb6a7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java @@ -36,7 +36,7 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{ mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); assertThat(pi).isEnded(); assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter","UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); } @@ -46,7 +46,20 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVolumeGroupRequest(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") + .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter") + .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); assertThat(pi).isEnded(); assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") .hasNotPassed("Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java index ad374e3304..2c5381de09 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java @@ -36,7 +36,7 @@ public class UnassignNetwork1802BBTest extends BaseBPMNTest { public void sunnyDayAssignNetwork_Test() throws InterruptedException { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); assertThat(pi).isEnded(); } @@ -46,8 +46,8 @@ public class UnassignNetwork1802BBTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship") + .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") .hasNotPassed("End_UnassignNetworkBB"); assertThat(pi).isEnded(); } -} +} \ No newline at end of file -- cgit 1.2.3-korg