use of org.kie.pmml.api.runtime.PMMLListener in project drools by kiegroup.
the class PMMLRuntimeInternalImplTest method addPMMLListener.
@Test
public void addPMMLListener() {
try {
pmmlRuntime.evaluate(MODEL_NAME, pmmlContextMock);
verify(pmmlContextMock, never()).addPMMLListener(any());
} catch (KiePMMLException e) {
commonManageException(e);
}
try {
reset(pmmlContextMock);
PMMLListener listener = getPMMLListener(new ArrayList<>());
pmmlRuntime.addPMMLListener(listener);
pmmlRuntime.evaluate(MODEL_NAME, pmmlContextMock);
verify(pmmlContextMock).addPMMLListener(listener);
} catch (KiePMMLException e) {
commonManageException(e);
}
}
use of org.kie.pmml.api.runtime.PMMLListener in project drools by kiegroup.
the class PMMLRuntimeInternalImplTest method removePMMLListener.
@Test
public void removePMMLListener() {
try {
PMMLListener listener = getPMMLListener(new ArrayList<>());
pmmlRuntime.addPMMLListener(listener);
pmmlRuntime.removePMMLListener(listener);
pmmlRuntime.evaluate("MODEL_NAME", pmmlContextMock);
verify(pmmlContextMock, never()).addPMMLListener(listener);
} catch (KiePMMLException e) {
commonManageException(e);
}
}
use of org.kie.pmml.api.runtime.PMMLListener 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