Search in sources :

Example 6 with TestDefinitionsWriter

use of org.kie.workbench.common.stunner.bpmn.backend.converters.TestDefinitionsWriter 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

TestDefinitionsWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.TestDefinitionsWriter)6 SequenceFlow (org.eclipse.bpmn2.SequenceFlow)5 Test (org.junit.Test)5 FlowNode (org.eclipse.bpmn2.FlowNode)4 Bounds (org.eclipse.dd.dc.Bounds)4 Point (org.eclipse.dd.dc.Point)4 Connection (org.kie.workbench.common.stunner.core.graph.content.view.Connection)2 Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)2 Lane (org.eclipse.bpmn2.Lane)1 LanePropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.LanePropertyWriter)1 PropertyWriterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory)1