use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class BaseMoveCommandsTest method addRelationRow.
protected void addRelationRow(final String identifier) {
final List row = new List();
for (int index = 0; index < relation.getColumn().size(); index++) {
final String ii = makeIdentifier(identifier, index);
row.getExpression().add(new LiteralExpression() {
{
setId(new Id(ii));
}
});
}
relation.getRow().add(row);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testGraphCommandExecuteWithRows.
@Test
public void testGraphCommandExecuteWithRows() {
relation.getRow().add(new List());
relation.getRow().get(0).getExpression().add(new LiteralExpression());
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(0, relation.getColumn().size());
assertEquals(1, relation.getRow().size());
assertEquals(0, relation.getRow().get(0).getExpression().size());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testCanvasCommandUndoWithRows.
@Test
public void testCanvasCommandUndoWithRows() {
relation.getRow().add(new List());
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.setText(VALUE);
relation.getRow().get(0).getExpression().add(literalExpression);
uiModel.appendRow(new DMNGridRow());
uiModelMapper.fromDMNModel(0, 1);
makeCommand();
// Delete column and then undo
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
reset(command, canvasOperation);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.undo(handler));
assertEquals(2, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
assertEquals(uiModelColumn, uiModel.getColumns().get(1));
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getRows().get(0).getCells().size());
assertEquals(VALUE, uiModel.getCell(0, 1).getValue().getValue());
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method testCanvasCommandUndoWithColumns.
@Test
public void testCanvasCommandUndoWithColumns() {
relation.getColumn().add(new InformationItem());
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.setText(VALUE);
relation.getRow().get(0).getExpression().add(literalExpression);
uiModel.appendColumn(uiModelColumn);
uiModelMapper.fromDMNModel(0, 0);
uiModelMapper.fromDMNModel(0, 1);
// Delete row and then undo
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
reset(command, canvasOperation);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.undo(handler));
assertEquals(2, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
assertEquals(uiModelColumn, uiModel.getColumns().get(1));
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getCell(0, 0).getValue().getValue());
assertEquals(VALUE, uiModel.getCell(0, 1).getValue().getValue());
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method testGraphCommandExecuteRemoveMiddleWithColumns.
@Test
public void testGraphCommandExecuteRemoveMiddleWithColumns() {
uiModel.appendRow(new DMNGridRow());
uiModel.appendRow(new DMNGridRow());
final List firstRow = new List();
final List lastRow = new List();
relation.getRow().add(0, firstRow);
relation.getRow().add(lastRow);
relation.getColumn().add(new InformationItem());
relation.getRow().get(0).getExpression().add(new LiteralExpression());
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(2, relation.getRow().size());
assertEquals(firstRow, relation.getRow().get(0));
assertEquals(lastRow, relation.getRow().get(1));
assertEquals(1, relation.getColumn().size());
}
Aggregations