Search in sources :

Example 16 with TestingGraphMockHandler

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

the class ShapeUtilsTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    final TestingGraphMockHandler graphTestHandler = new TestingGraphMockHandler();
    instance2 = TestingGraphInstanceBuilder.newGraph2(graphTestHandler);
    when(canvasHandler.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
    when(graphIndex.getGraph()).thenReturn(instance2.graph);
    final String e1 = instance2.edge1.getUUID();
    final String e2 = instance2.edge2.getUUID();
    when(canvas.getShape(eq(e1))).thenReturn(edge1Shape);
    when(canvas.getShape(eq(e2))).thenReturn(edge2Shape);
    when(edge1Shape.getShapeView()).thenReturn(edge1ShapeView);
    when(edge2Shape.getShapeView()).thenReturn(edge2ShapeView);
    controlPoint1 = new ControlPointImpl(0, 0);
    controlPointList = Arrays.asList(controlPoint1);
    when(edge1Shape.getControlPoints()).thenReturn(controlPointList);
    when(edge1Shape.addControlPoints(controlPoint1)).thenReturn(controlPointList);
}
Also used : ControlPointImpl(org.kie.workbench.common.stunner.core.graph.content.view.ControlPointImpl) TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 17 with TestingGraphMockHandler

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

the class DiagramValidatorlTest method setup.

@Before
public void setup() throws Exception {
    this.graphTestHandler = new TestingGraphMockHandler();
    when(diagram.getName()).thenReturn("Test diagram");
    when(diagram.getMetadata()).thenReturn(metadata);
    this.tested = new TestDiagramValidator();
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 18 with TestingGraphMockHandler

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

the class GraphValidatorImplTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.graphTestHandler = new TestingGraphMockHandler();
    when(graphTestHandler.definitionSetRegistry.getDefinitionSetById(eq(DEF_SET_ID))).thenReturn(defSetBean);
    when(graphTestHandler.ruleAdapter.getRuleSet(eq(defSetBean))).thenReturn(graphTestHandler.ruleSet);
    this.tested = new GraphValidatorImpl(graphTestHandler.definitionManager, graphTestHandler.ruleManager, 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)

Example 19 with TestingGraphMockHandler

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

the class DeleteNodeCommandTest method setup.

@Before
public void setup() throws Exception {
    TestingGraphMockHandler graphHandler = new TestingGraphMockHandler();
    this.graphHolder = TestingGraphInstanceBuilder.newGraph2(graphHandler);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(canvasHandler.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getGraphIndex()).thenReturn(graphHandler.graphIndex);
    when(canvasHandler.getGraphExecutionContext()).thenReturn(graphHandler.graphCommandExecutionContext);
    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());
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) Before(org.junit.Before)

Example 20 with TestingGraphMockHandler

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

the class RemoveCanvasChildCommandTest 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 RemoveCanvasChildCommand(graph1Instance.startNode, graph1Instance.intermNode);
}
Also used : TestingGraphMockHandler(org.kie.workbench.common.stunner.core.TestingGraphMockHandler) 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