use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper in project kie-wb-common by kiegroup.
the class DeleteOutputClauseCommandTest method setup.
@Before
public void setup() {
this.dtable = new DecisionTable();
this.outputClause = new OutputClause();
this.dtable.getOutput().add(outputClause);
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiOutputClauseColumn);
this.uiModel.appendColumn(uiRuleAnnotationClauseColumn);
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector, DEFAULT_HEIGHT);
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT + dtable.getInput().size());
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiOutputClauseColumn).getIndex();
doReturn(2).when(uiRuleAnnotationClauseColumn).getIndex();
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper in project kie-wb-common by kiegroup.
the class DeleteRuleAnnotationClauseCommandTest method testNewCanvasCommandUndo.
@Test
public void testNewCanvasCommandUndo() {
final DeleteRuleAnnotationClauseCommand command = mock(DeleteRuleAnnotationClauseCommand.class);
final AbstractCanvasHandler handler = mock(AbstractCanvasHandler.class);
final GridData uiModel = mock(GridData.class);
final GridColumn oldUiModelColumn = mock(GridColumn.class);
final int uiColumnIndex = 3;
final DecisionRule rule1 = mock(DecisionRule.class);
final DecisionRule rule2 = mock(DecisionRule.class);
final List<DecisionRule> rules = Arrays.asList(rule1, rule2);
final org.uberfire.mvp.Command undoCanvasOperation = mock(org.uberfire.mvp.Command.class);
final DecisionTableUIModelMapper uiModelMapper = mock(DecisionTableUIModelMapper.class);
doCallRealMethod().when(command).newCanvasCommand(handler);
when(command.getUiModel()).thenReturn(uiModel);
when(command.getUiColumnIndex()).thenReturn(uiColumnIndex);
when(command.getOldUiModelColumn()).thenReturn(oldUiModelColumn);
when(command.getDecisionTable()).thenReturn(decisionTable);
when(decisionTable.getRule()).thenReturn(rules);
when(command.getUiModelMapper()).thenReturn(uiModelMapper);
when(command.getUndoCanvasOperation()).thenReturn(undoCanvasOperation);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(handler);
final CommandResult<CanvasViolation> result = canvasCommand.undo(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, result);
verify(uiModelMapper).fromDMNModel(0, uiColumnIndex);
verify(uiModelMapper).fromDMNModel(1, uiColumnIndex);
verify(command).updateParentInformation();
verify(undoCanvasOperation).execute();
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper in project kie-wb-common by kiegroup.
the class AddDecisionRuleCommandTest method setup.
@Before
public void setup() {
this.dtable = new DecisionTable();
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModelRow = new BaseGridRow();
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector, DEFAULT_HEIGHT);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
doReturn(2).when(uiOutputClauseColumn).getIndex();
doReturn(3).when(uiRuleAnnotationClauseColumn).getIndex();
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper in project kie-wb-common by kiegroup.
the class AddOutputClauseCommandTest method setUp.
@Before
public void setUp() throws Exception {
this.dtable = new DecisionTable();
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.outputClause = new OutputClause();
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector, DEFAULT_HEIGHT);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiOutputClauseColumn).getIndex();
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.dtable.DecisionTableUIModelMapper in project kie-wb-common by kiegroup.
the class DeleteInputClauseCommandTest method setup.
@Before
public void setup() {
this.dtable = new DecisionTable();
this.inputClause = new InputClause();
this.dtable.getInput().add(inputClause);
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiInputClauseColumn);
this.uiModel.appendColumn(uiAnnotationClauseColumn);
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector, DEFAULT_HEIGHT);
makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
doReturn(2).when(uiAnnotationClauseColumn).getIndex();
}
Aggregations