use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.
the class InclusiveGatewayTest method testInclusiveDatabasedGatewayNameEmpty.
@Test
public void testInclusiveDatabasedGatewayNameEmpty() {
InclusiveGateway inclusiveGateway = new InclusiveGateway();
inclusiveGateway.getGeneral().setName(new Name(NAME_VALID));
Set<ConstraintViolation<InclusiveGateway>> violations = this.validator.validate(inclusiveGateway);
assertTrue(violations.isEmpty());
}
use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.
the class InclusiveGatewayTest method testInclusiveDatabasedGatewayNameValid.
@Test
public void testInclusiveDatabasedGatewayNameValid() {
InclusiveGateway inclusiveGateway = new InclusiveGateway();
inclusiveGateway.getGeneral().setName(new Name(NAME_VALID));
Set<ConstraintViolation<InclusiveGateway>> violations = this.validator.validate(inclusiveGateway);
assertTrue(violations.isEmpty());
}
use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.
the class InclusiveGatewayTest method testInclusiveDatabasedGatewayExecutionSetWithDefaultRoute.
@Test
public void testInclusiveDatabasedGatewayExecutionSetWithDefaultRoute() {
InclusiveGateway inclusiveGateway = new InclusiveGateway();
inclusiveGateway.setExecutionSet(new GatewayExecutionSet(DEFAULT_ROUTE_VALID));
Set<ConstraintViolation<InclusiveGateway>> violations = this.validator.validate(inclusiveGateway);
assertTrue(violations.isEmpty());
inclusiveGateway.setExecutionSet(null);
violations = this.validator.validate(inclusiveGateway);
assertTrue(violations.isEmpty());
}
use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.
the class GatewayConverter method inclusiveGateway.
private Result<BpmnNode> inclusiveGateway(Gateway gateway) {
Node<View<InclusiveGateway>, Edge> node = factoryManager.newNode(gateway.getId(), InclusiveGateway.class);
InclusiveGateway definition = node.getContent().getDefinition();
GatewayPropertyReader p = propertyReaderFactory.of(gateway);
definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
definition.setExecutionSet(new GatewayExecutionSet(new DefaultRoute(p.getDefaultRoute())));
node.getContent().setBounds(p.getBounds());
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.InclusiveGateway in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallInclusiveGateway.
@Test
@SuppressWarnings("unchecked")
public void testUnmarshallInclusiveGateway() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_INCLUSIVE_GATEWAY);
assertDiagram(diagram, 7);
assertEquals(diagram.getMetadata().getTitle(), "TestInclusiveGateway");
Graph graph = diagram.getGraph();
Node<? extends Definition, ?> gatewayNode = graph.getNode("_526EE472-FE8B-4E9A-A951-CFBA86C3691F");
assertTrue(gatewayNode.getContent().getDefinition() instanceof InclusiveGateway);
InclusiveGateway inclusiveGateway = (InclusiveGateway) gatewayNode.getContent().getDefinition();
assertEquals("InclusiveGatewayName", inclusiveGateway.getGeneral().getName().getValue());
assertEquals("_3D5701E9-CFD3-4218-9200-897B6D4FF041", inclusiveGateway.getExecutionSet().getDefaultRoute().getValue());
SequenceFlow sequenceFlow1 = null;
SequenceFlow sequenceFlow2 = null;
List<Edge> outEdges = (List<Edge>) gatewayNode.getOutEdges();
if (outEdges != null) {
for (Edge edge : outEdges) {
if ("_3D5701E9-CFD3-4218-9200-897B6D4FF041".equals(edge.getUUID())) {
sequenceFlow1 = (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition();
} else if ("_A414F16D-90BB-4742-A4E7-EBF7EA1ECD7E".equals(edge.getUUID())) {
sequenceFlow2 = (SequenceFlow) ((ViewConnector) edge.getContent()).getDefinition();
}
}
}
assertNotNull(sequenceFlow1);
assertEquals("OutSequence1", sequenceFlow1.getGeneral().getName().getValue());
assertNotNull(sequenceFlow2);
assertEquals("OutSequence2", sequenceFlow2.getGeneral().getName().getValue());
}
Aggregations