Search in sources :

Example 16 with TreeWalkTraverseProcessorImpl

use of org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl 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)

Example 17 with TreeWalkTraverseProcessorImpl

use of org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl in project kie-wb-common by kiegroup.

the class SafeDeleteNodeProcessorTest method testDeleteIntermediateNode.

@Test
@SuppressWarnings("unchecked")
public void testDeleteIntermediateNode() {
    this.tested = new SafeDeleteNodeProcessor(new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl()), graphHolder.graph, graphHolder.intermNode);
    tested.run(callback);
    verify(callback, times(1)).deleteCandidateConnector(eq(graphHolder.edge1));
    verify(callback, times(1)).deleteCandidateConnector(eq(graphHolder.edge2));
    verify(callback, times(1)).removeChild(eq(graphHolder.parentNode), eq(graphHolder.intermNode));
    verify(callback, times(1)).deleteCandidateNode(eq(graphHolder.intermNode));
    verify(callback, never()).removeDock(any(Node.class), any(Node.class));
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) ChildrenTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) Test(org.junit.Test)

Example 18 with TreeWalkTraverseProcessorImpl

use of org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl in project kie-wb-common by kiegroup.

the class SafeDeleteNodeProcessorTest method testDeleteParentNode.

@Test
@SuppressWarnings("unchecked")
public void testDeleteParentNode() {
    this.tested = new SafeDeleteNodeProcessor(new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl()), graphHolder.graph, graphHolder.parentNode);
    tested.run(callback);
    verify(callback, times(1)).deleteConnector(eq(graphHolder.edge2));
    verify(callback, times(1)).removeChild(eq(graphHolder.parentNode), eq(graphHolder.endNode));
    verify(callback, times(1)).deleteNode(eq(graphHolder.endNode));
    verify(callback, times(1)).deleteConnector(eq(graphHolder.edge1));
    verify(callback, times(1)).deleteConnector(eq(graphHolder.edge2));
    verify(callback, times(1)).removeChild(eq(graphHolder.parentNode), eq(graphHolder.intermNode));
    verify(callback, times(1)).deleteNode(eq(graphHolder.intermNode));
    verify(callback, times(1)).deleteConnector(eq(graphHolder.edge1));
    verify(callback, times(1)).removeChild(eq(graphHolder.parentNode), eq(graphHolder.startNode));
    verify(callback, times(1)).deleteNode(eq(graphHolder.startNode));
    verify(callback, times(1)).deleteCandidateNode(eq(graphHolder.parentNode));
}
Also used : ChildrenTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) Test(org.junit.Test)

Aggregations

TreeWalkTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl)18 ChildrenTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl)14 Node (org.kie.workbench.common.stunner.core.graph.Node)9 Before (org.junit.Before)7 Test (org.junit.Test)5 TestingGraphMockHandler (org.kie.workbench.common.stunner.core.TestingGraphMockHandler)5 Edge (org.kie.workbench.common.stunner.core.graph.Edge)5 Graph (org.kie.workbench.common.stunner.core.graph.Graph)4 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 DefinitionSet (org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet)3 HashSet (java.util.HashSet)2 List (java.util.List)2 Element (org.kie.workbench.common.stunner.core.graph.Element)2 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)2 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)2 ViewTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Optional (java.util.Optional)1 Set (java.util.Set)1