@Override public void process(ProcessPropertyWriter processWriter, BasePropertyWriter nodeWriter, Node<View<? extends BPMNViewDefinition>, ?> node) { if (!node.getOutEdges().isEmpty()) { final Edge<?, ?> edge = node.getOutEdges().iterator().next(); if (edge != null && edge.getTargetNode() != null) { final Activity activity = findActivity(processWriter.getProcess(), edge.getTargetNode().getUUID()); if (activity != null) { activity.setIsForCompensation(true); } } } } }
@Test @SuppressWarnings("unchecked") public void testProcessWhenOutEdgeExists() { String uuid = "UUID"; Edge edge = mock(Edge.class); Node targetNode = mock(Node.class); when(targetNode.getUUID()).thenReturn(uuid); List outEdges = new ArrayList<>(); outEdges.add(edge); when(node.getOutEdges()).thenReturn(outEdges); Activity activity = mock(Activity.class); when(activity.getId()).thenReturn(uuid); when(edge.getTargetNode()).thenReturn(targetNode); List<FlowElement> flowElements = Collections.singletonList(activity); when(process.getFlowElements()).thenReturn(flowElements); converter.process(processWriter, nodeWriter, (Node) node); verify(activity).setIsForCompensation(true); } }
((CompensateEventDefinition) ed) .setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);
((CompensateEventDefinition) ed) .setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);
if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) { ((CompensateEventDefinition) ed).setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);
if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) { ((CompensateEventDefinition) ed).setActivityRef((Activity) f); ((Activity) f).setIsForCompensation(true);