Search in sources :

Example 66 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context in project kie-wb-common by kiegroup.

the class BaseContextUIModelMapperTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.uiModel = new BaseGridData();
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendRow(new DMNGridRow());
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiNameColumn);
    this.uiModel.appendColumn(uiExpressionEditorColumn);
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiNameColumn).getIndex();
    doReturn(2).when(uiExpressionEditorColumn).getIndex();
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(literalExpressionEditorDefinition);
    expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
    doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
    doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
    doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
    doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
    this.context = new Context();
    this.context.getContextEntry().add(new ContextEntry() {

        {
            setVariable(new InformationItem() {

                {
                    setName(new Name("ii1"));
                }
            });
        }
    });
    this.context.getContextEntry().add(new ContextEntry() {

        {
            setExpression(new LiteralExpression());
        }
    });
    this.mapper = getMapper();
    this.cellValueSupplier = Optional::empty;
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) ExpressionEditorDefinitions(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) DMNGridRow(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) ContextEntry(org.kie.workbench.common.dmn.api.definition.v1_1.ContextEntry) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Before(org.junit.Before)

Example 67 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context in project kie-wb-common by kiegroup.

the class ContextEditorDefinitionTest method testModelDefinition.

@Test
public void testModelDefinition() {
    final Optional<Context> oModel = definition.getModelClass();
    assertTrue(oModel.isPresent());
    final Context model = oModel.get();
    assertEquals(2, model.getContextEntry().size());
    assertNotNull(model.getContextEntry().get(0).getVariable());
    assertNull(model.getContextEntry().get(1).getVariable());
    assertTrue(model.getContextEntry().get(1).getExpression() instanceof LiteralExpression);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) Test(org.junit.Test)

Example 68 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context in project kie-wb-common by kiegroup.

the class JavaFunctionEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<Context> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertTrue(oEditor.isPresent());
    final GridWidget editor = oEditor.get();
    assertTrue(editor instanceof FunctionSupplementaryGrid);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) FunctionSupplementaryGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGrid) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) Test(org.junit.Test)

Example 69 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context in project kie-wb-common by kiegroup.

the class PMMLFunctionEditorDefinitionTest method testModelDefinition.

@Test
public void testModelDefinition() {
    final Optional<Context> oModel = definition.getModelClass();
    assertTrue(oModel.isPresent());
    final Context model = oModel.get();
    assertEquals(2, model.getContextEntry().size());
    assertEquals(PMMLFunctionEditorDefinition.VARIABLE_DOCUMENT, model.getContextEntry().get(0).getVariable().getName().getValue());
    assertTrue(model.getContextEntry().get(0).getExpression() instanceof LiteralExpression);
    assertEquals(PMMLFunctionEditorDefinition.VARIABLE_MODEL, model.getContextEntry().get(1).getVariable().getName().getValue());
    assertTrue(model.getContextEntry().get(1).getExpression() instanceof LiteralExpression);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) LiteralExpression(org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression) Test(org.junit.Test)

Example 70 with Context

use of org.eclipse.jst.server.tomcat.core.internal.xml.server32.Context in project kie-wb-common by kiegroup.

the class PMMLFunctionEditorDefinitionTest method testEditor.

@Test
public void testEditor() {
    final Optional<Context> expression = definition.getModelClass();
    final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
    assertTrue(oEditor.isPresent());
    final GridWidget editor = oEditor.get();
    assertTrue(editor instanceof FunctionSupplementaryGrid);
}
Also used : Context(org.kie.workbench.common.dmn.api.definition.v1_1.Context) FunctionSupplementaryGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.function.supplementary.FunctionSupplementaryGrid) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) Test(org.junit.Test)

Aggregations

Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)58 Context (com.microsoft.z3.Context)36 CoreException (org.eclipse.core.runtime.CoreException)34 Test (org.junit.Test)24 BoolExpr (com.microsoft.z3.BoolExpr)23 List (java.util.List)20 IOException (java.io.IOException)18 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)17 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)17 HashMap (java.util.HashMap)16 Map (java.util.Map)14 File (java.io.File)13 ArrayList (java.util.ArrayList)13 Solver (com.microsoft.z3.Solver)12 Status (com.microsoft.z3.Status)12 IPath (org.eclipse.core.runtime.IPath)11 IStatus (org.eclipse.core.runtime.IStatus)11 Status (org.eclipse.core.runtime.Status)11 Factory (org.eclipse.jst.server.tomcat.core.internal.xml.Factory)11 Z3Exception (com.microsoft.z3.Z3Exception)9