Search in sources :

Example 16 with InformationItem

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

the class InvocationDefaultValueUtilitiesTest method testGetNewParameterNameWithDeletion.

@Test
public void testGetNewParameterNameWithDeletion() {
    final Binding binding1 = new Binding() {

        {
            setParameter(new InformationItem());
        }
    };
    invocation.getBinding().add(binding1);
    binding1.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
    assertThat(binding1.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "1");
    final Binding binding2 = new Binding() {

        {
            setParameter(new InformationItem());
        }
    };
    invocation.getBinding().add(binding2);
    binding2.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
    assertThat(binding2.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "2");
    invocation.getBinding().remove(binding1);
    final Binding binding3 = new Binding() {

        {
            setParameter(new InformationItem());
        }
    };
    invocation.getBinding().add(binding3);
    binding3.getParameter().getName().setValue(InvocationDefaultValueUtilities.getNewParameterName(invocation));
    assertThat(binding3.getParameter().getName().getValue()).isEqualTo(InvocationDefaultValueUtilities.PREFIX + "3");
}
Also used : Binding(org.kie.workbench.common.dmn.api.definition.model.Binding) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Test(org.junit.Test)

Example 17 with InformationItem

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

the class PMMLIncludedModelHandlerTest method makeNestedPMMLFunctionDefinition.

private Context makeNestedPMMLFunctionDefinition(final String documentName, final String modelName) {
    final Context context = new Context();
    final ContextEntry contextEntry = new ContextEntry();
    final InformationItem variable = new InformationItem();
    variable.getName().setValue("variable");
    contextEntry.setVariable(variable);
    contextEntry.setExpression(makeTopLevelPMMLFunctionDefinition(documentName, modelName));
    context.getContextEntry().add(contextEntry);
    return context;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.model.Context) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) ContextEntry(org.kie.workbench.common.dmn.api.definition.model.ContextEntry)

Example 18 with InformationItem

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

the class RelationGridTest method testOnItemSelectedDeleteColumn.

@Test
public void testOnItemSelectedDeleteColumn() {
    relation.getColumn().add(new InformationItem());
    setupGrid(0);
    // Cannot delete column 0 since it is the RowNumber column. The first Relation column is 1.
    final java.util.List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
    final HasListSelectorControl.ListSelectorTextItem ti = (HasListSelectorControl.ListSelectorTextItem) items.get(DELETE_COLUMN);
    grid.onItemSelected(ti);
    verify(cellEditorControls).hide();
    verify(grid).deleteColumn(eq(1));
}
Also used : HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Test(org.junit.Test)

Example 19 with InformationItem

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

the class RelationGridTest method testOnHeaderItemSelectedDeleteColumn.

@Test
public void testOnHeaderItemSelectedDeleteColumn() {
    relation.getColumn().add(new InformationItem());
    setupGrid(0);
    // Cannot delete column 0 since it is the RowNumber column. The first Relation column is 1.
    final java.util.List<HasListSelectorControl.ListSelectorItem> items = grid.getHeaderItems(0, RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
    final HasListSelectorControl.ListSelectorTextItem ti = (HasListSelectorControl.ListSelectorTextItem) items.get(DELETE_COLUMN);
    grid.onItemSelected(ti);
    verify(cellEditorControls).hide();
    verify(grid).deleteColumn(eq(1));
}
Also used : HasListSelectorControl(org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Test(org.junit.Test)

Example 20 with InformationItem

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

the class RelationGridTest method testDeleteColumn.

@Test
public void testDeleteColumn() {
    relation.getColumn().add(new InformationItem());
    setupGrid(0);
    // Cannot delete column 0 since it is the RowNumber column. The first Relation column is 1.
    grid.deleteColumn(RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
    verify(sessionCommandManager).execute(eq(canvasHandler), deleteColumnCommand.capture());
    deleteColumnCommand.getValue().execute(canvasHandler);
    verifyCommandExecuteOperation(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM);
    // Check undo operation
    reset(gridPanel, gridLayer, grid, parentGridColumn);
    verify(sessionCommandManager).execute(eq(canvasHandler), deleteColumnCommand.capture());
    deleteColumnCommand.getValue().undo(canvasHandler);
    verifyCommandUndoOperation(BaseExpressionGrid.RESIZE_EXISTING);
}
Also used : InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) Test(org.junit.Test)

Aggregations

InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)110 Test (org.junit.Test)61 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)24 ContextEntry (org.kie.workbench.common.dmn.api.definition.model.ContextEntry)22 GraphCommandExecutionContext (org.kie.workbench.common.stunner.core.graph.command.GraphCommandExecutionContext)22 RuleViolation (org.kie.workbench.common.stunner.core.rule.RuleViolation)20 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)19 Binding (org.kie.workbench.common.dmn.api.definition.model.Binding)13 Context (org.kie.workbench.common.dmn.api.definition.model.Context)11 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)11 Before (org.junit.Before)10 List (org.kie.workbench.common.dmn.api.definition.model.List)10 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)10 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)9 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)9 CanvasViolation (org.kie.workbench.common.stunner.core.client.command.CanvasViolation)9 HasName (org.kie.workbench.common.dmn.api.definition.HasName)7 Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)7 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)7