Search in sources :

Example 1 with ContextOperationNotAllowedViolation

use of org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation 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 2 with ContextOperationNotAllowedViolation

use of org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation in project kie-wb-common by kiegroup.

the class ConnectorParentsMatchLevel2Tests method testMoveStartNodeIntoNodeA.

// CONTAINMENT contexts
@Test
@SuppressWarnings("unchecked")
public void testMoveStartNodeIntoNodeA() {
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.nodeA, 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)

Aggregations

Test (org.junit.Test)2 ContextualGraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext)2 SetChildrenCommand (org.kie.workbench.common.stunner.core.graph.command.impl.SetChildrenCommand)2 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)2 ContextOperationNotAllowedViolation (org.kie.workbench.common.stunner.core.rule.violations.ContextOperationNotAllowedViolation)2