Search in sources :

Example 11 with InclusiveGateway

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());
}
Also used : InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) ConstraintViolation(javax.validation.ConstraintViolation) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Example 12 with InclusiveGateway

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());
}
Also used : InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) ConstraintViolation(javax.validation.ConstraintViolation) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) Test(org.junit.Test)

Example 13 with InclusiveGateway

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());
}
Also used : InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) ConstraintViolation(javax.validation.ConstraintViolation) GatewayExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.gateway.GatewayExecutionSet) Test(org.junit.Test)

Example 14 with InclusiveGateway

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));
}
Also used : AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) InclusiveGateway(org.kie.workbench.common.stunner.bpmn.definition.InclusiveGateway) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) DefaultRoute(org.kie.workbench.common.stunner.bpmn.definition.property.gateway.DefaultRoute) GatewayPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.GatewayPropertyReader) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name) GatewayExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.gateway.GatewayExecutionSet)

Example 15 with InclusiveGateway

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());
}
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) DeclarationList(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList) ArrayList(java.util.ArrayList) List(java.util.List) Edge(org.kie.workbench.common.stunner.core.graph.Edge) 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