use of org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class AddOutputClauseCommandTest method testGraphCommandUndoNoOutputClauseColumns.
@Test(expected = ArrayIndexOutOfBoundsException.class)
public void testGraphCommandUndoNoOutputClauseColumns() throws Exception {
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
dtable.getRule().add(new DecisionRule());
assertEquals(0, dtable.getOutput().size());
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
assertEquals(GraphCommandResultBuilder.SUCCESS, graphCommand.undo(graphCommandExecutionContext));
}
use of org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testGraphCommandUndoWithParameters.
@Test
public void testGraphCommandUndoWithParameters() {
final InformationItem otherParameter = new InformationItem();
function.getFormalParameter().add(otherParameter);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add parameter and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertFormalParameters(parameter, otherParameter);
}
use of org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testRemoveFromMiddleThenUndo.
@Test
public void testRemoveFromMiddleThenUndo() {
final InformationItem firstParameter = new InformationItem();
firstParameter.setName(new Name("first"));
function.getFormalParameter().add(0, firstParameter);
final InformationItem lastParameter = new InformationItem();
lastParameter.setName(new Name("last"));
function.getFormalParameter().add(lastParameter);
// call to get proper old index of parameter
this.command = new RemoveParameterCommand(function, parameter, canvasOperation);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add parameter and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertFormalParameters(firstParameter, lastParameter);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertFormalParameters(firstParameter, parameter, lastParameter);
}
use of org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testGraphCommandExecuteWithParameters.
@Test
public void testGraphCommandExecuteWithParameters() {
final InformationItem otherParameter = new InformationItem();
function.getFormalParameter().add(otherParameter);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertFormalParameters(otherParameter);
}
use of org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext in project kie-wb-common by kiegroup.
the class AddParameterBindingCommandTest method testGraphCommandExecuteInsertToFirstPlace.
@Test
public void testGraphCommandExecuteInsertToFirstPlace() {
final Binding firstBinding = new Binding();
final Binding secondBinding = new Binding();
invocation.getBinding().add(firstBinding);
invocation.getBinding().add(secondBinding);
makeCommand(0);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertBindingDefinitions(binding, firstBinding, secondBinding);
}
Aggregations