private void assertEscalationEventExecutionSet(CancellingEscalationEventExecutionSet executionSet, String escalationRef, boolean isCancelling) { assertNotNull(executionSet); assertNotNull(executionSet.getEscalationRef()); assertNotNull(executionSet.getCancelActivity()); assertEquals(escalationRef, executionSet.getEscalationRef().getValue()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); } }
public IntermediateEscalationEvent() { this(new BPMNGeneralSet(""), new BackgroundSet(), new FontSet(), new CircleDimensionSet(new Radius()), new CancellingEscalationEventExecutionSet(), new DataIOSet()); }
@Test @SuppressWarnings("unchecked") public void testHandleEscalationIsNotCancel() { final IntermediateEscalationEvent bean = new IntermediateEscalationEvent(); bean.getExecutionSet().getCancelActivity().setValue(false); tested.handle(bean, view); verify(prim1).setFillAlpha(eq(0d)); verify(prim1).setStrokeAlpha(eq(1d)); }
@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 testHandleEscalationIsCancel() { final IntermediateEscalationEvent bean = new IntermediateEscalationEvent(); bean.getExecutionSet().getCancelActivity().setValue(true); tested.handle(bean, view); verify(prim1).setFillAlpha(eq(1d)); verify(prim1).setStrokeAlpha(eq(0d)); }
private void assertEscalationEventExecutionSet(CancellingEscalationEventExecutionSet executionSet, String escalationRef, boolean isCancelling) { assertNotNull(executionSet); assertNotNull(executionSet.getEscalationRef()); assertNotNull(executionSet.getCancelActivity()); assertEquals(escalationRef, executionSet.getEscalationRef().getValue()); assertEquals(isCancelling, executionSet.getCancelActivity().getValue()); } }
@Override public void handle(final BaseCatchingIntermediateEvent bean, final SVGShapeView<?> view) { Boolean isCancelActivity = null; if (bean instanceof IntermediateSignalEventCatching) { isCancelActivity = ((IntermediateSignalEventCatching) bean).getExecutionSet().getCancelActivity().getValue(); } else if (bean instanceof IntermediateTimerEvent) { isCancelActivity = ((IntermediateTimerEvent) bean).getExecutionSet().getCancelActivity().getValue(); } else if (bean instanceof IntermediateMessageEventCatching) { isCancelActivity = ((IntermediateMessageEventCatching) bean).getExecutionSet().getCancelActivity().getValue(); } else if (bean instanceof IntermediateConditionalEvent) { isCancelActivity = ((IntermediateConditionalEvent) bean).getExecutionSet().getCancelActivity().getValue(); } else if (bean instanceof IntermediateEscalationEvent) { isCancelActivity = ((IntermediateEscalationEvent) bean).getExecutionSet().getCancelActivity().getValue(); } if (null != isCancelActivity) { // Cancel -> Normal // NO Cancel -> dash final double fillAlpha = isCancelActivity ? 1 : 0; final double strokeAlpha = isCancelActivity ? 0 : 1; SVGViewUtils.getPrimitive(view, ID_INTERMEDIATE) .ifPresent(p -> p.get().setFillAlpha(fillAlpha).setStrokeAlpha(strokeAlpha)); } } }
@Test public void testCancellingEscalationEventExecutionSetEqualsAndHashCode() { String ESCALATION_REF = "ESCALATION_REF"; String ESCALATION_REF_1 = "ESCALATION_REF_1"; TestCaseBuilder.newTestCase() .addTrueCase(new CancellingEscalationEventExecutionSet(), new CancellingEscalationEventExecutionSet()) .addTrueCase(new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef()), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef())) .addTrueCase(new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF))) .addFalseCase(new CancellingEscalationEventExecutionSet(), null) .addFalseCase(new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new CancellingEscalationEventExecutionSet(new CancelActivity(true), new EscalationRef(ESCALATION_REF))) .addFalseCase(new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF_1))) .test(); }
private PropertyWriter escalationEvent(Node<View<IntermediateEscalationEvent>, ?> n) { CatchEventPropertyWriter p = createCatchEventPropertyWriter(n); p.getFlowElement().setId(n.getUUID()); IntermediateEscalationEvent definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setAssignmentsInfo( definition.getDataIOSet().getAssignmentsinfo()); CancellingEscalationEventExecutionSet executionSet = definition.getExecutionSet(); p.setCancelActivity(executionSet.getCancelActivity().getValue()); p.addEscalation(executionSet.getEscalationRef()); p.setBounds(n.getContent().getBounds()); return p; }
@Test public void testIntermediateEscalationCatchingEventEqualsAndHashCode() { String ESCALATION_REF = "ESCALATION_REF"; String ESCALATION_REF_1 = "ESCALATION_REF_1"; TestCaseBuilder.newTestCase() .addTrueCase(new IntermediateEscalationEvent(), new IntermediateEscalationEvent()) .addTrueCase(new IntermediateEscalationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(), new DataIOSet()), new IntermediateEscalationEvent(new BPMNGeneralSet(), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(), null) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(), new DataIOSet()), new IntermediateEscalationEvent(new BPMNGeneralSet("name1", "doc1"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(true), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(true), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(true), new EscalationRef(ESCALATION_REF_1)), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet()), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data"))) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(null, new EscalationRef(ESCALATION_REF)), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), null), new DataIOSet())) .addFalseCase(new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), new DataIOSet("data")), new IntermediateEscalationEvent(new BPMNGeneralSet("name", "doc"), new BackgroundSet(), new FontSet(), new CircleDimensionSet(), new CancellingEscalationEventExecutionSet(new CancelActivity(false), new EscalationRef(ESCALATION_REF)), null)) .test(); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateEscalationEvents() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ESCALATION_EVENTS); assertDiagram(diagram, 3); assertEquals("IntermediateEscalationEvents", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> catchingEventNode = diagram.getGraph().getNode("_C7F2BA98-1100-4CF8-A994-40E2B65F6E5D"); assertNotNull(catchingEventNode); IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) catchingEventNode.getContent().getDefinition(); assertNotNull(intermediateEscalationEvent.getGeneral()); assertEquals("BoundaryEscalationEventName", intermediateEscalationEvent.getGeneral().getName().getValue()); assertEquals("BoundaryEscalationEventDocumentation", intermediateEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateEscalationEvent.getExecutionSet()); assertEquals(true, intermediateEscalationEvent.getExecutionSet().getCancelActivity().getValue()); assertEquals("EscalationCode", intermediateEscalationEvent.getExecutionSet().getEscalationRef().getValue()); DataIOSet dataIOSet = intermediateEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }
private BpmnNode escalationEvent(CatchEvent event, EscalationEventDefinition e) { String nodeId = event.getId(); Node<View<IntermediateEscalationEvent>, Edge> node = factoryManager.newNode(nodeId, IntermediateEscalationEvent.class); IntermediateEscalationEvent definition = node.getContent().getDefinition(); CatchEventPropertyReader 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 CancellingEscalationEventExecutionSet( new CancelActivity(p.isCancelActivity()), new EscalationRef(EventDefinitionReader.escalationRefOf(e)) )); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getCircleDimensionSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
@Test @SuppressWarnings("unchecked") public void testUnmarshallIntermediateEscalationEvents() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INTERMEDIATE_ESCALATION_EVENTS); assertDiagram(diagram, 3); assertEquals("IntermediateEscalationEvents", diagram.getMetadata().getTitle()); Node<? extends Definition, ?> catchingEventNode = diagram.getGraph().getNode("_C7F2BA98-1100-4CF8-A994-40E2B65F6E5D"); assertNotNull(catchingEventNode); IntermediateEscalationEvent intermediateEscalationEvent = (IntermediateEscalationEvent) catchingEventNode.getContent().getDefinition(); assertNotNull(intermediateEscalationEvent.getGeneral()); assertEquals("BoundaryEscalationEventName", intermediateEscalationEvent.getGeneral().getName().getValue()); assertEquals("BoundaryEscalationEventDocumentation", intermediateEscalationEvent.getGeneral().getDocumentation().getValue()); assertNotNull(intermediateEscalationEvent.getExecutionSet()); assertEquals(true, intermediateEscalationEvent.getExecutionSet().getCancelActivity().getValue()); assertEquals("EscalationCode", intermediateEscalationEvent.getExecutionSet().getEscalationRef().getValue()); DataIOSet dataIOSet = intermediateEscalationEvent.getDataIOSet(); AssignmentsInfo assignmentsInfo = dataIOSet.getAssignmentsinfo(); assertEquals("||escalationOutput:String||[dout]escalationOutput->processVar1", assignmentsInfo.getValue()); }