Search in sources :

Example 61 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class RemoveParameterCommandTest method testGraphCommandUndoWithParameters.

@Test
public void testGraphCommandUndoWithParameters() {
    final InformationItem otherParameter = new InformationItem();
    function.getFormalParameter().add(otherParameter);
    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(parameter, otherParameter);
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) Test(org.junit.Test)

Example 62 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.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);
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 63 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.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);
}
Also used : GraphCommandExecutionContext(org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) Test(org.junit.Test)

Example 64 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem in project kie-wb-common by kiegroup.

the class AddParameterBindingCommandTest method makeCommand.

private void makeCommand(final int uiRowIndex, final String bindingName, final DMNGridRow uiGridRow) {
    final Binding rowEntry = new Binding();
    final InformationItem parameter = new InformationItem();
    parameter.setName(new Name(bindingName));
    rowEntry.setParameter(parameter);
    makeCommand(uiRowIndex, rowEntry, uiGridRow);
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.v1_1.Binding) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 65 with InformationItem

use of org.kie.workbench.common.dmn.api.definition.v1_1.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;
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.v1_1.Binding) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)66 Test (org.junit.Test)33 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)20 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)20 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)19 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)18 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)12 Before (org.junit.Before)11 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)11 List (org.kie.workbench.common.dmn.api.definition.v1_1.List)10 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)8 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)7 Optional (java.util.Optional)6 InformationItem (org.kie.dmn.model.v1_1.InformationItem)6 HasName (org.kie.workbench.common.dmn.api.definition.HasName)6 Relation (org.kie.workbench.common.dmn.api.definition.v1_1.Relation)6 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)6 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)6 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)5 Expression (org.kie.workbench.common.dmn.api.definition.v1_1.Expression)5