use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddContextEntryCommandTest method testGraphCommandExecuteMultipleEntriesPresent.
@Test
public void testGraphCommandExecuteMultipleEntriesPresent() {
final ContextEntry firstEntry = new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("old one"));
}
});
}
};
context.getContextEntry().add(0, firstEntry);
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(3, context.getContextEntry().size());
assertEquals(firstEntry, context.getContextEntry().get(0));
assertEquals(contextEntry, context.getContextEntry().get(1));
assertEquals(defaultResultContextEntry, context.getContextEntry().get(2));
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddContextEntryCommandTest method testGraphCommandUndoMultipleEntriesPresent.
@Test
public void testGraphCommandUndoMultipleEntriesPresent() {
final ContextEntry firstEntry = new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("old one"));
}
});
}
};
context.getContextEntry().add(0, firstEntry);
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add column and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertEquals(2, context.getContextEntry().size());
assertEquals(firstEntry, context.getContextEntry().get(0));
assertEquals(defaultResultContextEntry, context.getContextEntry().get(1));
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class DeleteContextEntryCommandTest method testGraphCommandExecuteMultipleRows.
@Test
public void testGraphCommandExecuteMultipleRows() {
addContextEntries(3);
final ContextEntry firstEntry = context.getContextEntry().get(0);
final ContextEntry lastEntry = context.getContextEntry().get(2);
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
Assertions.assertThat(context.getContextEntry()).containsExactly(firstEntry, lastEntry);
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class DeleteContextEntryCommandTest method testGraphCommandUndoMultipleRows.
@Test
public void testGraphCommandUndoMultipleRows() {
addContextEntries(3);
final ContextEntry firstEntry = context.getContextEntry().get(0);
final ContextEntry originalEntry = context.getContextEntry().get(1);
final ContextEntry lastEntry = context.getContextEntry().get(2);
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Delete row and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
Assertions.assertThat(context.getContextEntry()).containsExactly(firstEntry, originalEntry, lastEntry);
}
use of org.kie.workbench.common.stunner.core.rule.RuleViolation in project kie-wb-common by kiegroup.
the class AddDecisionRuleCommandTest method testCanvasCommandExecuteInsertBelowThenUndo.
@Test
public void testCanvasCommandExecuteInsertBelowThenUndo() {
// The default behaviour of tests in this class is to "insert above"
final DecisionRule existingRule = new DecisionRule();
final DMNGridRow existingUiRow = new DMNGridRow();
dtable.getRule().add(existingRule);
uiModel.appendRow(existingUiRow);
makeCommand(1);
uiModel.appendColumn(uiInputClauseColumn);
uiModel.appendColumn(uiOutputClauseColumn);
uiModel.appendColumn(uiDescriptionColumn);
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler);
graphCommand.execute(graphCommandExecutionContext);
canvasCommand.execute(canvasHandler);
canvasCommand.undo(canvasHandler);
assertEquals(1, uiModel.getRowCount());
assertEquals(existingUiRow, uiModel.getRow(0));
// one time in execute(), one time in undo()
verify(canvasOperation, times(2)).execute();
verify(command, times(2)).updateRowNumbers();
verify(command, times(2)).updateParentInformation();
}
Aggregations