use of org.kie.workbench.common.stunner.bpmn.definition.EventGateway in project kie-wb-common by kiegroup.
the class GatewayConverterTest method testEvent.
@Test
public void testEvent() {
EventGateway gateway = new EventGateway();
gateway.getGeneral().getName().setValue(NAME);
gateway.getGeneral().getDocumentation().setValue(DOCUMENTATION);
Node<View<BaseGateway>, ?> node = newNode(UUID, gateway);
when(propertyWriterFactory.of(any(org.eclipse.bpmn2.EventBasedGateway.class))).thenReturn(gatewayPropertyWriter);
assertEquals(gatewayPropertyWriter, converter.toFlowElement(node));
verifyCommonValues(gatewayPropertyWriter, node);
}
use of org.kie.workbench.common.stunner.bpmn.definition.EventGateway in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEventGateway.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallEventGateway() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EVENT_GATEWAY);
assertDiagram(diagram, 7);
assertEquals(diagram.getMetadata().getTitle(), "TestEventGateway");
Graph graph = diagram.getGraph();
Node<? extends Definition, ?> gatewayNode = graph.getNode("_AFDF2596-C521-4753-AC22-2DCCAD391F98");
assertTrue(gatewayNode.getContent().getDefinition() instanceof EventGateway);
EventGateway eventGateway = (EventGateway) gatewayNode.getContent().getDefinition();
assertEquals("EventGatewayName", eventGateway.getGeneral().getName().getValue());
assertEquals("EventGatewayDocumentation", eventGateway.getGeneral().getDocumentation().getValue());
SequenceFlow inSequenceFlow = gatewayNode.getInEdges().stream().filter(edge -> "_E805280D-5862-4F56-B02A-E34F7D519050".equals(edge.getUUID())).map(edge -> (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition()).findFirst().orElseThrow(() -> new Exception("Expected sequenceFlow: _E805280D-5862-4F56-B02A-E34F7D519050 was not found"));
SequenceFlow outSequenceFlow1 = gatewayNode.getOutEdges().stream().filter(edge -> "_CCEF6352-760D-4641-B9C9-0B01FD4DD704".equals(edge.getUUID())).map(edge -> (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition()).findFirst().orElseThrow(() -> new Exception("Expected sequenceFlow: _CCEF6352-760D-4641-B9C9-0B01FD4DD704 was not found"));
SequenceFlow outSequenceFlow2 = gatewayNode.getOutEdges().stream().filter(edge -> "_1CD28E0D-1910-45FE-9AEC-932FA28C77AA".equals(edge.getUUID())).map(edge -> (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition()).findFirst().orElseThrow(() -> new Exception("Expected sequenceFlow: _1CD28E0D-1910-45FE-9AEC-932FA28C77AA was not found"));
assertNotNull(inSequenceFlow);
assertEquals("inSequence", inSequenceFlow.getGeneral().getName().getValue());
assertNotNull(outSequenceFlow1);
assertEquals("outSequence1", outSequenceFlow1.getGeneral().getName().getValue());
assertNotNull(outSequenceFlow2);
assertEquals("outSequence2", outSequenceFlow2.getGeneral().getName().getValue());
}
use of org.kie.workbench.common.stunner.bpmn.definition.EventGateway in project kie-wb-common by kiegroup.
the class GatewayConverter method eventGateway.
private Result<BpmnNode> eventGateway(EventBasedGateway eventGateway) {
Node<View<EventGateway>, Edge> node = factoryManager.newNode(eventGateway.getId(), EventGateway.class);
GatewayPropertyReader p = propertyReaderFactory.of(eventGateway);
node.getContent().setBounds(p.getBounds());
EventGateway definition = node.getContent().getDefinition();
definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
definition.setDimensionsSet(p.getCircleDimensionSet());
definition.setFontSet(p.getFontSet());
definition.setBackgroundSet(p.getBackgroundSet());
return Result.success(BpmnNode.of(node, p));
}
use of org.kie.workbench.common.stunner.bpmn.definition.EventGateway in project kie-wb-common by kiegroup.
the class GatewayConverter method event.
private PropertyWriter event(Node<View<EventGateway>, ?> n) {
GatewayPropertyWriter p = propertyWriterFactory.of(bpmn2.createEventBasedGateway());
p.setId(n.getUUID());
p.setGatewayDirection(GatewayDirection.DIVERGING);
EventGateway definition = n.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
p.setAbsoluteBounds(n);
return p;
}
Aggregations