Search in sources :

Example 26 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel2Tests method testMoveEndNodeIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveEndNodeIntoParentNode() {
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
    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 27 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel2Tests method testMoveIntermNodeIntoSubProcessNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveIntermNodeIntoSubProcessNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.subProcessNode, graph.intermNode);
    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 28 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel2Tests method testMoveAllConnectedNodesIntoSubProcessNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveAllConnectedNodesIntoSubProcessNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.subProcessNode, Arrays.asList(graph.startNode, graph.intermNode, 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)

Example 29 with ContextualGraphCommandExecutionContext

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

the class ConnectorParentsMatchLevel2Tests method testMoveAllConnectedNodesIntoParentNode.

@Test
@SuppressWarnings("unchecked")
public void testMoveAllConnectedNodesIntoParentNode() {
    SetChildrenCommand setChildren = new SetChildrenCommand(graph.parentNode, Arrays.asList(graph.startNode, graph.intermNode, 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)

Example 30 with ContextualGraphCommandExecutionContext

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

the class TestingGraphInstances method createConstrainedExecutionContext.

public static ContextualGraphCommandExecutionContext createConstrainedExecutionContext(TestingGraphMockHandler graphTestHandler, String ruleId, Class<?> constrainedType) {
    ContextualGraphCommandExecutionContext executionContext = createExecutionContext(graphTestHandler);
    RuleExtension edge1ParentMatch = new RuleExtension("connectorParentMatchExtRule", ruleId).setHandlerType(ConnectorParentsMatchHandler.class).setArguments(new String[] { RULE_ERROR_MESSAGE }).setTypeArguments(new Class[] { constrainedType });
    graphTestHandler.ruleSet.getRules().add(edge1ParentMatch);
    return executionContext;
}
Also used : ContextualGraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext) RuleExtension(org.kie.workbench.common.stunner.core.rule.ext.RuleExtension)

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