Search in sources :

Example 1 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel1Tests method testConstrainedSetEdge1TargetAsNodeA.

@Test
@SuppressWarnings("unchecked")
public void testConstrainedSetEdge1TargetAsNodeA() {
    SetConnectionTargetNodeCommand setTarget = new SetConnectionTargetNodeCommand(graph.nodeA, graph.edge1);
    ContextualGraphCommandExecutionContext executionContext = createConstrainedExecutionContext();
    CommandResult<RuleViolation> result = setTarget.allow(executionContext);
    assertRuleFailedResult(result);
}
Also used : SetConnectionTargetNodeCommand(org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) Test(org.junit.Test)

Example 2 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel1Tests method testConstrainedMoveEndNodeIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testConstrainedMoveEndNodeIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createConstrainedExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, graph.endNode);
    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 3 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel1Tests method testConstrainedMoveStartNodeIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testConstrainedMoveStartNodeIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createConstrainedExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, graph.startNode);
    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 4 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel1Tests method testConstrainedMoveStartIntermNodesIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testConstrainedMoveStartIntermNodesIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createConstrainedExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, Arrays.asList(graph.startNode, 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 5 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel1Tests method testConstrainedMoveIntermNodeIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testConstrainedMoveIntermNodeIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createConstrainedExecutionContext();
    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)

Aggregations

ContextualGraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext)39 Test (org.junit.Test)37 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)35 SetChildrenCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand)20 SetConnectionTargetNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionTargetNodeCommand)8 SetConnectionSourceNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetConnectionSourceNodeCommand)5 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)2 SafeDeleteNodeCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SafeDeleteNodeCommand)2 ContextOperationNotAllowedViolation (org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation)2 Lists (org.kie.soup.commons.util.Lists)1 RuleExtension (org.kie.workbench.common.stunner.core.rule.ext.RuleExtension)1 CanConnect (org.kie.workbench.common.stunner.core.rule.impl.CanConnect)1 EdgeOccurrences (org.kie.workbench.common.stunner.core.rule.impl.EdgeOccurrences)1