Search in sources :

Example 56 with DecisionTable

use of org.kie.workbench.common.dmn.api.definition.model.DecisionTable in project kie-wb-common by kiegroup.

the class DecisionTableEditorDefinitionEnricherTest method testModelEnrichmentWhenTopLevelDecisionTableWithDecisionAndInputData.

@Test
@SuppressWarnings("unchecked")
public void testModelEnrichmentWhenTopLevelDecisionTableWithDecisionAndInputData() {
    setupGraphWithDiagram();
    setupGraphWithDecision();
    setupGraphWithInputData();
    final Optional<DecisionTable> oModel = definition.getModelClass();
    definition.enrich(Optional.of(NODE_UUID), decision, oModel);
    final DecisionTable model = oModel.get();
    assertBasicEnrichment(model);
    final List<InputClause> input = model.getInput();
    assertThat(input.size()).isEqualTo(3);
    assertThat(input.get(0).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
    assertThat(input.get(0).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_2);
    assertThat(input.get(0).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_2);
    assertThat(input.get(1).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
    assertThat(input.get(1).getInputExpression().getText().getValue()).isEqualTo(DECISION_NAME_1);
    assertThat(input.get(1).getInputExpression().getTypeRef()).isEqualTo(DECISION_QNAME_1);
    assertThat(input.get(2).getInputExpression()).isInstanceOf(InputClauseLiteralExpression.class);
    assertThat(input.get(2).getInputExpression().getText().getValue()).isEqualTo(INPUT_DATA_NAME_1);
    assertThat(input.get(2).getInputExpression().getTypeRef()).isEqualTo(INPUT_DATA_QNAME_1);
    assertStandardOutputClauseEnrichment(model);
    assertStandardDecisionRuleEnrichment(model);
    assertParentHierarchyEnrichment(model);
}
Also used : DecisionTable(org.kie.workbench.common.dmn.api.definition.model.DecisionTable) InputClause(org.kie.workbench.common.dmn.api.definition.model.InputClause) Test(org.junit.Test)

Aggregations

DecisionTable (org.kie.workbench.common.dmn.api.definition.model.DecisionTable)56 Test (org.junit.Test)32 OutputClause (org.kie.workbench.common.dmn.api.definition.model.OutputClause)22 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)17 InputClause (org.kie.workbench.common.dmn.api.definition.model.InputClause)15 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)13 DecisionRule (org.kie.workbench.common.dmn.api.definition.model.DecisionRule)12 Before (org.junit.Before)11 ItemDefinition (org.kie.workbench.common.dmn.api.definition.model.ItemDefinition)10 Definitions (org.kie.workbench.common.dmn.api.definition.model.Definitions)9 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)9 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)8 Context (org.kie.workbench.common.dmn.api.definition.model.Context)7 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)7 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)7 RuleAnnotationClause (org.kie.workbench.common.dmn.api.definition.model.RuleAnnotationClause)7 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)6 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)6 TDecisionTable (org.kie.dmn.model.v1_2.TDecisionTable)5 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)5