use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testGraphCommandExecuteDeleteMiddleWithRows.
@Test
public void testGraphCommandExecuteDeleteMiddleWithRows() {
uiModel.appendColumn(mock(RelationColumn.class));
uiModel.appendColumn(mock(RelationColumn.class));
relation.getColumn().add(new InformationItem());
relation.getColumn().add(new InformationItem());
relation.getRow().add(new List());
final LiteralExpression firstExpression = new LiteralExpression();
final LiteralExpression lastExpression = new LiteralExpression();
relation.getRow().get(0).getExpression().add(firstExpression);
relation.getRow().get(0).getExpression().add(new LiteralExpression());
relation.getRow().get(0).getExpression().add(lastExpression);
makeCommand(2);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(2, relation.getColumn().size());
assertEquals(1, relation.getRow().size());
assertEquals(2, relation.getRow().get(0).getExpression().size());
assertEquals(firstExpression, relation.getRow().get(0).getExpression().get(0));
assertEquals(lastExpression, relation.getRow().get(0).getExpression().get(1));
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method testGraphCommandExecuteWithColumns.
@Test
public void testGraphCommandExecuteWithColumns() {
relation.getColumn().add(new InformationItem());
relation.getRow().get(0).getExpression().add(new LiteralExpression());
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(0, relation.getRow().size());
assertEquals(1, relation.getColumn().size());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method testGraphCommandUndoWithColumns.
@Test
public void testGraphCommandUndoWithColumns() {
relation.getColumn().add(new InformationItem());
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.setText(VALUE);
relation.getRow().get(0).getExpression().add(literalExpression);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Delete row and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertEquals(1, relation.getColumn().size());
assertEquals(1, relation.getRow().size());
assertEquals(1, relation.getRow().get(0).getExpression().size());
assertEquals(VALUE, ((LiteralExpression) relation.getRow().get(0).getExpression().get(0)).getText());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class RelationGridTest method testInitialiseUiModel.
@Test
public void testInitialiseUiModel() throws Exception {
relation.getColumn().add(new InformationItem() {
{
getName().setValue("first column header");
}
});
final String firstRowValue = "first column value 1";
final String secondRowValue = "first column value 2";
relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText(firstRowValue);
}
});
}
});
relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText(secondRowValue);
}
});
}
});
expression = Optional.of(relation);
setupGrid(0);
assertEquals(2, grid.getModel().getRowCount());
assertEquals(firstRowValue, grid.getModel().getRow(0).getCells().get(1).getValue().getValue());
assertEquals(secondRowValue, grid.getModel().getRow(1).getCells().get(1).getValue().getValue());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.
the class RelationUIModelMapperHelperTest method testGetInformationItemIndex.
@Test
public void testGetInformationItemIndex() {
relation.getColumn().add(new InformationItem());
relation.getColumn().add(new InformationItem());
assertEquals(0, getInformationItemIndex(relation, 1));
assertEquals(1, getInformationItemIndex(relation, 2));
}
Aggregations