use of org.kie.dmn.model.v1_1.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;
}
use of org.kie.dmn.model.v1_1.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);
}
use of org.kie.dmn.model.v1_1.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);
}
use of org.kie.dmn.model.v1_1.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);
}
use of org.kie.dmn.model.v1_1.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);
}
Aggregations