use of org.kie.pmml.evaluator.core.PMMLContextImpl in project drools by kiegroup.
the class PMMLListenerUtilsTest method getPMMLContext.
private PMMLContext getPMMLContext(int size, Map<Integer, PMMLStep> listenerFeedback) {
PMMLContext toReturn = new PMMLContextImpl(new PMMLRequestData());
IntStream.range(0, size).forEach(i -> toReturn.addPMMLListener(getPMMLListener(i, listenerFeedback)));
return toReturn;
}
use of org.kie.pmml.evaluator.core.PMMLContextImpl in project drools by kiegroup.
the class PMMLRuntimeInternalImplTest method evaluateWithPmmlRuntimeListeners.
@Test
public void evaluateWithPmmlRuntimeListeners() {
final PMMLRequestData requestData = getPMMLRequestData();
final List<PMMLStep> pmmlSteps = new ArrayList<>();
final PMMLContext pmmlContext = new PMMLContextImpl(requestData);
pmmlRuntime.addPMMLListener(getPMMLListener(pmmlSteps));
pmmlRuntime.evaluate(modelMock, pmmlContext);
Arrays.stream(PMML_STEP.values()).forEach(pmml_step -> {
Optional<PMMLStep> retrieved = pmmlSteps.stream().filter(pmmlStep -> pmml_step.equals(((PMMLRuntimeStep) pmmlStep).getPmmlStep())).findFirst();
assertTrue(retrieved.isPresent());
commonValuateStep(retrieved.get(), pmml_step, modelMock, requestData);
});
}
use of org.kie.pmml.evaluator.core.PMMLContextImpl in project drools by kiegroup.
the class DMNKiePMMLTrustyInvocationEvaluator method getPMMLPMMLContext.
private PMMLContext getPMMLPMMLContext(String correlationId, String modelName, DMNResult dmnr) {
PMMLRequestDataBuilder pmmlRequestDataBuilder = new PMMLRequestDataBuilder(correlationId, modelName);
for (FormalParameter p : parameters) {
Object pValue = getValueForPMMLInput(dmnr, p.name);
Class class1 = pValue.getClass();
pmmlRequestDataBuilder.addParameter(p.name, pValue, class1);
}
return new PMMLContextImpl(pmmlRequestDataBuilder.build());
}
use of org.kie.pmml.evaluator.core.PMMLContextImpl in project drools by kiegroup.
the class PMMLCommandExecutorImpl method evaluate.
private PMML4Result evaluate(final PMMLRequestData pmmlRequestData, final PMMLRuntime pmmlRuntime) {
String modelName = pmmlRequestData.getModelName();
final PMMLContext pmmlContext = new PMMLContextImpl(pmmlRequestData);
return pmmlRuntime.evaluate(modelName, pmmlContext);
}
use of org.kie.pmml.evaluator.core.PMMLContextImpl in project drools by kiegroup.
the class PMMLListenerUtilsTest method stepNotExecuted.
@Test
public void stepNotExecuted() {
PMMLContext pmmlContext = new PMMLContextImpl(new PMMLRequestData());
AtomicBoolean invoked = new AtomicBoolean(false);
PMMLListenerUtils.stepExecuted(() -> new PMMLStepTest(invoked), pmmlContext);
assertFalse(invoked.get());
}
Aggregations