use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method testDuplicateDecisionRule.
@Test
@SuppressWarnings("unchecked")
public void testDuplicateDecisionRule() {
setupGrid(makeHasNameForDecision(), 0);
final DecisionTable dtable = grid.getExpression().get().get();
assertThat(dtable.getRule().size()).isEqualTo(1);
final DecisionRule rule0 = dtable.getRule().get(0);
assertThat(rule0.getInputEntry().size()).isEqualTo(1);
assertThat(rule0.getOutputEntry().size()).isEqualTo(1);
rule0.getInputEntry().get(0).getText().setValue("input");
rule0.getOutputEntry().get(0).getText().setValue("output");
rule0.getDescription().setValue("description");
grid.duplicateDecisionRule(0);
verify(sessionCommandManager).execute(eq(canvasHandler), addDecisionRuleCommandCaptor.capture());
final AddDecisionRuleCommand addDecisionRuleCommand = addDecisionRuleCommandCaptor.getValue();
addDecisionRuleCommand.execute(canvasHandler);
assertThat(dtable.getRule().size()).isEqualTo(2);
final DecisionRule rule1 = dtable.getRule().get(1);
assertThat(rule1.getInputEntry().size()).isEqualTo(1);
assertThat(rule1.getOutputEntry().size()).isEqualTo(1);
assertThat(rule0.getInputEntry().get(0).getText().getValue()).isEqualTo("input");
assertThat(rule0.getOutputEntry().get(0).getText().getValue()).isEqualTo("output");
assertThat(rule0.getDescription().getValue()).isEqualTo("description");
assertThat(rule1.getInputEntry().get(0).getText().getValue()).isEqualTo("input");
assertThat(rule1.getOutputEntry().get(0).getText().getValue()).isEqualTo("output");
assertThat(rule1.getDescription().getValue()).isEqualTo("description");
verifyCommandExecuteOperation(BaseExpressionGrid.RESIZE_EXISTING);
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class AddInputClauseCommandTest method setUp.
@Before
public void setUp() throws Exception {
this.dtable = new DecisionTable();
this.uiModel = new DMNGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.inputClause = new InputClause();
this.uiModelMapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector, DEFAULT_HEIGHT);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable 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();
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class DMNEditBusinessKnowledgeModelToolboxActionTest method testActionSetExpression.
@Test
public void testActionSetExpression() {
tested.onMouseClick(canvasHandler, E_UUID, mouseClickEvent);
final ArgumentCaptor<EditExpressionEvent> eventCaptor = ArgumentCaptor.forClass(EditExpressionEvent.class);
verify(editExpressionEvent, times(1)).fire(eventCaptor.capture());
final EditExpressionEvent editExprEvent = eventCaptor.getValue();
final HasExpression hasExpression = editExprEvent.getHasExpression();
Assertions.assertThatThrownBy(() -> hasExpression.setExpression(new DecisionTable())).isInstanceOf(UnsupportedOperationException.class).hasMessage("It is not possible to set the EncapsulatedLogic of a BusinessKnowledgeModel.");
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class SetBuiltinAggregatorCommandTest method makeCommand.
private void makeCommand(final BuiltinAggregator aggregator) {
this.dtable = new DecisionTable();
this.dtable.setAggregation(aggregator);
this.command = new SetBuiltinAggregatorCommand(dtable, NEW_AGGREGATOR, canvasOperation);
}
Aggregations