use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testGraphCommandUndoWithRows.
@Test
public void testGraphCommandUndoWithRows() {
relation.getRow().add(new List());
final LiteralExpression literalExpression = new LiteralExpression();
literalExpression.setText(VALUE);
relation.getRow().get(0).getExpression().add(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)).getText());
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression 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.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(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.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.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.LiteralExpression in project kie-wb-common by kiegroup.
the class ExpressionContainerUIModelMapperTest method testFromDMNModelLiteralExpressionType.
@Test
@SuppressWarnings("unchecked")
public void testFromDMNModelLiteralExpressionType() {
expression = new LiteralExpression();
mapper.fromDMNModel(0, 0);
assertUiModel();
assertEditorType(literalExpressionEditor.getClass());
verify(uiExpressionColumn).setWidth(MINIMUM_COLUMN_WIDTH);
verify(literalExpressionEditorDefinition).getEditor(eq(parent), nodeUUIDCaptor.capture(), eq(hasExpression), eq(Optional.of(expression)), eq(Optional.of(hasName)), eq(0));
final Optional<String> nodeUUID = nodeUUIDCaptor.getValue();
assertThat(nodeUUID.isPresent()).isTrue();
assertThat(nodeUUID.get()).isEqualTo(NODE_UUID);
}
Aggregations