diff options
Diffstat (limited to 'bpmn')
18 files changed, 640 insertions, 196 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java new file mode 100644 index 0000000000..1018d7f025 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.listener.validation; + +public interface WorkflowActionCompletion extends WorkflowActionListener { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java new file mode 100644 index 0000000000..4788c55053 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.listener.validation; + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +public interface WorkflowActionListener { + + /** + * Should this listener run for given bb + * + * @return + * + */ + public boolean shouldRunFor(String bbName, String eventName); + + /** + * Determines whether or not the listener should be executed + * + * + * @param execution + * @return + */ + public void executeListener(DelegateExecution execution); + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java new file mode 100644 index 0000000000..806c1b835d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.listener.validation; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import javax.annotation.PostConstruct; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.listener.ListenerRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + + + +@Component +public class WorkflowActionListenerRunner extends ListenerRunner { + + private static Logger logger = LoggerFactory.getLogger(WorkflowActionListenerRunner.class); + + protected List<WorkflowActionListener> workflowActionListeners; + + @PostConstruct + protected void init() { + workflowActionListeners = new ArrayList<>(Optional + .ofNullable(context.getBeansOfType(WorkflowActionListener.class)).orElse(new HashMap<>()).values()); + } + + public void executeAsyncListeners(String bbName, DelegateExecution execution, String eventName) { + try { + logger.info("NotifyingWorkflowActionListeners"); + runNotifications(workflowActionListeners, bbName, execution, eventName); + } catch (Exception e) { + logger.error("Error in Notifying Workflow Action Listeners", e); + } + } + + protected void runNotifications(List<? extends WorkflowActionListener> listeners, String bbName, + DelegateExecution execution, String eventName) { + List<? extends WorkflowActionListener> filtered = + filterListeners(listeners, (item -> item.shouldRunFor(bbName, eventName))); + filtered.forEach(item -> item.executeListener(execution)); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index dcb9e08d0b..fcac86b251 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.io.IOException; -import java.io.ObjectOutputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Optional; @@ -76,12 +74,11 @@ 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.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.type.TypeFactory; @Component("BBInputSetupUtils") public class BBInputSetupUtils { @@ -177,39 +174,32 @@ public class BBInputSetupUtils { } public InfraActiveRequests loadOriginalInfraActiveRequestById(String requestId) { - return this.requestsDbClient.getInfraActiveRequestbyRequestId( this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId).getOriginalRequestId()); } public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) { - - List<ExecuteBuildingBlock> asList = null; if (requestId != null) { - InfraActiveRequests request = loadInfraActiveRequestById(requestId); - if (request.getOriginalRequestId() != null) { - RequestProcessingData requestProcessingData = this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName( request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS); - - ObjectMapper om = new ObjectMapper(); try { - ExecuteBuildingBlock[] asArray = - om.readValue(requestProcessingData.getValue(), ExecuteBuildingBlock[].class); - asList = Arrays.asList(asArray); + ObjectMapper om = new ObjectMapper(); + TypeFactory typeFactory = objectMapper.getTypeFactory(); + return om.readValue(requestProcessingData.getValue(), + typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class)); } catch (Exception e) { logger.error(DATA_LOAD_ERROR, e); + throw new RuntimeException("Error Loading Original Request Data", e); } + } else { + throw new RuntimeException("Original Request Id is null for record: " + requestId); } - } else { - logger.debug(REQUEST_ERROR); + throw new RuntimeException("Null Request Id Passed in"); } - - return asList; } public Service getCatalogServiceByModelUUID(String modelUUID) { diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java new file mode 100644 index 0000000000..56526c7f89 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java @@ -0,0 +1,21 @@ +package org.onap.so.bpmn.core.plugins; + +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.springframework.stereotype.Component; + +@Component +public class AsyncTaskExecutor extends AbstractBpmnParseListener { + + private void injectTaskExecutorExecutionListener(ActivityImpl activity) { + activity.addListener(ExecutionListener.EVENTNAME_END, new AsyncTaskExecutorListener()); + } + + @Override + public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) { + injectTaskExecutorExecutionListener(activity); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java new file mode 100644 index 0000000000..94f4b313d4 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java @@ -0,0 +1,42 @@ +package org.onap.so.bpmn.core.plugins; + +import org.camunda.bpm.engine.RepositoryService; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.onap.so.bpmn.common.listener.validation.WorkflowActionListenerRunner; +import org.onap.so.spring.SpringContextHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AsyncTaskExecutorListener implements ExecutionListener { + private final Logger logger = LoggerFactory.getLogger(AsyncTaskExecutorListener.class); + + + private WorkflowActionListenerRunner listenerRunner; + + @Override + public void notify(DelegateExecution execution) throws Exception { + if (!isBlank(execution.getCurrentActivityName())) { + try { + String id = execution.getId(); + if (id != null) { + RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService(); + String processName = repositoryService.createProcessDefinitionQuery() + .processDefinitionId(execution.getProcessDefinitionId()).singleResult().getName(); + logger.info("ProcessName : {}", processName); + if (processName != null) { + listenerRunner = + SpringContextHelper.getAppContext().getBean(WorkflowActionListenerRunner.class); + listenerRunner.executeAsyncListeners(processName, execution, ExecutionListener.EVENTNAME_END); + } + } + } catch (Exception e) { + logger.error("Error occured in executing Complete Task Listeners", e); + } + } + } + + private boolean isBlank(Object object) { + return object == null || "".equals(object.toString().trim()); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java new file mode 100644 index 0000000000..96c6af42ed --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + + +@Component +public class BPMNProcessCompletePlugin extends AbstractProcessEnginePlugin { + + @Autowired + private AsyncTaskExecutor asyncTaskExecutor; + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(asyncTaskExecutor); + } + +} 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 efdee8601e..bb900420e3 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 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> <bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true"> <bpmn:startEvent id="Start_WorkflowActionBB" name="start"> <bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing> @@ -46,7 +46,7 @@ <bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}"> <bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming> @@ -54,7 +54,7 @@ </bpmn:serviceTask> <bpmn:serviceTask id="Task_SendSync" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}"> <bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1lrz41x</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}"> <bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming> @@ -83,7 +83,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" /> <bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" /> <bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}"> @@ -92,10 +92,10 @@ </bpmn:serviceTask> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}"> <bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming> @@ -104,7 +104,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" /> <bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}"> <bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming> @@ -115,7 +115,6 @@ <bpmn:incoming>SequenceFlow_1r570x3</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" /> - <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" /> <bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" /> <bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}"> <bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming> @@ -128,7 +127,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" /> <bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0"> <bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming> @@ -137,7 +136,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" /> <bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen"> <bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming> @@ -145,13 +144,13 @@ <bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:endEvent id="End_RollbackFailed" name="end"> <bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}"> <bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming> @@ -159,7 +158,7 @@ <bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" /> <bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true"> @@ -186,7 +185,7 @@ <bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" /> <bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable("requestAction"), execution)}"> <bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0etawv5</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}"> @@ -196,6 +195,19 @@ <bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" /> <bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" /> <bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1dez26n" name="Generated Id's?"> + <bpmn:incoming>SequenceFlow_1lrz41x</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0etawv5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ilo6lo</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1lrz41x" sourceRef="Task_SendSync" targetRef="ExclusiveGateway_1dez26n" /> + <bpmn:sequenceFlow id="SequenceFlow_0etawv5" name="no" sourceRef="ExclusiveGateway_1dez26n" targetRef="Task_PreValidateWorkflow"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_12f15tu" name="End"> + <bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" /> </bpmn:process> <bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -213,8 +225,8 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp"> - <di:waypoint x="-398" y="120" /> - <di:waypoint x="-365" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-398" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-365" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="-381" y="99" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -223,8 +235,8 @@ <dc:Bounds x="560" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv"> - <di:waypoint x="339" y="120" /> - <di:waypoint x="400" y="120" /> + <di:waypoint xsi:type="dc:Point" x="339" y="120" /> + <di:waypoint xsi:type="dc:Point" x="400" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="324.5" y="105" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -239,9 +251,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj"> - <di:waypoint x="949" y="132" /> - <di:waypoint x="980" y="165" /> - <di:waypoint x="1060" y="165" /> + <di:waypoint xsi:type="dc:Point" x="949" y="132" /> + <di:waypoint xsi:type="dc:Point" x="980" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1060" y="165" /> <bpmndi:BPMNLabel> <dc:Bounds x="968" y="168" width="83" height="12" /> </bpmndi:BPMNLabel> @@ -250,15 +262,15 @@ <dc:Bounds x="-365" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync"> - <dc:Bounds x="-132" y="-6" width="100" height="80" /> + <dc:Bounds x="-100" y="-76" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete"> <dc:Bounds x="1161" y="206" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz"> - <di:waypoint x="1261" y="246" /> - <di:waypoint x="1322" y="246" /> - <di:waypoint x="1322" y="183" /> + <di:waypoint xsi:type="dc:Point" x="1261" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1322" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1322" y="183" /> <bpmndi:BPMNLabel> <dc:Bounds x="1247" y="231" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -279,16 +291,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm"> - <di:waypoint x="936" y="145" /> - <di:waypoint x="936" y="262" /> - <di:waypoint x="339" y="262" /> + <di:waypoint xsi:type="dc:Point" x="936" y="145" /> + <di:waypoint xsi:type="dc:Point" x="936" y="262" /> + <di:waypoint xsi:type="dc:Point" x="339" y="262" /> <bpmndi:BPMNLabel> <dc:Bounds x="769.202380952381" y="272" width="73" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn"> - <di:waypoint x="289" y="222" /> - <di:waypoint x="289" y="160" /> + <di:waypoint xsi:type="dc:Point" x="289" y="222" /> + <di:waypoint xsi:type="dc:Point" x="289" y="160" /> <bpmndi:BPMNLabel> <dc:Bounds x="259" y="191" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -297,16 +309,16 @@ <dc:Bounds x="239" y="222" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9"> - <di:waypoint x="-265" y="120" /> - <di:waypoint x="-228" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-265" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-228" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="-246" y="105" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei"> - <di:waypoint x="946" y="105" /> - <di:waypoint x="983" y="44" /> - <di:waypoint x="1060" y="45" /> + <di:waypoint xsi:type="dc:Point" x="946" y="105" /> + <di:waypoint xsi:type="dc:Point" x="983" y="44" /> + <di:waypoint xsi:type="dc:Point" x="1060" y="45" /> <bpmndi:BPMNLabel> <dc:Bounds x="975" y="17" width="58" height="12" /> </bpmndi:BPMNLabel> @@ -321,28 +333,19 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6"> - <di:waypoint x="1276" y="-36" /> - <di:waypoint x="1359" y="-36" /> - <di:waypoint x="1359" y="45" /> - <di:waypoint x="1386" y="45" /> + <di:waypoint xsi:type="dc:Point" x="1276" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="1359" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="1359" y="45" /> + <di:waypoint xsi:type="dc:Point" x="1386" y="45" /> <bpmndi:BPMNLabel> <dc:Bounds x="1329" y="5" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic"> - <di:waypoint x="-32" y="34" /> - <di:waypoint x="32" y="34" /> - <di:waypoint x="32" y="120" /> - <di:waypoint x="80" y="120" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="47" y="77" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u"> - <di:waypoint x="936" y="95" /> - <di:waypoint x="936" y="55" /> - <di:waypoint x="936" y="55" /> - <di:waypoint x="936" y="4" /> + <di:waypoint xsi:type="dc:Point" x="936" y="95" /> + <di:waypoint xsi:type="dc:Point" x="936" y="55" /> + <di:waypoint xsi:type="dc:Point" x="936" y="55" /> + <di:waypoint xsi:type="dc:Point" x="936" y="4" /> <bpmndi:BPMNLabel> <dc:Bounds x="906" y="49" width="90" height="0" /> </bpmndi:BPMNLabel> @@ -357,16 +360,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv"> - <di:waypoint x="-202" y="96" /> - <di:waypoint x="-202" y="34" /> - <di:waypoint x="-132" y="34" /> + <di:waypoint xsi:type="dc:Point" x="-202" y="96" /> + <di:waypoint xsi:type="dc:Point" x="-202" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="-100" y="-36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" /> + <dc:Bounds x="-195" y="17.612903225806477" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4"> - <di:waypoint x="-178" y="120" /> - <di:waypoint x="80" y="120" /> + <di:waypoint xsi:type="dc:Point" x="-178" y="120" /> + <di:waypoint xsi:type="dc:Point" x="80" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" /> </bpmndi:BPMNLabel> @@ -378,16 +381,16 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0"> - <di:waypoint x="1085" y="20" /> - <di:waypoint x="1085" y="-37" /> - <di:waypoint x="1176" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="20" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="-37" /> + <di:waypoint xsi:type="dc:Point" x="1176" y="-37" /> <bpmndi:BPMNLabel> <dc:Bounds x="1091" y="-8" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3"> - <di:waypoint x="1110" y="45" /> - <di:waypoint x="1386" y="45" /> + <di:waypoint xsi:type="dc:Point" x="1110" y="45" /> + <di:waypoint xsi:type="dc:Point" x="1386" y="45" /> <bpmndi:BPMNLabel> <dc:Bounds x="1242" y="20" width="12" height="12" /> </bpmndi:BPMNLabel> @@ -399,10 +402,10 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp"> - <di:waypoint x="1110" y="165" /> - <di:waypoint x="1220" y="165" /> - <di:waypoint x="1220" y="165" /> - <di:waypoint x="1304" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1110" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1220" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1220" y="165" /> + <di:waypoint xsi:type="dc:Point" x="1304" y="165" /> <bpmndi:BPMNLabel> <dc:Bounds x="1256" y="140" width="12" height="12" /> </bpmndi:BPMNLabel> @@ -414,9 +417,9 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt"> - <di:waypoint x="289" y="302" /> - <di:waypoint x="289" y="368" /> - <di:waypoint x="960" y="368" /> + <di:waypoint xsi:type="dc:Point" x="289" y="302" /> + <di:waypoint xsi:type="dc:Point" x="289" y="368" /> + <di:waypoint xsi:type="dc:Point" x="960" y="368" /> <bpmndi:BPMNLabel> <dc:Bounds x="381.45685840707966" y="325" width="63" height="24" /> </bpmndi:BPMNLabel> @@ -428,33 +431,33 @@ <dc:Bounds x="960" y="325" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba"> - <di:waypoint x="942" y="139" /> - <di:waypoint x="976" y="252" /> - <di:waypoint x="1016" y="252" /> - <di:waypoint x="1016" y="325" /> + <di:waypoint xsi:type="dc:Point" x="942" y="139" /> + <di:waypoint xsi:type="dc:Point" x="976" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1016" y="252" /> + <di:waypoint xsi:type="dc:Point" x="1016" y="325" /> <bpmndi:BPMNLabel> <dc:Bounds x="959" y="255" width="52" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x"> - <di:waypoint x="556" y="657" /> - <di:waypoint x="602" y="657" /> + <di:waypoint xsi:type="dc:Point" x="556" y="657" /> + <di:waypoint xsi:type="dc:Point" x="602" y="657" /> <bpmndi:BPMNLabel> <dc:Bounds x="534" y="636" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf"> - <di:waypoint x="813" y="657" /> - <di:waypoint x="880" y="657" /> + <di:waypoint xsi:type="dc:Point" x="813" y="657" /> + <di:waypoint xsi:type="dc:Point" x="880" y="657" /> <bpmndi:BPMNLabel> <dc:Bounds x="801.5" y="636" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc"> - <di:waypoint x="1060" y="365" /> - <di:waypoint x="1134" y="365" /> - <di:waypoint x="1134" y="365" /> - <di:waypoint x="1159" y="365" /> + <di:waypoint xsi:type="dc:Point" x="1060" y="365" /> + <di:waypoint xsi:type="dc:Point" x="1134" y="365" /> + <di:waypoint xsi:type="dc:Point" x="1134" y="365" /> + <di:waypoint xsi:type="dc:Point" x="1159" y="365" /> <bpmndi:BPMNLabel> <dc:Bounds x="1104" y="359" width="90" height="13" /> </bpmndi:BPMNLabel> @@ -466,25 +469,25 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1"> - <di:waypoint x="652" y="657" /> - <di:waypoint x="683" y="657" /> - <di:waypoint x="683" y="657" /> - <di:waypoint x="713" y="657" /> + <di:waypoint xsi:type="dc:Point" x="652" y="657" /> + <di:waypoint xsi:type="dc:Point" x="683" y="657" /> + <di:waypoint xsi:type="dc:Point" x="683" y="657" /> + <di:waypoint xsi:type="dc:Point" x="713" y="657" /> <bpmndi:BPMNLabel> <dc:Bounds x="677" y="634" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o"> - <di:waypoint x="627" y="632" /> - <di:waypoint x="627" y="548" /> - <di:waypoint x="713" y="548" /> + <di:waypoint xsi:type="dc:Point" x="627" y="632" /> + <di:waypoint xsi:type="dc:Point" x="627" y="548" /> + <di:waypoint xsi:type="dc:Point" x="713" y="548" /> <bpmndi:BPMNLabel> <dc:Bounds x="633" y="584" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l"> - <di:waypoint x="763" y="588" /> - <di:waypoint x="763" y="617" /> + <di:waypoint xsi:type="dc:Point" x="763" y="588" /> + <di:waypoint xsi:type="dc:Point" x="763" y="617" /> <bpmndi:BPMNLabel> <dc:Bounds x="778" y="596.5" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -511,15 +514,15 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w"> - <di:waypoint x="606" y="875" /> - <di:waypoint x="690" y="875" /> + <di:waypoint xsi:type="dc:Point" x="606" y="875" /> + <di:waypoint xsi:type="dc:Point" x="690" y="875" /> <bpmndi:BPMNLabel> <dc:Bounds x="603" y="854" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88"> - <di:waypoint x="790" y="875" /> - <di:waypoint x="856" y="875" /> + <di:waypoint xsi:type="dc:Point" x="790" y="875" /> + <di:waypoint xsi:type="dc:Point" x="856" y="875" /> <bpmndi:BPMNLabel> <dc:Bounds x="778" y="854" width="0" height="12" /> </bpmndi:BPMNLabel> @@ -528,25 +531,25 @@ <dc:Bounds x="400" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im"> - <di:waypoint x="500" y="120" /> - <di:waypoint x="560" y="120" /> + <di:waypoint xsi:type="dc:Point" x="500" y="120" /> + <di:waypoint xsi:type="dc:Point" x="560" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="530" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen"> - <di:waypoint x="1085" y="190" /> - <di:waypoint x="1085" y="246" /> - <di:waypoint x="1161" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="190" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="246" /> + <di:waypoint xsi:type="dc:Point" x="1161" y="246" /> <bpmndi:BPMNLabel> <dc:Bounds x="1091" y="218" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf"> - <di:waypoint x="180" y="120" /> - <di:waypoint x="211" y="120" /> - <di:waypoint x="211" y="120" /> - <di:waypoint x="239" y="120" /> + <di:waypoint xsi:type="dc:Point" x="180" y="120" /> + <di:waypoint xsi:type="dc:Point" x="211" y="120" /> + <di:waypoint xsi:type="dc:Point" x="211" y="120" /> + <di:waypoint xsi:type="dc:Point" x="239" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="226" y="120" width="0" height="0" /> </bpmndi:BPMNLabel> @@ -558,27 +561,60 @@ <dc:Bounds x="735" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1"> - <di:waypoint x="660" y="120" /> - <di:waypoint x="735" y="120" /> + <di:waypoint xsi:type="dc:Point" x="660" y="120" /> + <di:waypoint xsi:type="dc:Point" x="735" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="697.5" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk"> - <di:waypoint x="835" y="120" /> - <di:waypoint x="911" y="120" /> + <di:waypoint xsi:type="dc:Point" x="835" y="120" /> + <di:waypoint xsi:type="dc:Point" x="911" y="120" /> <bpmndi:BPMNLabel> <dc:Bounds x="873" y="99" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim"> - <di:waypoint x="886" y="-36" /> - <di:waypoint x="289" y="-36" /> - <di:waypoint x="289" y="80" /> + <di:waypoint xsi:type="dc:Point" x="886" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="289" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="289" y="80" /> <bpmndi:BPMNLabel> <dc:Bounds x="587.5" y="-57" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1dez26n_di" bpmnElement="ExclusiveGateway_1dez26n" isMarkerVisible="true"> + <dc:Bounds x="105" y="-61" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="163" y="-48" width="61" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lrz41x_di" bpmnElement="SequenceFlow_1lrz41x"> + <di:waypoint xsi:type="dc:Point" x="0" y="-36" /> + <di:waypoint xsi:type="dc:Point" x="105" y="-36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="52.5" y="-57" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0etawv5_di" bpmnElement="SequenceFlow_0etawv5"> + <di:waypoint xsi:type="dc:Point" x="130" y="-11" /> + <di:waypoint xsi:type="dc:Point" x="130" y="80" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="139" y="29" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_12f15tu_di" bpmnElement="EndEvent_12f15tu"> + <dc:Bounds x="112" y="-169.83592938733125" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="120" y="-195" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ilo6lo_di" bpmnElement="SequenceFlow_0ilo6lo"> + <di:waypoint xsi:type="dc:Point" x="130" y="-61" /> + <di:waypoint xsi:type="dc:Point" x="130" y="-134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="136" y="-103" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java index 8010ce62ab..a932e4ac50 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java @@ -28,6 +28,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Spliterator; @@ -41,6 +42,9 @@ public final class JsonUtilForPnfCorrelationId { } static List<String> parseJsonToGelAllPnfCorrelationId(String json) { + if (json == null || json.isEmpty()) { + return Collections.emptyList(); + } JsonElement je = new JsonParser().parse(json); JsonArray array = je.getAsJsonArray(); List<String> list = new ArrayList<>(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 02303a6b23..bd1a45c64d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -23,12 +23,14 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; @@ -42,6 +44,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.AAIObjectType; +import static org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForPnfCorrelationId.*; @Component public class PnfEventReadyDmaapClient implements DmaapClient { @@ -129,15 +132,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient { try { logger.debug("dmaap listener starts listening pnf ready dmaap topic"); HttpResponse response = httpClient.execute(getRequest); - List<String> idList = getPnfCorrelationIdListFromResponse(response); - - // idList is never null - if (!idList.isEmpty()) { - // send only body of response - registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8")); - } - - if (idList != null) { + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); + List<String> idList = parseJsonToGelAllPnfCorrelationId(responseString); + idList.stream().findFirst().ifPresent(id -> registerClientResponse(id, responseString)); idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); } } catch (IOException e) { @@ -147,16 +145,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } - private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException { - if (response.getStatusLine().getStatusCode() == 200) { - String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); - if (responseString != null) { - return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString); - } - } - return Collections.emptyList(); - } - private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) { Runnable runnable = unregister(pnfCorrelationId); if (runnable != null) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy index afbace76d6..715a7dff6d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java index 8741208d26..4edee24531 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java @@ -63,4 +63,13 @@ public class JsonUtilForPnfCorrelationIdTest { assertThat(expectedResult).isEmpty(); } + @Test + public void shouldReturnEmptyListWhenInputIsNull() { + assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(null)).isEmpty(); + } + + @Test + public void shouldReturnEmptyListWhenInputIsEmpty() { + assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId("")).isEmpty(); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 19e08d9d59..cccfe0c762 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -30,8 +30,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; +import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -41,7 +41,7 @@ import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; -import org.apache.http.entity.StringEntity; +import org.apache.http.entity.InputStreamEntity; import org.apache.http.message.BasicHttpResponse; import org.junit.Before; import org.junit.Test; @@ -182,8 +182,8 @@ public class PnfEventReadyDmaapClientTest { threadRunFlag.setAccessible(false); } - private HttpResponse createResponse(String json) throws UnsupportedEncodingException { - HttpEntity entity = new StringEntity(json); + private HttpResponse createResponse(String json) { + HttpEntity entity = new InputStreamEntity(new ByteArrayInputStream(json.getBytes())); ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); response.setEntity(entity); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java index 4e74e5d414..c223d3ff11 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -2,14 +2,15 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) Copyright (C) 2018 Bell Canada. + * Copyright (C) 2018 Bell Canada. + * Copyright (C) 2019 Nokia. * ================================================================================ * 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. @@ -20,7 +21,6 @@ package org.onap.so.bpmn.buildingblock; -import java.util.Map; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -28,37 +28,37 @@ import org.springframework.stereotype.Component; @Component public class HomingV2 { - @Autowired - private OofHomingV2 oofHomingV2; - @Autowired + static final String HOMING_SNIRO = "sniro"; + static final String HOMING_OOF = "oof"; + static final String HOMING_SOLUTION = "Homing_Solution"; + private SniroHomingV2 sniroHomingV2; + private OofHomingV2 oofHomingV2; - private static final String HOMINGSOLUTION = "Homing_Solution"; + @Autowired + public HomingV2(OofHomingV2 oofHomingV2, SniroHomingV2 sniroHomingV2) { + this.oofHomingV2 = oofHomingV2; + this.sniroHomingV2 = sniroHomingV2; + } public void callHoming(BuildingBlockExecution execution) { - if (isOof(execution)) { - oofHomingV2.callOof(execution); - } else { + if (isSniro(execution)) { sniroHomingV2.callSniro(execution); + } else { + oofHomingV2.callOof(execution); } } public void processSolution(BuildingBlockExecution execution, String asyncResponse) { - if (isOof(execution)) { - oofHomingV2.processSolution(execution, asyncResponse); - } else { + if (isSniro(execution)) { sniroHomingV2.processSolution(execution, asyncResponse); + } else { + oofHomingV2.processSolution(execution, asyncResponse); } } - // Default solution is SNIRO. OOF gets called only if specified. - private boolean isOof(BuildingBlockExecution execution) { - for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters() - .getUserParams()) { - if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) { - return true; - } - } - return false; + private boolean isSniro(BuildingBlockExecution execution) { + return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream() + .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION))); } } 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/buildingblock/HomingV2Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java new file mode 100644 index 0000000000..9dd0365e7a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Nokia. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.buildingblock; + +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_OOF; +import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SNIRO; +import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SOLUTION; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; + +public class HomingV2Test { + + @Test + public void whenHomingSolutionSetToSniroShouldCallSniro() { + HashMap<String, Object> userParams = new HashMap<>(); + userParams.put(HOMING_SOLUTION, HOMING_SNIRO); + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.callHoming(givenExecution); + + then(sniroHoming).should().callSniro(givenExecution); + then(oofHoming).shouldHaveZeroInteractions(); + } + + @Test + public void whenHomingSolutionSetToSniroShouldProcessSniro() { + HashMap<String, Object> userParams = new HashMap<>(); + userParams.put(HOMING_SOLUTION, HOMING_SNIRO); + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.processSolution(givenExecution, "dummy"); + + then(sniroHoming).should().processSolution(givenExecution, "dummy"); + then(oofHoming).shouldHaveZeroInteractions(); + } + + @Test + public void whenHomingSolutionSetToOofShouldCallOof() { + HashMap<String, Object> userParams = new HashMap<>(); + userParams.put(HOMING_SOLUTION, HOMING_OOF); + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.callHoming(givenExecution); + + then(oofHoming).should().callOof(givenExecution); + then(sniroHoming).shouldHaveZeroInteractions(); + } + + @Test + public void whenHomingSolutionSetToOofShouldProcessOof() { + HashMap<String, Object> userParams = new HashMap<>(); + userParams.put(HOMING_SOLUTION, HOMING_OOF); + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.processSolution(givenExecution, "dummy"); + + then(oofHoming).should().processSolution(givenExecution, "dummy"); + then(sniroHoming).shouldHaveZeroInteractions(); + } + + @Test + public void whenHomingSolutionNotSetShouldCallOof() { + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>()); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.callHoming(givenExecution); + + then(oofHoming).should().callOof(givenExecution); + then(sniroHoming).shouldHaveZeroInteractions(); + } + + @Test + public void whenHomingSolutionNotSetShouldProcessOof() { + BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>()); + + OofHomingV2 oofHoming = mock(OofHomingV2.class); + SniroHomingV2 sniroHoming = mock(SniroHomingV2.class); + + HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming); + homingV2.processSolution(givenExecution, "dummy"); + + then(oofHoming).should().processSolution(givenExecution, "dummy"); + then(sniroHoming).shouldHaveZeroInteractions(); + } + + private BuildingBlockExecution createBuildingBlockExecutionMock(Map<String, Object> userParams) { + BuildingBlockExecution execution = mock(BuildingBlockExecution.class); + GeneralBuildingBlock generalBuildingBlock = mock(GeneralBuildingBlock.class); + RequestContext requestContext = mock(RequestContext.class); + RequestParameters requestParameters = mock(RequestParameters.class); + List<Map<String, Object>> userParamsList = new ArrayList<>(); + + userParamsList.add(userParams); + + when(execution.getGeneralBuildingBlock()).thenReturn(generalBuildingBlock); + when(generalBuildingBlock.getRequestContext()).thenReturn(requestContext); + when(requestContext.getRequestParameters()).thenReturn(requestParameters); + when(requestParameters.getUserParams()).thenReturn(userParamsList); + + return execution; + } +} 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")); } |