@Test public void testConversion(){ SimulationTreeTableToModelConverter converter = new SimulationTreeTableToModelConverter(); BPMNProcess process = converter.convertTreeToModel(tree); assertTrue("Should be 14, but was " + process.getBPMNElementsWithOutSequenceFlows().size(), process.getBPMNElementsWithOutSequenceFlows().size() == 14); assertNotNull(process.getStartEvent()); BPMNStartEvent startEvent = process.getStartEvent(); assertTrue(startEvent.getSuccessors().size() == 1); assertTrue(startEvent.getSuccessors().iterator().next() instanceof BPMNXORGateway); BPMNXORGateway xor1 = (BPMNXORGateway) startEvent.getSuccessors().iterator().next(); List<AbstractBPMNElement> successors = SetUtil.asList(xor1.getSuccessors()); assertTrue(successors.size() == 2); assertTrue(successors.get(0) instanceof BPMNTask); assertTrue(successors.get(1) instanceof BPMNTask); assertTrue(successors.get(0).getSuccessors().iterator().next() instanceof BPMNXORGateway); BPMNXORGateway xor2 = (BPMNXORGateway) successors.get(0).getSuccessors().iterator().next(); assertTrue(xor2.getSuccessors().size() == 1); assertTrue("Should be BPMNAndGateway, but was " + xor2.getSuccessors().iterator().next(),xor2.getSuccessors().iterator().next() instanceof BPMNAndGateway); BPMNAndGateway and1 = (BPMNAndGateway) xor2.getSuccessors().iterator().next(); assertTrue(and1.getSuccessors().size() == 2); successors = SetUtil.asList(and1.getSuccessors()); for(AbstractBPMNElement successor : successors){ if(successor instanceof BPMNTask){ BPMNTask task = (BPMNTask)successor; if(task.getMonitoringPoints().get(0).getEventType().equals(e1)){ assertTrue(task.getSuccessors().iterator().next() instanceof BPMNTask); } } else { assertTrue(successor instanceof BPMNXORGateway); BPMNXORGateway loopEntry = (BPMNXORGateway) successor; assertTrue(loopEntry.getPredecessors().size() == 2); assertTrue(loopEntry.getSuccessors().size() == 1); assertTrue(loopEntry.getSuccessors().iterator().next() instanceof BPMNTask); BPMNTask loopTask1 = (BPMNTask) loopEntry.getSuccessors().iterator().next(); assertTrue(loopTask1.getSuccessors().size() == 1); assertTrue(loopTask1.getSuccessors().iterator().next() instanceof BPMNTask); BPMNTask loopTask2 = (BPMNTask) loopTask1.getSuccessors().iterator().next(); assertTrue(loopTask2.getSuccessors().size() == 1); assertTrue(loopTask2.getSuccessors().iterator().next() instanceof BPMNXORGateway); BPMNXORGateway loopExit = (BPMNXORGateway) loopTask2.getSuccessors().iterator().next(); assertTrue(loopExit.getSuccessors().size() == 2); for(AbstractBPMNElement loopExitSuccessor : loopExit.getSuccessors()){ if(loopExitSuccessor instanceof BPMNAndGateway){ assertTrue(loopExitSuccessor.getPredecessors().size() == 2); assertTrue(loopExitSuccessor.getSuccessors().size() == 1); assertTrue(loopExitSuccessor.getSuccessors().contains(process.getEndEvent())); } } } } }
public BPMNProcess convertTreeToModel(SushiTree<Object> tree){ this.tree = tree; BPMNStartEvent startEvent = new BPMNStartEvent(createID(), "Start", null); process.addBPMNElement(startEvent); BPMNEndEvent endEvent = new BPMNEndEvent(createID(), "End", null); process.addBPMNElement(endEvent); convertTreeToBPMNTree(); Tuple<AbstractBPMNElement, AbstractBPMNElement> subStartAndEnd = createSubBranch(bpmnTree.getRootElements().get(0)); AbstractBPMNElement.connectElements(startEvent, subStartAndEnd.x); AbstractBPMNElement.connectElements(subStartAndEnd.y, endEvent); return process; }
SimulationTreeTableToModelConverter { public BPMNProcess convertTreeToModel(SushiTree<Object> tree){ this.tree = tree; BPMNStartEvent startEvent = new BPMNStartEvent(createID(), "Start", null); process.addBPMNElement(startEvent); BPMNEndEvent endEvent = new BPMNEndEvent(createID(), "End", null); process.addBPMNElement(endEvent); convertTreeToBPMNTree(); Tuple<AbstractBPMNElement, AbstractBPMNElement> subStartAndEnd = createSubBranch(bpmnTree.getRootElements().get(0)); AbstractBPMNElement.connectElements(startEvent, subStartAndEnd.x); AbstractBPMNElement.connectElements(subStartAndEnd.y, endEvent); return process; } }
SimulationTreeTableToModelConverter { public BPMNProcess convertTreeToModel(SushiTree<Object> tree){ this.tree = tree; BPMNStartEvent startEvent = new BPMNStartEvent(createID(), "Start", null); process.addBPMNElement(startEvent); BPMNEndEvent endEvent = new BPMNEndEvent(createID(), "End", null); process.addBPMNElement(endEvent); convertTreeToBPMNTree(); Tuple<AbstractBPMNElement, AbstractBPMNElement> subStartAndEnd = createSubBranch(bpmnTree.getRootElements().get(0)); AbstractBPMNElement.connectElements(startEvent, subStartAndEnd.x); AbstractBPMNElement.connectElements(subStartAndEnd.y, endEvent); return process; }  }
SimulationTreeTableToModelConverter { public BPMNProcess convertTreeToModel(SushiTree<Object> tree){ this.tree = tree; BPMNStartEvent startEvent = new BPMNStartEvent(createID(), "Start", null); process.addBPMNElement(startEvent); BPMNEndEvent endEvent = new BPMNEndEvent(createID(), "End", null); process.addBPMNElement(endEvent); convertTreeToBPMNTree(); Tuple<AbstractBPMNElement, AbstractBPMNElement> subStartAndEnd = createSubBranch(bpmnTree.getRootElements().get(0)); AbstractBPMNElement.connectElements(startEvent, subStartAndEnd.x); AbstractBPMNElement.connectElements(subStartAndEnd.y, endEvent); return process; }  BPMNProcess convertTreeToModel(SushiTree<Object> tree); }
SimulationTreeTableToModelConverter { public BPMNProcess convertTreeToModel(SushiTree<Object> tree){ this.tree = tree; BPMNStartEvent startEvent = new BPMNStartEvent(createID(), "Start", null); process.addBPMNElement(startEvent); BPMNEndEvent endEvent = new BPMNEndEvent(createID(), "End", null); process.addBPMNElement(endEvent); convertTreeToBPMNTree(); Tuple<AbstractBPMNElement, AbstractBPMNElement> subStartAndEnd = createSubBranch(bpmnTree.getRootElements().get(0)); AbstractBPMNElement.connectElements(startEvent, subStartAndEnd.x); AbstractBPMNElement.connectElements(subStartAndEnd.y, endEvent); return process; }  BPMNProcess convertTreeToModel(SushiTree<Object> tree);  }