summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-building-blocks
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-04-06 01:11:12 -0400
committerElena Kuleshov <evn@att.com>2019-04-06 01:13:50 -0400
commit2c8c818a1815758e14e88fe74b782c3e8be8ac4b (patch)
tree574fdc0c5dfc8f7109e8364e168b8a0820b43add /bpmn/so-bpmn-building-blocks
parentb2364f2a5d7e4c0543620792afdde129c4c56049 (diff)
Implement Traffic Distribution BBs
Implement Traffic Distribution BBs Change-Id: I193a30a1f7bb353d0e3fbb1460ca5d9840bb5870 Issue-ID: SO-1553 Signed-off-by: Kuleshov, Elena <evn@att.com>
Diffstat (limited to 'bpmn/so-bpmn-building-blocks')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficCheckActivity.bpmn62
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java57
4 files changed, 238 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficActivity.bpmn
new file mode 100644
index 0000000000..4ea6bb10b1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficActivity.bpmn
@@ -0,0 +1,62 @@
+<?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="1.4.0">
+ <bpmn:process id="DistributeTrafficActivity" name="DistributeTrafficActivity" isExecutable="true">
+ <bpmn:startEvent id="DistributeTrafficActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="DistributeTrafficActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="DistributeTrafficActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskDistributeTraffic" targetRef="DistributeTrafficActivity_End" />
+ <bpmn:serviceTask id="TaskDistributeTraffic" name="Distribute Traffic" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionDistributeTraffic&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskDistributeTraffic" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DistributeTrafficActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DistributeTrafficActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="DistributeTrafficActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskDistributeTraffic">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficCheckActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficCheckActivity.bpmn
new file mode 100644
index 0000000000..19a4972187
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/DistributeTrafficCheckActivity.bpmn
@@ -0,0 +1,62 @@
+<?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="1.4.0">
+ <bpmn:process id="DistributeTrafficCheckActivity" name="DistributeTrafficCheckActivity" isExecutable="true">
+ <bpmn:startEvent id="DistributeTrafficCheckActivity_Start">
+ <bpmn:outgoing>SequenceFlow_06vhbci</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="DistributeTrafficCheckActivity_End">
+ <bpmn:incoming>SequenceFlow_01312aj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_06vhbci" sourceRef="DistributeTrafficCheckActivity_Start" targetRef="TaskPreProcessActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_01312aj" sourceRef="TaskDistributeTrafficCheck" targetRef="DistributeTrafficCheckActivity_End" />
+ <bpmn:serviceTask id="TaskDistributeTrafficCheck" name="Distribute Traffic Check" camunda:expression="${AppcRunTasks.runAppcCommand(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),execution.getVariable(&#34;actionDistributeTrafficCheck&#34;))}">
+ <bpmn:incoming>SequenceFlow_0cf0riu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01312aj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cf0riu" sourceRef="TaskPreProcessActivity" targetRef="TaskDistributeTrafficCheck" />
+ <bpmn:serviceTask id="TaskPreProcessActivity" name="PreProcess Activity" camunda:expression="${AppcRunTasks.preProcessActivity(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06vhbci</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cf0riu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DistributeTrafficCheckActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DistributeTrafficCheckActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_102xlzi_di" bpmnElement="DistributeTrafficCheckActivity_End">
+ <dc:Bounds x="561" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="579" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06vhbci_di" bpmnElement="SequenceFlow_06vhbci">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="255" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01312aj_di" bpmnElement="SequenceFlow_01312aj">
+ <di:waypoint xsi:type="dc:Point" x="497" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="561" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_066idx4_di" bpmnElement="TaskDistributeTrafficCheck">
+ <dc:Bounds x="397" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cf0riu_di" bpmnElement="SequenceFlow_0cf0riu">
+ <di:waypoint xsi:type="dc:Point" x="355" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="376" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fti66x_di" bpmnElement="TaskPreProcessActivity">
+ <dc:Bounds x="255" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java
new file mode 100644
index 0000000000..35fbaa1a04
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class DistributeTrafficActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayDistributeTrafficActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskDistributeTraffic",
+ "DistributeTrafficActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayDistributeTrafficActivity_Test() throws Exception {
+ variables.put("actionDistributeTraffic", Action.DistributeTraffic);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskDistributeTraffic").hasNotPassed(
+ "DistributeTrafficActivity_End");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java
new file mode 100644
index 0000000000..e360c83335
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.appc.client.lcm.model.Action;
+
+public class DistributeTrafficCheckActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayDistributeTrafficCheckActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskDistributeTrafficCheck",
+ "DistributeTrafficCheckActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayDistributeTrafficActivity_Test() throws Exception {
+ variables.put("actionDistributeTrafficCheck", Action.DistributeTrafficCheck);
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks)
+ .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables);
+ assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start",
+ "TaskPreProcessActivity",
+ "TaskDistributeTrafficCheck").hasNotPassed(
+ "DistributeTrafficCheckActivity_End");
+ }
+
+}