Search in sources :

Example 21 with TestingGraphMockHandler

use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.

the class SetCanvasChildNodeCommandTest method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    super.setUp();
    TestingGraphMockHandler graphTestHandler = new TestingGraphMockHandler();
    graph1Instance = TestingGraphInstanceBuilder.newGraph1(graphTestHandler);
    when(diagram.getGraph()).thenReturn(graph1Instance.graph);
    when(graphIndex.getGraph()).thenReturn(graph1Instance.graph);
    final String edge1UUID = graph1Instance.edge1.getUUID();
    final String edge2UUID = graph1Instance.edge2.getUUID();
    when(canvas.getShape(edge1UUID)).thenReturn(connectorShape1);
    when(canvas.getShape(edge2UUID)).thenReturn(connectorShape2);
    when(connectorShape1.getShapeView()).thenReturn(connectorShapeView1);
    when(connectorShape2.getShapeView()).thenReturn(connectorShapeView2);
    this.tested = new SetCanvasChildNodeCommand(graph1Instance.startNode, graph1Instance.intermNode);
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 22 with TestingGraphMockHandler

use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.

the class UpdateDockNodeCommandTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.graphHandler = new TestingGraphMockHandler();
    this.graphHolder = TestingGraphInstanceBuilder.newGraph2(graphHandler);
    this.laneNode = graphHandler.newViewNode(LANE_UUID, Optional.empty(), 50, 59, 500, 500);
    graphHandler.setChild(graphHolder.parentNode, laneNode);
    graphHandler.removeChild(graphHolder.parentNode, graphHolder.endNode);
    graphHandler.setChild(laneNode, graphHolder.endNode);
    this.dockNode = graphHandler.newViewNode(DOCK_UUID, Optional.empty(), 0, 0, 15, 15);
    graphHandler.setChild(graphHolder.parentNode, dockNode);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(canvasHandler.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getGraphIndex()).thenReturn(graphHandler.graphIndex);
    when(diagram.getMetadata()).thenReturn(metadata);
    when(diagram.getGraph()).thenReturn(graphHandler.graph);
    when(metadata.getDefinitionSetId()).thenReturn(TestingGraphMockHandler.DEF_SET_ID);
    when(metadata.getShapeSetId()).thenReturn(SHAPE_SET_ID);
    when(metadata.getCanvasRootUUID()).thenReturn(graphHolder.parentNode.getUUID());
    this.tested = new UpdateDockNodeCommand(graphHolder.endNode, dockNode);
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 23 with TestingGraphMockHandler

use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.

the class NodeFactoryImplTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.testingkHelper = new TestingGraphMockHandler();
    when(testingkHelper.definitionAdapter.getId(eq(definition))).thenReturn(ID);
    when(testingkHelper.definitionAdapter.getLabels(eq(definition))).thenReturn(LABELS);
    when(definitionUtils.getDefinitionManager()).thenReturn(testingkHelper.definitionManager);
    when(definitionUtils.buildBounds(eq(definition), anyDouble(), anyDouble())).thenReturn(BOUNDS);
    this.tested = new NodeFactoryImpl(definitionUtils);
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 24 with TestingGraphMockHandler

use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.

the class GraphBoundsIndexerImplTest method setup.

@Before
public void setup() {
    this.graphTestHandlerParent = new TestingGraphMockHandler();
    graphInstanceParent = TestingGraphInstanceBuilder.newGraph2(graphTestHandlerParent);
    ChildrenTraverseProcessor childrenTraverseProcessor = new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl());
    graphBoundsIndexerImpl = new GraphBoundsIndexerImpl(childrenTraverseProcessor);
    graphBoundsIndexerImpl.build(graphInstanceParent.graph);
}
Also used : ChildrenTraverseProcessor(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessor) ChildrenTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl) GraphBoundsIndexerImpl(org.kie.workbench.common.stunner.core.graph.processing.index.bounds.GraphBoundsIndexerImpl) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) Before(org.junit.Before)

Example 25 with TestingGraphMockHandler

use of org.kie.workbench.common.stunner.core.TestingGraphMockHandler in project kie-wb-common by kiegroup.

the class ChildrenTraverseProcessorImplTest method setup.

@Before
public void setup() {
    this.graphTestHandler = new TestingGraphMockHandler();
    this.tested = new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl());
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) Before(org.junit.Before)

Aggregations

TestingGraphMockHandler (org.kie.workbench.common.stunner.core.TestingGraphMockHandler)26 Before (org.junit.Before)21 Node (org.kie.workbench.common.stunner.core.graph.Node)6 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)6 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)6 Test (org.junit.Test)5 Edge (org.kie.workbench.common.stunner.core.graph.Edge)5 TreeWalkTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl)5 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)4 Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)4 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 Ignore (org.junit.Ignore)3 ChildrenTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl)3 RuleEvaluationContext (org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext)3 LocalClipboardControl (org.kie.workbench.common.stunner.core.client.canvas.controls.clipboard.LocalClipboardControl)2 HashMap (java.util.HashMap)1 Optional (java.util.Optional)1 RunWith (org.junit.runner.RunWith)1 TestingGraphInstanceBuilder (org.kie.workbench.common.stunner.core.TestingGraphInstanceBuilder)1 ControlPointImpl (org.kie.workbench.common.stunner.core.graph.content.view.ControlPointImpl)1