Search in sources :

Example 6 with InclusiveGateway

use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.

the class InclusiveGatewayTest method testUnmarshallTopLevelEmptyGatewayProperties.

@Test
public void testUnmarshallTopLevelEmptyGatewayProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_INCLUSIVE_GATEWAY_FILE_PATH);
    assertDiagram(diagram, DIAGRAM_NODE_SIZE);
    InclusiveGateway filledTopLevelGateway = getGatewayNodeById(diagram, EMPTY_TOP_LEVEL_GATEWAY_ID, getGatewayNodeType());
    assertGeneralSet(filledTopLevelGateway.getGeneral(), EMPTY, EMPTY);
    assertGatewayExecutionSet(filledTopLevelGateway.getExecutionSet(), null);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 7 with InclusiveGateway

use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.

the class InclusiveGatewayTest method testUnmarshallSubprocessLevelGatewayFilledProperties.

@Test
public void testUnmarshallSubprocessLevelGatewayFilledProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_INCLUSIVE_GATEWAY_FILE_PATH);
    assertDiagram(diagram, DIAGRAM_NODE_SIZE);
    InclusiveGateway filledTopLevelGateway = getGatewayNodeById(diagram, FILLED_SUBPROCESS_LEVEL_GATEWAY_ID, getGatewayNodeType());
    assertGeneralSet(filledTopLevelGateway.getGeneral(), NAME, DOCUMENTATION);
    assertGatewayExecutionSet(filledTopLevelGateway.getExecutionSet(), DEFAULT_ROUTE_SUBPROCESS_LEVEL_ID);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 8 with InclusiveGateway

use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.

the class BPMNDiagramMarshallerTest 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());
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) SequenceFlow(org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 9 with InclusiveGateway

use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.

the class InclusiveGatewayTest method testUnmarshallTopLevelGatewayFilledProperties.

@Test
public void testUnmarshallTopLevelGatewayFilledProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_INCLUSIVE_GATEWAY_FILE_PATH);
    assertDiagram(diagram, DIAGRAM_NODE_SIZE);
    InclusiveGateway filledTopLevelGateway = getGatewayNodeById(diagram, FILLED_TOP_LEVEL_GATEWAY_ID, getGatewayNodeType());
    assertGeneralSet(filledTopLevelGateway.getGeneral(), NAME, DOCUMENTATION);
    assertGatewayExecutionSet(filledTopLevelGateway.getExecutionSet(), DEFAULT_ROUTE_TOP_LEVEL_ID);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Example 10 with InclusiveGateway

use of org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway in project kie-wb-common by kiegroup.

the class InclusiveGatewayTest method testUnmarshallSubprocessLevelGatewayEmptyProperties.

@Test
public void testUnmarshallSubprocessLevelGatewayEmptyProperties() throws Exception {
    Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_INCLUSIVE_GATEWAY_FILE_PATH);
    assertDiagram(diagram, DIAGRAM_NODE_SIZE);
    InclusiveGateway filledTopLevelGateway = getGatewayNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_GATEWAY_ID, getGatewayNodeType());
    assertGeneralSet(filledTopLevelGateway.getGeneral(), EMPTY, EMPTY);
    assertGatewayExecutionSet(filledTopLevelGateway.getExecutionSet(), null);
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) Test(org.junit.Test)

Aggregations

InclusiveGateway (org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway)15 Test (org.junit.Test)12 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)6 Graph (org.kie.workbench.common.stunner.core.graph.Graph)6 ConstraintViolation (javax.validation.ConstraintViolation)4 GatewayExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.gateway.GatewayExecutionSet)4 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)4 ArrayList (java.util.ArrayList)3 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 Edge (org.kie.workbench.common.stunner.core.graph.Edge)3 List (java.util.List)2 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)2 View (org.kie.workbench.common.stunner.core.graph.content.view.View)2 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)2 LinkedList (java.util.LinkedList)1 Before (org.junit.Before)1 DeclarationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList)1 GatewayPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.GatewayPropertyWriter)1 GatewayPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GatewayPropertyReader)1 ExclusiveGateway (org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway)1