use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocument in project kie-wb-common by kiegroup.
the class PMMLIncludedModelHandlerTest method makeTopLevelPMMLFunctionDefinition.
private FunctionDefinition makeTopLevelPMMLFunctionDefinition(final String documentName, final String modelName) {
final FunctionDefinition function = new FunctionDefinition();
function.setKind(FunctionDefinition.Kind.PMML);
final Context functionExpression = new Context();
function.setExpression(functionExpression);
final ContextEntry functionContextEntry1 = new ContextEntry();
final InformationItem functionContextEntry1Variable = new InformationItem();
final LiteralExpressionPMMLDocument functionContextEntry1Value = new LiteralExpressionPMMLDocument();
functionContextEntry1Variable.getName().setValue(LiteralExpressionPMMLDocument.VARIABLE_DOCUMENT);
functionContextEntry1.setVariable(functionContextEntry1Variable);
functionContextEntry1Value.getText().setValue("\"" + documentName + "\"");
functionContextEntry1.setExpression(functionContextEntry1Value);
final ContextEntry functionContextEntry2 = new ContextEntry();
final InformationItem functionContextEntry2Variable = new InformationItem();
final LiteralExpressionPMMLDocumentModel functionContextEntry2Value = new LiteralExpressionPMMLDocumentModel();
functionContextEntry2Variable.getName().setValue(LiteralExpressionPMMLDocumentModel.VARIABLE_MODEL);
functionContextEntry2.setVariable(functionContextEntry2Variable);
functionContextEntry2Value.getText().setValue("\"" + modelName + "\"");
functionContextEntry2.setExpression(functionContextEntry2Value);
functionExpression.getContextEntry().add(functionContextEntry1);
functionExpression.getContextEntry().add(functionContextEntry2);
return function;
}
use of org.kie.workbench.common.dmn.api.definition.model.LiteralExpressionPMMLDocument in project kie-wb-common by kiegroup.
the class UndefinedExpressionSelectorPopoverImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(literalExpressionPMMLEditorDefinition);
when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
when(literalExpressionEditorDefinition.isUserSelectable()).thenReturn(true);
when(literalExpressionEditorDefinition.getType()).thenReturn(ExpressionType.LITERAL_EXPRESSION);
when(literalExpressionEditorDefinition.getName()).thenReturn(LiteralExpression.class.getSimpleName());
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionPMMLEditorDefinition.isUserSelectable()).thenReturn(false);
when(literalExpressionPMMLEditorDefinition.getType()).thenReturn(ExpressionType.LITERAL_EXPRESSION);
when(literalExpressionPMMLEditorDefinition.getName()).thenReturn(LiteralExpressionPMMLDocument.class.getSimpleName());
when(literalExpressionPMMLEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpressionPMMLDocument));
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(translationService.getTranslation(Mockito.<String>any())).thenAnswer(i -> i.getArguments()[0]);
this.popover = new UndefinedExpressionSelectorPopoverImpl(view, translationService, expressionEditorDefinitionsSupplier);
}
Aggregations