use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class DecisionTablePropertyConverterTest method testDMNFromWBMultipleOutputClauseTypeRef.
@Test
public void testDMNFromWBMultipleOutputClauseTypeRef() {
final DecisionTable wb = new DecisionTable();
final OutputClause wbOutputClause1 = new OutputClause();
final OutputClause wbOutputClause2 = new OutputClause();
wb.getId().setValue(UUID);
wb.getDescription().setValue(DESCRIPTION);
wb.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(NULL_NS_URI, QNAME_LOCALPART));
wbOutputClause1.setName(NAME + "-oc1");
wbOutputClause2.setName(NAME + "-oc2");
wbOutputClause1.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(NULL_NS_URI, QNAME_LOCALPART + "-oc1"));
wbOutputClause2.setTypeRef(new org.kie.workbench.common.dmn.api.property.dmn.QName(NULL_NS_URI, QNAME_LOCALPART + "-oc2"));
wb.getOutput().add(wbOutputClause1);
wb.getOutput().add(wbOutputClause2);
final org.kie.dmn.model.api.DecisionTable dmn = DecisionTablePropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNotNull();
assertThat(dmn.getId()).isNotNull();
assertThat(dmn.getId()).isEqualTo(UUID);
assertThat(dmn.getDescription()).isNotNull();
assertThat(dmn.getDescription()).isEqualTo(DESCRIPTION);
assertThat(dmn.getTypeRef()).isNotNull();
assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(QNAME_LOCALPART);
assertThat(dmn.getOutput()).hasSize(2);
final org.kie.dmn.model.api.OutputClause dmnOutputClause1 = dmn.getOutput().get(0);
final org.kie.dmn.model.api.OutputClause dmnOutputClause2 = dmn.getOutput().get(1);
assertThat(dmnOutputClause1.getName()).isEqualTo(NAME + "-oc1");
assertThat(dmnOutputClause2.getName()).isEqualTo(NAME + "-oc2");
assertThat(dmnOutputClause1.getTypeRef().getLocalPart()).isEqualTo(QNAME_LOCALPART + "-oc1");
assertThat(dmnOutputClause2.getTypeRef().getLocalPart()).isEqualTo(QNAME_LOCALPART + "-oc2");
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class ExpressionPropertyConverterTest method testDMNFromWB_DecisionTableConversion.
@Test
public void testDMNFromWB_DecisionTableConversion() {
final DecisionTable wb = new DecisionTable();
final List<Double> wbComponentWidths = wb.getComponentWidths();
wbComponentWidths.set(0, 100.0);
wb.getId().setValue(EXPRESSION_UUID);
assertDMNFromWBConversion(wb, TDecisionTable.class, 100.0);
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable 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.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.
the class DeleteDecisionRuleCommandTest method setup.
@Before
public void setup() {
this.dtable = new DecisionTable();
this.rule = new DecisionRule();
this.dtable.getRule().add(rule);
this.uiModel = new DMNGridData();
this.uiModelRow = new BaseGridRow();
this.uiModel.appendRow(uiModelRow);
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable 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();
}
Aggregations