private void assertEscalationEventExecutionSet(InterruptingEscalationEventExecutionSet executionSet, String escalationRef, boolean isInterrupting) { assertNotNull(executionSet); assertNotNull(executionSet.getEscalationRef()); assertNotNull(executionSet.getIsInterrupting()); assertEquals(escalationRef, executionSet.getEscalationRef().getValue()); assertEquals(isInterrupting, executionSet.getIsInterrupting().getValue()); } }
public StartEscalationEvent() { this(new BPMNGeneralSet(""), new BackgroundSet(), new FontSet(), new CircleDimensionSet(new Radius()), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(), new DataIOSet()); }
@Test @SuppressWarnings("unchecked") public void testHandleEscalationIsInterrupting() { final StartEscalationEvent bean = new StartEscalationEvent(); bean.getExecutionSet().getIsInterrupting().setValue(true); tested.handle(bean, view); verify(prim1).setFillAlpha(eq(1d)); verify(prim1).setStrokeAlpha(eq(0d)); }
@Override public Function<Node, Pair<Object, String>> getMapper() { return node -> { EscalationRef escalationRef = null; if (startEscalationEventsFilter.test(node)) { escalationRef = ((StartEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateCatchingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (intermediateThrowingEscalationEventsFilter.test(node)) { escalationRef = ((IntermediateEscalationEventThrowing) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } else if (endEscalationEventsFilter.test(node)) { escalationRef = ((EndEscalationEvent) ((View) node.getContent()).getDefinition()).getExecutionSet().getEscalationRef(); } if (escalationRef != null && escalationRef.getValue() != null && !escalationRef.getValue().isEmpty()) { return new Pair<>(escalationRef.getValue(), escalationRef.getValue(), Pair.PairEqualsMode.K1); } else { return null; } }; } }
@Test @SuppressWarnings("unchecked") public void testHandleEscalationIsNotInterrupting() { final StartEscalationEvent bean = new StartEscalationEvent(); bean.getExecutionSet().getIsInterrupting().setValue(false); tested.handle(bean, view); verify(prim1).setFillAlpha(eq(0d)); verify(prim1).setStrokeAlpha(eq(1d)); }
private PropertyWriter escalationEvent(Node<View<StartEscalationEvent>, ?> n) { StartEvent event = bpmn2.createStartEvent(); event.setId(n.getUUID()); StartEscalationEvent definition = n.getContent().getDefinition(); CatchEventPropertyWriter p = propertyWriterFactory.of(event); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setSimulationSet(definition.getSimulationSet()); p.setBounds(n.getContent().getBounds()); InterruptingEscalationEventExecutionSet executionSet = definition.getExecutionSet(); event.setIsInterrupting(executionSet.getIsInterrupting().getValue()); p.addEscalation(executionSet.getEscalationRef()); p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo()); return p; }
@Override public void handle(final BaseStartEvent bean, final SVGShapeView<?> view) { Boolean isInterrupting = null; if (bean instanceof StartMessageEvent) { isInterrupting = ((StartMessageEvent) bean).getExecutionSet().getIsInterrupting().getValue(); } else if (bean instanceof StartTimerEvent) { isInterrupting = ((StartTimerEvent) bean).getExecutionSet().getIsInterrupting().getValue(); } else if (bean instanceof StartSignalEvent) { isInterrupting = ((StartSignalEvent) bean).getExecutionSet().getIsInterrupting().getValue(); } else if (bean instanceof StartConditionalEvent) { isInterrupting = ((StartConditionalEvent) bean).getExecutionSet().getIsInterrupting().getValue(); } else if (bean instanceof StartEscalationEvent) { isInterrupting = ((StartEscalationEvent) bean).getExecutionSet().getIsInterrupting().getValue(); } if (null != isInterrupting) { // Interrupting -> Normal // NO Interrupting -> dash final double fillAlpha = isInterrupting ? 1 : 0; final double strokeAlpha = isInterrupting ? 0 : 1; SVGViewUtils.getPrimitive(view, ID_START) .ifPresent(p -> p.get().setFillAlpha(fillAlpha).setStrokeAlpha(strokeAlpha)); } } }
@Test public void testInterruptingEscalationEventExecutionSetEqualsAndHashCode() { String ESCALATION_REF = "ESCALATION_REF"; String ESCALATION_REF_1 = "ESCALATION_REF_1"; TestCaseBuilder.newTestCase() .addTrueCase(new InterruptingEscalationEventExecutionSet(), new InterruptingEscalationEventExecutionSet()) .addTrueCase(new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef()), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef())) .addTrueCase(new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF))) .addFalseCase(new InterruptingEscalationEventExecutionSet(), null) .addFalseCase(new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new InterruptingEscalationEventExecutionSet(new IsInterrupting(true), new EscalationRef(ESCALATION_REF))) .addFalseCase(new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF_1))) .test(); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallStartEscalationEvent() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTESCALATIONEVENT); assertDiagram(diagram, 2); assertEquals("StartEscalationEvent", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("_D5AAA79F-9CD6-43C1-92E2-5D3C9340A303"); assertNotNull(startEventNode); StartEscalationEvent startEscalationEvent = (StartEscalationEvent) startEventNode.getContent().getDefinition(); assertNotNull(startEscalationEvent.getGeneral()); assertEquals("StartEscalationEventName", startEscalationEvent.getGeneral().getName().getValue()); assertEquals("StartEscalationEventDocumentation", startEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(startEscalationEvent.getExecutionSet()); assertEquals("EscalationCode", startEscalationEvent.getExecutionSet().getEscalationRef().getValue()); assertEquals(true, startEscalationEvent.getExecutionSet().getIsInterrupting().getValue()); DataIOSet dataIOSet = startEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }
@Test public void testStartEscalationEventEqualsAndHashCode() { String ESCALATION_REF = "ESCALATION_REF"; String ESCALATION_REF_1 = "ESCALATION_REF_1"; TestCaseBuilder.newTestCase() .addTrueCase(new StartEscalationEvent(), new StartEscalationEvent()) .addTrueCase(new StartEscalationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(), new DataIOSet()), new StartEscalationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(), new DataIOSet())) .addFalseCase(new StartEscalationEvent(), null) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(), new DataIOSet()), new StartEscalationEvent(new BPMNGeneralSet("name1", "doc1"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(), new DataIOSet())) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(true), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet())) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(true), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(true), new EscalationRef(ESCALATION_REF_1)), new DataIOSet())) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data"))) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(null, new EscalationRef(ESCALATION_REF)), new DataIOSet())) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), null), new DataIOSet())) .addFalseCase(new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new StartEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new SimulationAttributeSet(), new InterruptingEscalationEventExecutionSet(new IsInterrupting(false), new EscalationRef(ESCALATION_REF)), null)) .test(); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallStartEscalationEvent() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_STARTESCALATIONEVENT); assertDiagram(diagram, 2); assertEquals("StartEscalationEvent", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> startEventNode = diagram.getGraph().getNode("_D5AAA79F-9CD6-43C1-92E2-5D3C9340A303"); assertNotNull(startEventNode); StartEscalationEvent startEscalationEvent = (StartEscalationEvent) startEventNode.getContent().getDefinition(); assertNotNull(startEscalationEvent.getGeneral()); assertEquals("StartEscalationEventName", startEscalationEvent.getGeneral().getName().getValue()); assertEquals("StartEscalationEventDocumentation", startEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(startEscalationEvent.getExecutionSet()); assertEquals("EscalationCode", startEscalationEvent.getExecutionSet().getEscalationRef().getValue()); assertEquals(true, startEscalationEvent.getExecutionSet().getIsInterrupting().getValue()); DataIOSet dataIOSet = startEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }
private BpmnNode escalationEvent( StartEvent event, EscalationEventDefinition e) { Node<View<StartEscalationEvent>, Edge> node = factoryManager.newNode(event.getId(), StartEscalationEvent.class); StartEscalationEvent definition = node.getContent().getDefinition(); EventPropertyReader p = propertyReaderFactory.of(event); definition.setGeneral(new BPMNGeneralSet( new Name(p.getName()), new Documentation(p.getDocumentation()) )); definition.setDataIOSet(new DataIOSet( p.getAssignmentsInfo() )); definition.setExecutionSet(new InterruptingEscalationEventExecutionSet( new IsInterrupting(event.isIsInterrupting()), new EscalationRef(EventDefinitionReader.escalationRefOf(e))) ); definition.setSimulationSet(p.getSimulationSet()); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }