use of org.kie.workbench.common.dmn.api.definition.v1_1.Expression in project kie-wb-common by kiegroup.
the class ContextEditorDefinitionTest 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 ContextGrid);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Expression in project kie-wb-common by kiegroup.
the class DecisionTableEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<DecisionTable> expression = definition.getModelClass();
final Optional<BaseExpressionGrid> oEditor = definition.getEditor(parent, Optional.empty(), hasExpression, expression, hasName, 0);
assertThat(oEditor).isPresent();
final GridWidget editor = oEditor.get();
assertThat(editor).isInstanceOf(DecisionTableGrid.class);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Expression in project kie-wb-common by kiegroup.
the class FunctionEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<FunctionDefinition> 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 FunctionGrid);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Expression in project kie-wb-common by kiegroup.
the class InvocationEditorDefinitionTest method testEditor.
@Test
public void testEditor() {
final Optional<Invocation> 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 InvocationGrid);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Expression in project kie-wb-common by kiegroup.
the class InvocationUIModelMapperTest 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();
doReturn(uiModel).when(gridWidget).getModel();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
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());
final LiteralExpression invocationExpression = new LiteralExpression();
invocationExpression.setText("invocation-expression");
final LiteralExpression bindingExpression = new LiteralExpression();
bindingExpression.setText("binding-expression");
final Binding binding = new Binding();
final InformationItem parameter = new InformationItem();
parameter.setName(new Name("p0"));
binding.setParameter(parameter);
binding.setExpression(bindingExpression);
this.invocation = new Invocation();
this.invocation.setExpression(invocationExpression);
this.invocation.getBinding().add(binding);
this.mapper = new InvocationUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(invocation), expressionEditorDefinitionsSupplier, listSelector, 0);
this.cellValueSupplier = Optional::empty;
}
Aggregations