Search in sources :

Example 26 with Name

use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.

the class AddContextEntryCommandTest method testGraphCommandUndoMultipleEntriesPresent.

@Test
public void testGraphCommandUndoMultipleEntriesPresent() {
    final ContextEntry firstEntry = new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("old one"));
                }
            });
        }
    };
    context.getContextEntry().add(0, firstEntry);
    makeCommand();
    final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
    // Add column and then undo
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
    assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce));
    assertEquals(2, context.getContextEntry().size());
    assertEquals(firstEntry, context.getContextEntry().get(0));
    assertEquals(defaultResultContextEntry, context.getContextEntry().get(1));
}
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) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 27 with Name

use of org.kie.workbench.common.dmn.api.property.dmn.Name 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 28 with Name

use of org.kie.workbench.common.dmn.api.property.dmn.Name 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 29 with Name

use of org.kie.workbench.common.dmn.api.property.dmn.Name 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)

Example 30 with Name

use of org.kie.workbench.common.dmn.api.property.dmn.Name in project kie-wb-common by kiegroup.

the class ExpressionEditorViewImplTest method testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty.

@Test
public void testSetEditorDoesUpdateReturnToDRGTextWhenHasNameIsNotEmpty() {
    final String NAME = "NAME";
    final Name name = new Name(NAME);
    final HasName hasNameMock = mock(HasName.class);
    doReturn(name).when(hasNameMock).getName();
    final Optional<HasName> hasName = Optional.of(hasNameMock);
    view.setExpression(NODE_UUID, hasExpression, hasName);
    verify(returnToDRG).setTextContent(eq(NAME));
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) Matchers.anyString(org.mockito.Matchers.anyString) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Test(org.junit.Test)

Aggregations

Name (org.kie.workbench.common.dmn.api.property.dmn.Name)32 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)20 HasName (org.kie.workbench.common.dmn.api.definition.HasName)15 Optional (java.util.Optional)8 Before (org.junit.Before)8 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)8 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)8 Test (org.junit.Test)7 ContextEntry (org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry)7 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)7 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)7 DMNGridRow (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow)7 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)6 Binding (org.kie.workbench.common.dmn.api.definition.v1_1.Binding)6 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)6 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)6 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)5 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)4 BackgroundSet (org.kie.workbench.common.dmn.api.property.background.BackgroundSet)4 RectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet)4