use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddInputClauseCommandTest method testGraphCommandUndoNoInputClauseColumns.
@Test(expected = ArrayIndexOutOfBoundsException.class)
public void testGraphCommandUndoNoInputClauseColumns() throws Exception {
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
dtable.getRule().add(new DecisionRule());
assertEquals(0, dtable.getInput().size());
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
assertEquals(GraphCommandResultBuilder.SUCCESS, graphCommand.undo(graphCommandExecutionContext));
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddOutputClauseCommandTest method testGraphCommandExecute.
@Test
public void testGraphCommandExecute() throws Exception {
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
dtable.getRule().add(new DecisionRule());
dtable.getRule().add(new DecisionRule());
assertEquals(0, dtable.getOutput().size());
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
assertEquals(GraphCommandResultBuilder.SUCCESS, graphCommand.execute(graphCommandExecutionContext));
// one new output column
assertEquals(1, dtable.getOutput().size());
// first rule
assertEquals(1, dtable.getRule().get(0).getOutputEntry().size());
assertEquals(AddOutputClauseCommand.OUTPUT_CLAUSE_DEFAULT_VALUE, dtable.getRule().get(0).getOutputEntry().get(0).getText());
// second rule
assertEquals(1, dtable.getRule().get(1).getOutputEntry().size());
assertEquals(AddOutputClauseCommand.OUTPUT_CLAUSE_DEFAULT_VALUE, dtable.getRule().get(1).getOutputEntry().get(0).getText());
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddParameterCommandTest 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(1, otherParameter);
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddParameterCommandTest 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(2, otherParameter, parameter);
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddParameterBindingCommandTest method testGraphCommandExecuteWithParameters.
@Test
public void testGraphCommandExecuteWithParameters() {
final Binding otherBinding = new Binding();
invocation.getBinding().add(otherBinding);
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertBindingDefinitions(otherBinding, binding);
}
Aggregations