use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.RuleAnnotationClauseColumn in project kie-wb-common by kiegroup.
the class AddRuleAnnotationClauseCommandTest method testNewCanvasCommandUndo.
@Test
public void testNewCanvasCommandUndo() {
final AbstractCanvasHandler canvasHandler = mock(AbstractCanvasHandler.class);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler);
final RuleAnnotationClauseColumn column = mock(RuleAnnotationClauseColumn.class);
final Optional<RuleAnnotationClauseColumn> uiModelColumn = Optional.of(column);
doReturn(uiModelColumn).when(command).getUiModelColumn();
final CommandResult<CanvasViolation> result = canvasCommand.undo(canvasHandler);
verify(command).updateParentInformation();
verify(undoCanvasOperation).execute();
verify(uiModel).deleteColumn(column);
assertEquals(CanvasCommandResultBuilder.SUCCESS, result);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.RuleAnnotationClauseColumn in project kie-wb-common by kiegroup.
the class AddRuleAnnotationClauseCommandTest method testNewCanvasCommandExecute.
@Test
public void testNewCanvasCommandExecute() {
final AbstractCanvasHandler canvasHandler = mock(AbstractCanvasHandler.class);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler);
final RuleAnnotationClauseColumn column = mock(RuleAnnotationClauseColumn.class);
final List<DecisionRule> rules = mock(List.class);
when(rules.size()).thenReturn(3);
when(decisionTable.getRule()).thenReturn(rules);
when(uiModelColumnSupplier.get()).thenReturn(column);
final CommandResult<CanvasViolation> result = canvasCommand.execute(canvasHandler);
verify(uiModelMapper).fromDMNModel(0, uiColumnIndex);
verify(uiModelMapper).fromDMNModel(1, uiColumnIndex);
verify(uiModelMapper).fromDMNModel(2, uiColumnIndex);
verify(command).updateParentInformation();
verify(executeCanvasOperation).execute();
verify(uiModelColumnSupplier).get();
verify(uiModel).insertColumn(uiColumnIndex, column);
assertEquals(CanvasCommandResultBuilder.SUCCESS, result);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.RuleAnnotationClauseColumn in project kie-wb-common by kiegroup.
the class MoveColumnsCommandTest method testMoveSingleAnnotationColumnWithDuplicatedTitle.
@Test
public void testMoveSingleAnnotationColumnWithDuplicatedTitle() {
final DecisionTable decisionTable = new DecisionTable();
final DMNGridData model = new DMNGridData();
final RuleAnnotationClause clauseOne = new RuleAnnotationClause();
final RuleAnnotationClause clauseTwo = new RuleAnnotationClause();
final RuleAnnotationClause clauseThree = new RuleAnnotationClause();
decisionTable.getAnnotations().add(clauseOne);
decisionTable.getAnnotations().add(clauseTwo);
decisionTable.getAnnotations().add(clauseThree);
decisionTable.getRule().add(new DecisionRule() {
{
getAnnotationEntry().add(new RuleAnnotationClauseText());
getAnnotationEntry().add(new RuleAnnotationClauseText());
getAnnotationEntry().add(new RuleAnnotationClauseText());
}
});
final RuleAnnotationClauseColumn columnOne = mock(RuleAnnotationClauseColumn.class);
final RuleAnnotationClauseColumn columnTwo = mock(RuleAnnotationClauseColumn.class);
final RuleAnnotationClauseColumn columnThree = mock(RuleAnnotationClauseColumn.class);
model.appendColumn(uiRowNumberColumn);
model.appendColumn(columnOne);
model.appendColumn(columnTwo);
model.appendColumn(columnThree);
when(columnOne.getIndex()).thenReturn(1);
when(columnOne.getIndex()).thenReturn(2);
when(columnOne.getIndex()).thenReturn(3);
command = new MoveColumnsCommand(decisionTable, model, 2, Arrays.asList(columnOne), canvasOperation);
graphCommand = command.newGraphCommand(canvasHandler);
canvasCommand = command.newCanvasCommand(canvasHandler);
assertEquals(GraphCommandResultBuilder.SUCCESS, graphCommand.execute(graphCommandExecutionContext));
assertEquals(CanvasCommandResultBuilder.SUCCESS, canvasCommand.execute(canvasHandler));
}
Aggregations