From a2da6120817a60ca07e1c5b417a8804b41192040 Mon Sep 17 00:00:00 2001 From: "Boslet, Cory" Date: Fri, 17 May 2019 10:36:25 -0400 Subject: Altered bpmn and audit behavior on delete vf mod Renamed variable from contin to flowShouldContinue. Updated bpmn junits and exceptionbuilder junits. Updated bpmns to use non interrupting escalation event. Altered bpmn and audit behavior on delete vf module Change-Id: I4ade4c934a9193099cfd29d740c68e60633c03e5 Issue-ID: SO-1896 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/client/exception/ExceptionBuilder.java | 18 ++++-- .../so/client/exception/ExceptionBuilderTest.java | 18 +++++- .../BuildingBlock/ActivateVfModuleBB.bpmn | 2 +- .../subprocess/BuildingBlock/DeleteVfModuleBB.bpmn | 75 +++++++++++----------- .../BuildingBlock/ExecuteBuildingBlock.bpmn | 3 +- .../subprocess/BuildingBlock/WorkflowActionBB.bpmn | 1 + .../bpmn/subprocess/DeleteVfModuleBBTest.java | 1 + .../workflow/tasks/WorkflowActionBBTasks.java | 15 +++-- 8 files changed, 82 insertions(+), 51 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index b69ab151c4..dabfc81e1f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -152,7 +152,7 @@ public class ExceptionBuilder { .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } - public void processAuditException(DelegateExecutionImpl execution) { + public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { logger.info("Building a WorkflowException for Subflow"); StringBuilder errorMessage = new StringBuilder(); @@ -203,11 +203,15 @@ public class ExceptionBuilder { errorMessage.append( "Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops."); - WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); - execution.setVariable("WorkflowException", exception); - execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); - logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); - throw new BpmnError("AAIInventoryFailure"); + if (flowShouldContinue) { + execution.setVariable("StatusMessage", errorMessage.toString()); + } else { + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); + } } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index 4ade9dbe32..549f16b6f6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -22,6 +22,7 @@ package org.onap.so.client.exception; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; @@ -131,7 +132,7 @@ public class ExceptionBuilderTest extends BaseTest { public void processAuditExceptionTest() { try { Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB(); - exceptionBuilder.processAuditException((DelegateExecutionImpl) execution); + exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, false); } catch (BpmnError bpmnException) { assertEquals("AAIInventoryFailure", bpmnException.getErrorCode()); WorkflowException we = execution.getVariable("WorkflowException"); @@ -142,4 +143,19 @@ public class ExceptionBuilderTest extends BaseTest { } } + @Test + public void processAuditExceptionContinueTest() { + try { + Mockito.doReturn(extractPojosForBB).when(exceptionBuilder).getExtractPojosForBB(); + exceptionBuilder.processAuditException((DelegateExecutionImpl) execution, true); + String sm = execution.getVariable("StatusMessage"); + assertNotNull(sm); + assertEquals( + "create VF-Module testVfModuleId1 failed due to incomplete A&AI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that AIC RO did not create vserver testVServerId in AAI. Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.", + sm); + } catch (BpmnError bpmnException) { + fail(); + } + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn index 435d85d032..ff37874978 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn @@ -69,7 +69,7 @@ - + SequenceFlow_19gbhlj SequenceFlow_0l4jzc5 diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index 41c3966626..b774c052cc 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -109,19 +109,19 @@ SequenceFlow_1ut7n32 - - SequenceFlow_0xuodpy - - SequenceFlow_1fhst92 - + SequenceFlow_0xuodpy SequenceFlow_1fhst92 + + SequenceFlow_0xuodpy + + @@ -132,26 +132,29 @@ SequenceFlow_179btn2 - - SequenceFlow_0qfmmgt - SequenceFlow_17cd9e2 - SequenceFlow_1gdyk9j - - + + + - - SequenceFlow_1gdyk9j - - SequenceFlow_02lpx87 SequenceFlow_1ut7n32 SequenceFlow_14bu4ys + + SequenceFlow_0qfmmgt + SequenceFlow_17cd9e2 + SequenceFlow_1gdyk9j + + + SequenceFlow_1gdyk9j + + + @@ -375,12 +378,6 @@ - - - - - - @@ -394,7 +391,7 @@ - + @@ -423,39 +420,45 @@ - - - - - - - + - + - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 83363d48ba..0a6a7731ce 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0rq4c5r @@ -10,6 +10,7 @@ + SequenceFlow_19wuics SequenceFlow_01h9qmz diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 76ca2a89cc..35b77d9189 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -22,6 +22,7 @@ + SequenceFlow_0mew9im SequenceFlow_1hsqed1 diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index e88df73f39..d9166c9138 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -37,6 +37,7 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest { @Before public void before() { variables.put("auditInventoryNeeded", true); + variables.put("auditIsSuccessful", true); } @Test 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 f0a102dfeb..753a050c03 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -227,11 +227,16 @@ public class WorkflowActionBBTasks { final String action = (String) execution.getVariable(G_ACTION); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); final String resourceName = (String) execution.getVariable("resourceName"); + String statusMessage = (String) execution.getVariable("StatusMessage"); String macroAction = ""; - if (aLaCarte) { - macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + if (statusMessage == null) { + if (aLaCarte) { + macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly."; + } else { + macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + } } else { - macroAction = "Macro-" + resourceName + "-" + action + " request was executed correctly."; + macroAction = statusMessage; } execution.setVariable("finalStatusMessage", macroAction); Timestamp endTime = new Timestamp(System.currentTimeMillis()); -- cgit 1.2.3-korg