12-10-2013 03:32 PM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<signal id="signal" name="Signal"></signal>
<process id="my-process" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="User Task 1"></userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow2" sourceRef="usertask1" targetRef="endevent1"></sequenceFlow>
<boundaryEvent id="boundarysignal1" name="Signal" attachedToRef="usertask1" cancelActivity="false">
<signalEventDefinition signalRef="signal"></signalEventDefinition>
</boundaryEvent>
<userTask id="usertask2" name="User Task 2"></userTask>
<sequenceFlow id="flow3" sourceRef="usertask1" targetRef="usertask2"></sequenceFlow>
<endEvent id="endevent2" name="End"></endEvent>
<sequenceFlow id="flow4" sourceRef="usertask2" targetRef="endevent2"></sequenceFlow>
<subProcess id="subprocess1" name="Sub Process">
<startEvent id="startevent2" name="Start"></startEvent>
<userTask id="usertask3" name="User Task 3"></userTask>
<sequenceFlow id="flow6" sourceRef="startevent2" targetRef="usertask3"></sequenceFlow>
<endEvent id="endevent3" name="End"></endEvent>
<sequenceFlow id="flow7" sourceRef="usertask3" targetRef="endevent3"></sequenceFlow>
</subProcess>
<sequenceFlow id="flow5" sourceRef="boundarysignal1" targetRef="subprocess1"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_my-process">
<bpmndi:BPMNPlane bpmnElement="my-process" id="BPMNPlane_my-process">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="120.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="200.0" y="120.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="boundarysignal1" id="BPMNShape_boundarysignal1">
<omgdc:Bounds height="30.0" width="30.0" x="275.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="360.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="360.0" y="120.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
<omgdc:Bounds height="35.0" width="35.0" x="520.0" y="130.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="subprocess1" id="BPMNShape_subprocess1">
<omgdc:Bounds height="101.0" width="291.0" x="144.0" y="240.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="startevent2" id="BPMNShape_startevent2">
<omgdc:Bounds height="35.0" width="35.0" x="174.0" y="280.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="244.0" y="270.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent3" id="BPMNShape_endevent3">
<omgdc:Bounds height="35.0" width="35.0" x="374.0" y="280.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="155.0" y="147.0"></omgdi:waypoint>
<omgdi:waypoint x="200.0" y="147.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="305.0" y="147.0"></omgdi:waypoint>
<omgdi:waypoint x="360.0" y="147.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="305.0" y="147.0"></omgdi:waypoint>
<omgdi:waypoint x="360.0" y="147.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="465.0" y="147.0"></omgdi:waypoint>
<omgdi:waypoint x="520.0" y="147.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="209.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="244.0" y="297.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="349.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="374.0" y="297.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="290.0" y="190.0"></omgdi:waypoint>
<omgdi:waypoint x="289.0" y="240.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
package org.activiti;
import java.util.List;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.test.ActivitiRule;
import org.activiti.engine.test.Deployment;
import org.junit.Rule;
import org.junit.Test;
import static org.junit.Assert.*;
public class MyUnitTest {
@Rule
public ActivitiRule activitiRule = new ActivitiRule();
@Test
@Deployment(resources = {"org/activiti/test/my-process.bpmn20.xml"})
public void test() {
RuntimeService runtimeService = activitiRule.getRuntimeService();
TaskService taskService = activitiRule.getTaskService();
String signalName = "Signal";
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("my-process");
assertNotNull(processInstance);
runtimeService.signalEventReceived(signalName);
Task task1 = taskService.createTaskQuery().taskName("User Task 1").singleResult();
if (task1 != null) {
taskService.complete(task1.getId());
}
List<Execution> signals = runtimeService.createExecutionQuery()
.signalEventSubscriptionName(signalName)
.list();
assertTrue(signals.size() == 0);
}
}
12-11-2013 09:42 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.