use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testGraphCommandExecuteWithParameters.
@Test
public void testGraphCommandExecuteWithParameters() {
final InformationItem otherParameter = new InformationItem();
function.getFormalParameter().add(otherParameter);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertFormalParameters(otherParameter);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class RemoveParameterCommandTest method testRemoveFromMiddleThenUndo.
@Test
public void testRemoveFromMiddleThenUndo() {
final InformationItem firstParameter = new InformationItem();
firstParameter.setName(new Name("first"));
function.getFormalParameter().add(0, firstParameter);
final InformationItem lastParameter = new InformationItem();
lastParameter.setName(new Name("last"));
function.getFormalParameter().add(lastParameter);
// call to get proper old index of parameter
this.command = new RemoveParameterCommand(function, parameter, canvasOperation);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add parameter and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertFormalParameters(firstParameter, lastParameter);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertFormalParameters(firstParameter, parameter, lastParameter);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class SetParametersCommandTest method testGraphCommandUndoWithParameters.
@Test
public void testGraphCommandUndoWithParameters() {
final InformationItem otherParameter = new InformationItem();
function.getFormalParameter().add(otherParameter);
setupCommand();
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
// Add parameter and then undo
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
assertFormalParameters(otherParameter);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class DeleteParameterBindingCommandTest method makeBinding.
private Binding makeBinding(final String bindingName) {
final Binding newBinding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name(bindingName));
newBinding.setParameter(parameter);
return newBinding;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItem in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testGraphCommandExecuteWithExistingColumn_InsertMiddle.
@Test
public void testGraphCommandExecuteWithExistingColumn_InsertMiddle() {
makeCommand(2);
final InformationItem existingInformationItemFirst = new InformationItem();
relation.getColumn().add(existingInformationItemFirst);
final InformationItem existingInformationItemLast = new InformationItem();
relation.getColumn().add(existingInformationItemLast);
final List row = new List();
relation.getRow().add(row);
final LiteralExpression existingLiteralExpressionFirst = new LiteralExpression();
final LiteralExpression existingLiteralExpressionLast = new LiteralExpression();
row.getExpression().add(HasExpression.wrap(row, existingLiteralExpressionFirst));
row.getExpression().add(HasExpression.wrap(row, existingLiteralExpressionLast));
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(3, relation.getColumn().size());
assertEquals(existingInformationItemFirst, relation.getColumn().get(0));
assertEquals(informationItem, relation.getColumn().get(1));
assertEquals(RelationDefaultValueUtilities.PREFIX + "1", informationItem.getName().getValue());
assertEquals(existingInformationItemLast, relation.getColumn().get(2));
assertEquals(1, relation.getRow().size());
assertEquals(3, relation.getRow().get(0).getExpression().size());
assertEquals(existingLiteralExpressionFirst, relation.getRow().get(0).getExpression().get(0).getExpression());
assertTrue(relation.getRow().get(0).getExpression().get(1).getExpression() instanceof LiteralExpression);
assertEquals(existingLiteralExpressionLast, relation.getRow().get(0).getExpression().get(2).getExpression());
assertEquals(relation, informationItem.getParent());
assertEquals(relation.getRow().get(0), relation.getRow().get(0).getExpression().get(1).getExpression().getParent());
}
Aggregations