use of org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class ConnectorParentsMatchLevel1Tests method testSetEdge1TargetAsEndNode.
@Test
@SuppressWarnings("unchecked")
public void testSetEdge1TargetAsEndNode() {
SetConnectionTargetNodeCommand setTarget = new SetConnectionTargetNodeCommand(graph.endNode, graph.edge1);
ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
CommandResult<RuleViolation> result = setTarget.allow(executionContext);
assertSuccessfullResult(result);
}
use of org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class MultipleEvaluationContextStatesTest method testExecuteShortcutWithRules.
@Test
@SuppressWarnings("unchecked")
public void testExecuteShortcutWithRules() {
SafeDeleteNodeCommand deleteNodeCommand = new SafeDeleteNodeCommand(graph1Instance.intermNode);
ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
CommandResult<RuleViolation> result = deleteNodeCommand.allow(executionContext);
assertFalse(isError(result));
assertFalse(isWarn(result));
assertFalse(result.getViolations().iterator().hasNext());
}
use of org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class MultipleEvaluationContextStatesTest method createExecutionContext.
@SuppressWarnings("unchecked")
private ContextualGraphCommandExecutionContext createExecutionContext() {
EdgeOccurrences rule1 = new EdgeOccurrences("restrictEdge1InEdgesCount", "edgeBeanId", "endNodeBeanLabel", EdgeCardinalityContext.Direction.INCOMING, 0, 1);
graphTestHandler.ruleSet.getRules().add(rule1);
CanConnect connectionRule = new CanConnect("allowConnectionsForEdge1", "edgeBeanId", new Lists.Builder<CanConnect.PermittedConnection>().add(new CanConnect.PermittedConnection("all", "all")).build());
graphTestHandler.ruleSet.getRules().add(connectionRule);
RuleManager ruleManager = graphTestHandler.createRuleManagerImplementation();
return new ContextualGraphCommandExecutionContext(graphTestHandler.getDefinitionManager(), graphTestHandler.getFactoryManager(), ruleManager, graphTestHandler.graphIndex, graphTestHandler.ruleSet);
}
use of org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class ConnectorParentsMatchLevel2Tests method testSetEdge1TargetAsEndNode.
// CONNECTION contexts
@Test
@SuppressWarnings("unchecked")
public void testSetEdge1TargetAsEndNode() {
SetConnectionTargetNodeCommand setTarget = new SetConnectionTargetNodeCommand(graph.endNode, graph.edge1);
ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
CommandResult<RuleViolation> result = setTarget.allow(executionContext);
assertSuccessfullResult(result);
}
use of org.kie.workbench.common.stunner.core.graph.command.ContextualGraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class ConnectorParentsMatchLevel2Tests method testSetEdge1TargetAsNodeA.
@Test
@SuppressWarnings("unchecked")
public void testSetEdge1TargetAsNodeA() {
SetConnectionTargetNodeCommand setTarget = new SetConnectionTargetNodeCommand(graph.nodeA, graph.edge1);
ContextualGraphCommandExecutionContext executionContext = createExecutionContext();
CommandResult<RuleViolation> result = setTarget.allow(executionContext);
assertSuccessfullResult(result);
}
Aggregations