Search in sources :

Example 21 with Relation

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

the class RelationEditorDefinitionTest method testModelEnrichment.

@Test
public void testModelEnrichment() {
    final Optional<Relation> oModel = definition.getModelClass();
    definition.enrich(Optional.empty(), hasExpression, oModel);
    final Relation model = oModel.get();
    assertNotNull(model.getRow());
    assertNotNull(model.getRow().get(0).getId());
    assertNotNull(model.getRow().get(0).getExpression().get(0));
    assertTrue(model.getRow().get(0).getExpression().get(0).getExpression() instanceof LiteralExpression);
    assertNotNull(model.getColumn());
    assertEquals(1, model.getColumn().size());
    assertEquals(RelationDefaultValueUtilities.PREFIX + "1", model.getColumn().get(0).getName().getValue());
    assertEquals(model, model.getRow().get(0).getParent());
    assertEquals(model, model.getColumn().get(0).getParent());
    assertEquals(model.getRow().get(0), model.getRow().get(0).getExpression().get(0).getExpression().getParent());
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) Test(org.junit.Test)

Aggregations

Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)21 List (org.kie.workbench.common.dmn.api.definition.model.List)9 Before (org.junit.Before)7 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)7 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 HasComponentWidths (org.kie.workbench.common.dmn.api.definition.HasComponentWidths)4 Context (org.kie.workbench.common.dmn.api.definition.model.Context)4 DecisionTable (org.kie.workbench.common.dmn.api.definition.model.DecisionTable)4 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)4 Invocation (org.kie.workbench.common.dmn.api.definition.model.Invocation)4 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)4 RelationUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper)4 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)4 TRelation (org.kie.dmn.model.v1_2.TRelation)3 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 JSITList (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList)3 JSITRelation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation)3 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)3