use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class RelationGridTest method testOnItemSelectedDeleteRow.
@Test
public void testOnItemSelectedDeleteRow() {
relation.getRow().add(new List());
setupGrid(0);
final java.util.List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0);
final HasListSelectorControl.ListSelectorTextItem ti = (HasListSelectorControl.ListSelectorTextItem) items.get(DELETE_ROW);
grid.onItemSelected(ti);
verify(cellEditorControls).hide();
verify(grid).deleteRow(eq(0));
}
use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testGraphCommandExecuteWithRows.
@Test
public void testGraphCommandExecuteWithRows() {
relation.getRow().add(new List());
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(1, relation.getColumn().size());
assertEquals(informationItem, relation.getColumn().get(0));
assertEquals(1, relation.getRow().size());
assertEquals(1, relation.getRow().get(0).getExpression().size());
assertTrue(relation.getRow().get(0).getExpression().get(0) instanceof LiteralExpression);
}
use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testGraphCommandUndoWithRows.
@Test
public void testGraphCommandUndoWithRows() {
relation.getRow().add(new List());
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add column and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertEquals(0, relation.getColumn().size());
assertEquals(1, relation.getRow().size());
assertEquals(0, relation.getRow().get(0).getExpression().size());
}
use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testGraphCommandExecuteWithExistingColumn_InsertBefore.
@Test
public void testGraphCommandExecuteWithExistingColumn_InsertBefore() {
final InformationItem existingInformationItem = new InformationItem();
relation.getColumn().add(existingInformationItem);
final List row = new List();
relation.getRow().add(row);
final LiteralExpression existingLiteralExpression = new LiteralExpression();
row.getExpression().add(0, existingLiteralExpression);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(2, relation.getColumn().size());
assertEquals(informationItem, relation.getColumn().get(0));
assertEquals(existingInformationItem, relation.getColumn().get(1));
assertEquals(1, relation.getRow().size());
assertEquals(2, relation.getRow().get(0).getExpression().size());
assertTrue(relation.getRow().get(0).getExpression().get(0) instanceof LiteralExpression);
assertEquals(existingLiteralExpression, relation.getRow().get(0).getExpression().get(1));
}
use of org.kie.dmn.model.v1_1.List in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method testCanvasCommandExecuteWithColumns.
@Test
public void testCanvasCommandExecuteWithColumns() {
relation.getRow().add(new List());
relation.getRow().add(new List());
relation.getColumn().add(new InformationItem());
uiModel.appendColumn(uiModelColumn);
uiModel.appendRow(new DMNGridRow());
uiModel.appendRow(new DMNGridRow());
makeCommand(1);
// Add Graph row first as RelationUIModelMapper relies on the model being first updated
command.newGraphCommand(handler).execute(gce);
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
assertEquals(3, uiModel.getRowCount());
assertEquals(uiModelRow, uiModel.getRows().get(1));
assertEquals(2, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
// checking just the row added by command
assertEquals(uiModelColumn, uiModel.getColumns().get(1));
assertEquals(2, uiModel.getRows().get(1).getCells().size());
assertEquals(2, uiModel.getCell(1, 0).getValue().getValue());
assertEquals("", uiModel.getCell(1, 1).getValue().getValue());
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
Aggregations