use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpression 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.getText().setValue(VALUE);
relation.getRow().get(0).getExpression().add(HasExpression.wrap(rowList, 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).getExpression()).getText().getValue());
}
use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpression 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(HasExpression.wrap(rowList, 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.model.LiteralExpression in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method testGraphCommandExecuteWithColumns.
@Test
public void testGraphCommandExecuteWithColumns() {
relation.getColumn().add(new InformationItem());
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(1, relation.getRow().size());
assertEquals(row, relation.getRow().get(0));
assertEquals(1, relation.getColumn().size());
assertEquals(1, relation.getRow().get(0).getExpression().size());
assertTrue(relation.getRow().get(0).getExpression().get(0).getExpression() instanceof LiteralExpression);
assertEquals(relation, row.getParent());
assertEquals(relation.getRow().get(0), relation.getRow().get(0).getExpression().get(0).getExpression().getParent());
}
use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpression in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method testGraphCommandExecuteInsertMiddleWithColumns.
@Test
public void testGraphCommandExecuteInsertMiddleWithColumns() {
relation.getRow().add(new List());
relation.getRow().add(new List());
relation.getColumn().add(new InformationItem());
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(3, relation.getRow().size());
assertEquals(row, relation.getRow().get(1));
assertEquals(1, relation.getColumn().size());
assertEquals(1, relation.getRow().get(1).getExpression().size());
assertTrue(relation.getRow().get(1).getExpression().get(0).getExpression() instanceof LiteralExpression);
assertEquals(relation, row.getParent());
assertEquals(relation.getRow().get(1), relation.getRow().get(1).getExpression().get(0).getExpression().getParent());
}
use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testGraphCommandUndoWithRows.
@Test
public void testGraphCommandUndoWithRows() {
final List rowList = new List();
relation.getRow().add(rowList);
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.getText().setValue(VALUE);
relation.getRow().get(0).getExpression().add(HasExpression.wrap(rowList, literalExpression));
makeCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Delete column 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).getExpression()).getText().getValue());
}
Aggregations