diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-09-24 14:57:51 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-09-24 17:24:25 -0400 |
commit | 4891eedd15cff1e582d052843eb8c11a14c5d836 (patch) | |
tree | 5f014cdd42f99eef78bd7cd4d3eae80be8d32a02 /bpmn/so-bpmn-tasks/src | |
parent | 96231b3365d378a86b71d93b8a7d64aef8be531c (diff) |
Update Resume Logic and Add Workflow Listeners
Updated with the error log messages
Changed the code to do string compare for eventName
update workflowaction to only persist if not resume
Issue-ID: SO-2363
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I139f2427ae0f0253a15cc51003318686568cb514
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
3 files changed, 21 insertions, 20 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java index e809ecd0ae..206942fcb1 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java @@ -20,27 +20,14 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import java.util.ArrayList; -import java.util.List; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; -import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; -import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; -import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.serviceinstancebeans.RequestReferences; -import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; @Component public class FlowCompletionTasks { @@ -50,7 +37,9 @@ public class FlowCompletionTasks { @Autowired private RequestsDbClient requestDbclient; + public void updateRequestDbStatus(BuildingBlockExecution execution) { + try { String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId(); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 1f07166b60..11c6455474 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -197,7 +197,9 @@ public class WorkflowAction { suppressRollback = false; } execution.setVariable("suppressRollback", suppressRollback); + boolean isResume = false; if (isUriResume(uri)) { + isResume = true; logger.debug("replacing URI {}", uri); uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl(); logger.debug("for RESUME with original value {}", uri); @@ -225,6 +227,12 @@ public class WorkflowAction { if (flowsToExecute == null) { buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path."); } + } else if (aLaCarte && isResume) { + flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId); + if (flowsToExecute == null) { + buildAndThrowException(execution, + "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found"); + } } else { if (aLaCarte) { if (orchFlows == null || orchFlows.isEmpty()) { @@ -387,7 +395,7 @@ public class WorkflowAction { flowNames.add(ebb.getBuildingBlock().getBpmnFlowName()); } - if (!aLaCarte) { + if (!isResume) { bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute); } execution.setVariable("flowNames", flowNames); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index eea885288e..be6fc94890 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -45,11 +45,9 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -66,7 +64,6 @@ import org.mockito.Spy; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.L3Network; -import org.onap.aai.domain.yang.L3Networks; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.ServiceInstance; @@ -80,7 +77,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; @@ -103,8 +99,6 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestParameters; @@ -1476,9 +1470,19 @@ public class WorkflowActionTest extends BaseTaskTest { } @Test + public void extractResourceIdAndTypeFromUriResumeTest() { + Resource resource = workflowAction.extractResourceIdAndTypeFromUri( + "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume"); + assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847"); + } + + @Test public void isUriResumeTest() { assertTrue(workflowAction.isUriResume( "http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume")); + assertTrue(workflowAction.isUriResume( + " http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume")); + assertFalse(workflowAction.isUriResume("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace")); } |