Search in sources :

Example 21 with InformationItem

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

the class RelationUIModelMapperTest method setup.

@Before
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.appendRow(new BaseGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiRelationColumn1);
    this.uiModel.appendColumn(uiRelationColumn2);
    when(uiRowNumberColumn.getIndex()).thenReturn(0);
    when(uiRelationColumn1.getIndex()).thenReturn(1);
    when(uiRelationColumn2.getIndex()).thenReturn(2);
    this.relation = new Relation();
    this.relation.getColumn().add(new InformationItem());
    this.relation.getColumn().add(new InformationItem());
    final List rowList1 = new List();
    rowList1.getExpression().add(HasExpression.wrap(rowList1, new LiteralExpression() {

        {
            getText().setValue("le(1,0)");
        }
    }));
    rowList1.getExpression().add(HasExpression.wrap(rowList1, new LiteralExpression() {

        {
            getText().setValue("le(2,0)");
        }
    }));
    final List rowList2 = new List();
    rowList2.getExpression().add(HasExpression.wrap(rowList2, new LiteralExpression() {

        {
            getText().setValue("le(1,1)");
        }
    }));
    rowList2.getExpression().add(HasExpression.wrap(rowList2, new LiteralExpression() {

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

Example 22 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.model.InformationItem 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.model.InformationItem) Test(org.junit.Test)

Example 23 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.model.InformationItem 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.model.InformationItem) Test(org.junit.Test)

Example 24 with InformationItem

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

the class RelationUIModelMapperHelperTest method testGetSectionInformationItemColumnNegativeIndex.

@Test(expected = IllegalArgumentException.class)
public void testGetSectionInformationItemColumnNegativeIndex() {
    relation.getColumn().add(new InformationItem());
    assertEquals(RelationSection.INFORMATION_ITEM, getInformationItemIndex(relation, -1));
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Test(org.junit.Test)

Example 25 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.model.InformationItem 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.model.InformationItem) Test(org.junit.Test)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)110 Test (org.junit.Test)61 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)24 ContextEntry (org.kie.workbench.common.dmn.api.definition.model.ContextEntry)22 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)22 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)20 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)19 Binding (org.kie.workbench.common.dmn.api.definition.model.Binding)13 Context (org.kie.workbench.common.dmn.api.definition.model.Context)11 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)11 Before (org.junit.Before)10 List (org.kie.workbench.common.dmn.api.definition.model.List)10 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)10 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)9 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)9 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)9 HasName (org.kie.workbench.common.dmn.api.definition.HasName)7 Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)7 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)7