Search in sources :

Example 41 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class SequenceFlowPropertyReaderTest method getConnectionsNoWaypoints.

@Test
public void getConnectionsNoWaypoints() {
    TestDefinitionsWriter d = new TestDefinitionsWriter();
    PropertyReaderFactory factory = new PropertyReaderFactory(d.getDefinitionResolver());
    Bounds sourceBounds = boundsOf(10, 10, 50, 50);
    FlowNode source = d.mockNode(SOURCE_ID, sourceBounds);
    Bounds targetBounds = boundsOf(100, 100, 60, 60);
    FlowNode target = d.mockNode(TARGET_ID, targetBounds);
    List<Point> noWaypoints = Collections.emptyList();
    SequenceFlow el = d.sequenceFlowOf(SEQ_ID, source, target, noWaypoints);
    SequenceFlowPropertyReader p = factory.of(el);
    // this is inferred from behavior of the old marshallers
    Connection sourceConnection = p.getSourceConnection();
    assertEquals(sourceBounds.getWidth(), (float) sourceConnection.getLocation().getX(), 0);
    assertEquals(sourceBounds.getHeight() / 2f, (float) sourceConnection.getLocation().getY(), 0);
    Connection targetConnection = p.getTargetConnection();
    assertEquals(0.0f, (float) targetConnection.getLocation().getX(), 0);
    assertEquals(targetBounds.getHeight() / 2.0f, (float) targetConnection.getLocation().getY(), 0);
}
Also used : SequenceFlow(org.eclipse.bpmn2.SequenceFlow) Bounds(org.eclipse.dd.dc.Bounds) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Point(org.eclipse.dd.dc.Point) TestDefinitionsWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.TestDefinitionsWriter) FlowNode(org.eclipse.bpmn2.FlowNode) Test(org.junit.Test)

Example 42 with SequenceFlow

use of org.eclipse.bpmn2.SequenceFlow in project kie-wb-common by kiegroup.

the class SequenceFlowPropertyReaderTest method get1Waypoint.

@Test
public void get1Waypoint() {
    TestDefinitionsWriter d = new TestDefinitionsWriter();
    PropertyReaderFactory factory = new PropertyReaderFactory(d.getDefinitionResolver());
    Bounds sourceBounds = boundsOf(10, 10, 50, 50);
    FlowNode source = d.mockNode(SOURCE_ID, sourceBounds);
    Bounds targetBounds = boundsOf(100, 100, 60, 60);
    FlowNode target = d.mockNode(TARGET_ID, targetBounds);
    Point sourcePoint = pointOf(10, 20);
    Point mid1 = pointOf(15, 25);
    Point targetPoint = pointOf(100, 120);
    List<Point> waypoints = asList(sourcePoint, mid1, targetPoint);
    SequenceFlow el = d.sequenceFlowOf(SEQ_ID, source, target, waypoints);
    SequenceFlowPropertyReader p = factory.of(el);
    List<Point2D> controlPoints = p.getControlPoints();
    List<Point2D> expected = Collections.singletonList(Point2D.create(mid1.getX(), mid1.getY()));
    assertEquals(expected, controlPoints);
}
Also used : Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) SequenceFlow(org.eclipse.bpmn2.SequenceFlow) Bounds(org.eclipse.dd.dc.Bounds) Point(org.eclipse.dd.dc.Point) TestDefinitionsWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.TestDefinitionsWriter) FlowNode(org.eclipse.bpmn2.FlowNode) Test(org.junit.Test)

Aggregations

SequenceFlow (org.eclipse.bpmn2.SequenceFlow)24 Test (org.junit.Test)20 Point (org.eclipse.dd.dc.Point)15 ArrayList (java.util.ArrayList)12 FlowElement (org.eclipse.bpmn2.FlowElement)12 Bounds (org.eclipse.dd.dc.Bounds)11 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)10 FlowNode (org.eclipse.bpmn2.FlowNode)10 Process (org.eclipse.bpmn2.Process)10 SubProcess (org.eclipse.bpmn2.SubProcess)10 BPMNEdge (org.eclipse.bpmn2.di.BPMNEdge)10 RootElement (org.eclipse.bpmn2.RootElement)9 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)7 List (java.util.List)6 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)6 DataObject (org.eclipse.bpmn2.DataObject)6 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)6 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)6 InclusiveGateway (org.eclipse.bpmn2.InclusiveGateway)5 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)5