Search in sources :

Example 6 with SetChildrenCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveIntermNodeIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveIntermNodeIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, graph.intermNode);
    CommandResult<RuleViolation> result = setChildren.allow(executionContext);
    assertRuleFailedResult(result);
}
Also used : SetChildrenCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Example 7 with SetChildrenCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveSomeConnectedNodesIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveSomeConnectedNodesIntoParentNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, Arrays.asList(graph.startNode, graph.endNode));
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    CommandResult<RuleViolation> result = setChildren.allow(executionContext);
    assertRuleFailedResult(result);
}
Also used : SetChildrenCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Example 8 with SetChildrenCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveStartNodeIntoNodeB.

@Test
@SuppressWarnings("unchecked")
public void testMoveStartNodeIntoNodeB() {
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.nodeB, graph.startNode);
    CommandResult<RuleViolation> result = setChildren.allow(executionContext);
    assertTrue(isError(result));
    assertTrue(result.getViolations().iterator().hasNext());
    RuleViolation ruleViolation = result.getViolations().iterator().next();
    assertTrue(ruleViolation instanceof ContextOperationNotAllowedViolation);
}
Also used : SetChildrenCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand) ContextOperationNotAllowedViolation(org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Example 9 with SetChildrenCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveStartNodeIntoSubProcessNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveStartNodeIntoSubProcessNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.subProcessNode, graph.startNode);
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    CommandResult<RuleViolation> result = setChildren.allow(executionContext);
    assertSuccessfullResult(result);
}
Also used : SetChildrenCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Example 10 with SetChildrenCommand

use of org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveSomeConnectedNodesIntoSubProcessNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveSomeConnectedNodesIntoSubProcessNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.subProcessNode, Arrays.asList(graph.startNode, graph.endNode));
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    CommandResult<RuleViolation> result = setChildren.allow(executionContext);
    assertSuccessfullResult(result);
}
Also used : SetChildrenCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)21 SetChildrenCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand)21 ContextualGraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext)20 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)20 ContextOperationNotAllowedViolation (org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 DirectGraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.DirectGraphCommandExecutionContext)1 AddNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.AddNodeCommand)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)1 MapIndexBuilder (org.kie.workbench.common.stunner.core.graph.processing.index.map.MapIndexBuilder)1