Search in sources :

Example 11 with Relation

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

the class RelationUIModelMapperHelperTest method testGetSectionNonExistingIndexEqualToColumnCount.

@Test
public void testGetSectionNonExistingIndexEqualToColumnCount() {
    relation.getColumn().add(new InformationItem());
    assertEquals(RelationSection.NONE, getSection(relation, relation.getColumn().size() + 1));
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Test(org.junit.Test)

Example 12 with Relation

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

the class RelationUIModelMapperHelperTest method testGetSectionInformationItemColumn.

@Test
public void testGetSectionInformationItemColumn() {
    relation.getColumn().add(new InformationItem());
    assertEquals(RelationSection.INFORMATION_ITEM, getSection(relation, 1));
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Test(org.junit.Test)

Example 13 with Relation

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

the class RelationUIModelMapperHelperTest method testGetSectionNonExistingNegativeIndex.

@Test
public void testGetSectionNonExistingNegativeIndex() {
    relation.getColumn().add(new InformationItem());
    assertEquals(RelationSection.NONE, getSection(relation, -1));
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Test(org.junit.Test)

Example 14 with Relation

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

the class RelationUIModelMapperTest method setup.

@Before
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiRelationColumn1);
    this.uiModel.appendColumn(uiRelationColumn2);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiRelationColumn1).getIndex();
    doReturn(2).when(uiRelationColumn2).getIndex();
    this.relation = new Relation();
    this.relation.getColumn().add(new InformationItem());
    this.relation.getColumn().add(new InformationItem());
    this.relation.getRow().add(new List() {

        {
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(1,0)");
                }
            });
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(2,0)");
                }
            });
        }
    });
    this.relation.getRow().add(new List() {

        {
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(1,1)");
                }
            });
            getExpression().add(new LiteralExpression() {

                {
                    setText("le(2,1)");
                }
            });
        }
    });
    this.mapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
    this.cellValueSupplier = Optional::empty;
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) List(org.kie.workbench.common.dmn.api.definition.v1_1.List) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 15 with Relation

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

the class AddRelationColumnCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.informationItem = new InformationItem();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
    makeCommand(1);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.v1_1.Relation) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)18 Test (org.junit.Test)12 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)12 Before (org.junit.Before)7 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)5 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)5 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 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)3 Relation (se.inera.intyg.clinicalprocess.healthcond.certificate.listrelationsforcertificate.v1.Relation)3 WebcertCertificateRelation (se.inera.intyg.webcert.common.model.WebcertCertificateRelation)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 InformationItem (org.kie.dmn.model.v1_1.InformationItem)2 Relation (org.kie.dmn.model.v1_1.Relation)2 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)2 Matchers.anyString (org.mockito.Matchers.anyString)2 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)2