diff options
12 files changed, 100 insertions, 19 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 0ddafa0b44..9d68b5a3f0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -74,6 +74,8 @@ public class WorkflowActionBBTasks { private static final String COMPLETED = "completed"; private static final String HANDLINGCODE = "handlingCode"; private static final String ROLLBACKTOCREATED = "RollbackToCreated"; + private static final String REPLACEINSTANCE = "replaceInstance"; + private static final String VFMODULE = "VfModule"; protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @@ -286,12 +288,23 @@ public class WorkflowActionBBTasks { * working on. */ public void rollbackExecutionPath(DelegateExecution execution) { + final String action = (String) execution.getVariable(G_ACTION); + final String resourceName = (String) execution.getVariable("resourceName"); if (!(boolean) execution.getVariable("isRollback")) { List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + + List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = new ArrayList(); + for (int i = 0; i < flowsToExecute.size(); i++) { + if (flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) { + flowsToExecuteChangeBBs.add(flowsToExecute.get(i)); + } + } + List<ExecuteBuildingBlock> rollbackFlows = new ArrayList(); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); int listSize = flowsToExecute.size(); + for (int i = listSize - 1; i >= 0; i--) { if (i > currentSequence - 1) { flowsToExecute.remove(i); @@ -340,6 +353,18 @@ public class WorkflowActionBBTasks { } } + List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList(); + if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) { + for (int i = 0; i < rollbackFlowsFiltered.size(); i++) { + if (!rollbackFlowsFiltered.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) { + rollbackFlowsFilteredNonChangeBBs.add(rollbackFlowsFiltered.get(i)); + } + } + rollbackFlowsFiltered.clear(); + rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs); + rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs); + } + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); if (rollbackFlows.isEmpty()) execution.setVariable("isRollbackNeeded", false); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index 2e4f2e54f0..a736d85197 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -67,6 +67,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { private static final String SAMPLE_MSO_REQUEST_ID = "00f704ca-c5e5-4f95-a72c-6889db7b0688"; private static final String SAMPLE_REQUEST_ACTION = "Delete-Network-Collection"; private static final int SAMPLE_SEQUENCE = 0; + private static final String EMPTY_STRING = ""; @Mock protected WorkflowAction workflowAction; @@ -195,6 +196,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionPathTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); @@ -224,6 +227,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionPathUnfinishedFlowTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); @@ -253,6 +258,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionTest() { execution.setVariable("handlingCode", "Rollback"); execution.setVariable("isRollback", false); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); @@ -286,6 +293,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackToAssignedTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToAssigned"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); @@ -311,9 +320,50 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test + public void rollbackExecutionPathChangeBBForReplaceVFModuleTest() { + execution.setVariable("handlingCode", "Rollback"); + execution.setVariable("isRollback", false); + execution.setVariable("requestAction", "replaceInstance"); + execution.setVariable("resourceName", "VfModule"); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); + flowsToExecute.add(ebb1); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); + flowsToExecute.add(ebb2); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); + flowsToExecute.add(ebb3); + + + BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("ChangeModelVnfBB"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4); + flowsToExecute.add(ebb4); + + BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ChangeModelServiceInstanceBB"); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5); + flowsToExecute.add(ebb5); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 5); + doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class)); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "ChangeModelVnfBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "ChangeModelServiceInstanceBB"); + assertEquals(0, execution.getVariable("gCurrentSequence")); + } + + @Test public void rollbackExecutionRollbackToAssignedWithFabricTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToAssigned"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); @@ -349,6 +399,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackToCreatedTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToCreated"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); @@ -376,6 +428,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackInPlaceSoftwareUpdateTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "Rollback"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); @@ -435,6 +489,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { public void rollbackExecutionRollbackConfigModifyTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "Rollback"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity"); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java index 89c5cbed9b..c875764b7b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/NetworkDeleteValidator.java @@ -25,7 +25,7 @@ public class NetworkDeleteValidator implements RequestValidator { @Override public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request, - Map<String, String> queryParams) { + Map<String, String> queryParams, Actions action) { if (aaiDataRetrieval.isNetworkRelatedToModules(instanceIdMap.get("networkInstanceId"))) { return Optional.of("Cannot delete network it is still related to existing vf-modules"); } else { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java index 50938e6826..dc6d01ea8a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidator.java @@ -39,5 +39,5 @@ public interface RequestValidator { public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request, - Map<String, String> queryParams); + Map<String, String> queryParams, Actions action); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java index 3aba39b501..7ab761aeef 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/RequestValidatorListenerRunner.java @@ -73,8 +73,8 @@ public class RequestValidatorListenerRunner extends ListenerRunner { filterListeners(validators, (item -> item.shouldRunFor(requestURI, request, action))); List<Pair<String, Optional<String>>> results = new ArrayList<>(); - filtered.forEach(item -> results - .add(new Pair<>(item.getClass().getName(), item.validate(instanceIdMap, request, queryParams)))); + filtered.forEach(item -> results.add( + new Pair<>(item.getClass().getName(), item.validate(instanceIdMap, request, queryParams, action)))); return results.stream().filter(item -> item.getValue1().isPresent()).collect(Collectors.toList()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java index 843d94ce6c..74dbf579c0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/ServiceInstanceDeleteValidator.java @@ -34,7 +34,7 @@ public class ServiceInstanceDeleteValidator implements RequestValidator { @Override public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request, - Map<String, String> queryParams) { + Map<String, String> queryParams, Actions action) { if (aaiDataRetrieval.isServiceRelatedToGenericVnf(instanceIdMap.get("serviceInstanceId"))) { return Optional.of("Cannot delete service it is still related to existing vf-modules"); } else if (aaiDataRetrieval.isServiceRelatedToNetworks(instanceIdMap.get("serviceInstanceId"))) { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java index a48fca8d0f..44bab7e087 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java @@ -24,7 +24,7 @@ public class VnfDeleteValidator implements RequestValidator { @Override public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request, - Map<String, String> queryParams) { + Map<String, String> queryParams, Actions action) { final Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId(instanceIdMap.get("vnfInstanceId")); final Optional<String> vfModuleIds = aaiDataRetrieval.getVfModuleIdsByVnfId(instanceIdMap.get("vnfInstanceId")); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java index e3598af31d..550db19af4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VolumeGroupDeleteValidator.java @@ -24,7 +24,7 @@ public class VolumeGroupDeleteValidator implements RequestValidator { @Override public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request, - Map<String, String> queryParams) { + Map<String, String> queryParams, Actions action) { if (aaiDataRetrieval.isVolumeGroupRelatedToVFModule(instanceIdMap.get("volumeGroupInstanceId"))) { return Optional.of("Cannot delete volume group it is related to existing vf-modules"); } else { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java index 7780f0ee2b..20ec6d6708 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/NetworkDeleteValidatorTest.java @@ -58,7 +58,7 @@ public class NetworkDeleteValidatorTest { public void validateSuccessTest() { instanceIdMap.put("networkInstanceId", "1"); when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(false); - Optional<String> result = networkValidator.validate(instanceIdMap, null, null); + Optional<String> result = networkValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -66,7 +66,7 @@ public class NetworkDeleteValidatorTest { public void validateFailureTest() { instanceIdMap.put("networkInstanceId", "1"); when(aaiDataRetrieval.isNetworkRelatedToModules("1")).thenReturn(true); - Optional<String> result = networkValidator.validate(instanceIdMap, null, null); + Optional<String> result = networkValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java index f461df3720..c082c96074 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/ServiceInstanceDeleteValidatorTest.java @@ -76,7 +76,7 @@ public class ServiceInstanceDeleteValidatorTest { when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(false); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -84,7 +84,7 @@ public class ServiceInstanceDeleteValidatorTest { public void validateFailureVnfTest() { instanceIdMap.put("serviceInstanceId", "1"); when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -93,7 +93,7 @@ public class ServiceInstanceDeleteValidatorTest { instanceIdMap.put("serviceInstanceId", "1"); when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -103,7 +103,7 @@ public class ServiceInstanceDeleteValidatorTest { when(aaiDataRetrieval.isServiceRelatedToGenericVnf("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToNetworks("1")).thenReturn(false); when(aaiDataRetrieval.isServiceRelatedToConfiguration("1")).thenReturn(true); - Optional<String> result = serviceValidator.validate(instanceIdMap, null, null); + Optional<String> result = serviceValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java index 65ce355ad1..6eb6fc95d6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java @@ -53,7 +53,7 @@ public class VnfDeleteValidatorTest { public void validateFailureVfModuleVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.of("test")).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -61,7 +61,7 @@ public class VnfDeleteValidatorTest { public void validateSuccessVfModuleVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.empty()).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -69,7 +69,7 @@ public class VnfDeleteValidatorTest { public void validateFailureVolumeGroupVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.of("test")).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } @@ -77,7 +77,7 @@ public class VnfDeleteValidatorTest { public void validateSuccessVolumeGroupVnfTest() { instanceIdMap.put("vnfInstanceId", "1"); doReturn(Optional.empty()).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1"); - Optional<String> result = vnfValidator.validate(instanceIdMap, null, null); + Optional<String> result = vnfValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java index 3d81ee66c9..7aa12a61a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VolumeGroupDeleteValidatorTest.java @@ -54,7 +54,7 @@ public class VolumeGroupDeleteValidatorTest { public void validateSuccessTest() { instanceIdMap.put("volumeGroupInstanceId", "1"); when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(false); - Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null); + Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null); assertEquals(false, result.isPresent()); } @@ -62,7 +62,7 @@ public class VolumeGroupDeleteValidatorTest { public void validateFailureVnfTest() { instanceIdMap.put("volumeGroupInstanceId", "1"); when(aaiDataRetrieval.isVolumeGroupRelatedToVFModule("1")).thenReturn(true); - Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null); + Optional<String> result = volumeGroupDeleteValidator.validate(instanceIdMap, null, null, null); assertEquals(true, result.isPresent()); } |