use of org.kie.pmml.api.runtime.PMMLContext 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());
}
use of org.kie.pmml.api.runtime.PMMLContext in project drools by kiegroup.
the class PMMLRuntimeInternalImplTest method evaluateWithPMMLContextListeners.
@Test
public void evaluateWithPMMLContextListeners() {
final PMMLRequestData requestData = getPMMLRequestData();
final List<PMMLStep> pmmlSteps = new ArrayList<>();
final PMMLContext pmmlContext = new PMMLContextImpl(requestData, Collections.singleton(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.api.runtime.PMMLContext in project drools by kiegroup.
the class PMMLScorecardModelEvaluatorTest method commonEvaluate.
private void commonEvaluate(Map<String, Object> inputData) {
final PMMLRequestData pmmlRequestData = getPMMLRequestData(modelName, inputData);
PMMLContext pmmlContext = new PMMLContextImpl(pmmlRequestData);
commonEvaluate(pmmlContext);
}
use of org.kie.pmml.api.runtime.PMMLContext in project drools by kiegroup.
the class PMMLTreeModelEvaluatorTest method commonEvaluate.
private void commonEvaluate(String modelName, Map<String, Object> inputData, String expectedScore) {
final PMMLRequestData pmmlRequestData = getPMMLRequestData(modelName, inputData);
PMMLContext pmmlContext = new PMMLContextImpl(pmmlRequestData);
commonEvaluate(pmmlContext, expectedScore);
}
use of org.kie.pmml.api.runtime.PMMLContext in project drools by kiegroup.
the class PMMLMiningModelEvaluatorTest method addStep.
@Test
public void addStep() {
PMMLStep step = mock(PMMLStep.class);
Set<PMMLListener> pmmlListenersMock = IntStream.range(0, 3).mapToObj(i -> mock(PMMLListener.class)).collect(Collectors.toSet());
PMMLContext pmmlContextMock = mock(PMMLContext.class);
when(pmmlContextMock.getPMMLListeners()).thenReturn(pmmlListenersMock);
evaluator.addStep(() -> step, pmmlContextMock);
pmmlListenersMock.forEach(pmmlListenerMock -> verify(pmmlListenerMock).stepExecuted(step));
}
Aggregations