Search in sources :

Example 1 with PMMLRuntimeInternal

use of org.kie.pmml.evaluator.api.executor.PMMLRuntimeInternal in project drools by kiegroup.

the class PMMLMiningModelEvaluatorTest method getPMMLRuntime.

@Test
public void getPMMLRuntime() {
    final KieServices kieServices = KieServices.Factory.get();
    final KieContainer kieContainer = kieServices.newKieClasspathContainer();
    final KieBase kieBase = kieContainer.getKieBase();
    String kModulePackageName = "kModulePackageNameA";
    String containerModelName = "containerModelNameA";
    PMMLRuntime firstRetrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName);
    assertNotNull(firstRetrieved);
    assertTrue(firstRetrieved instanceof PMMLRuntimeInternal);
    PMMLRuntimeInternal firstPMMLRuntimeInternal = (PMMLRuntimeInternal) firstRetrieved;
    PMMLRuntime secondRetrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName);
    assertTrue(secondRetrieved instanceof PMMLRuntimeInternal);
    PMMLRuntimeInternal secondPMMLRuntimeInternal = (PMMLRuntimeInternal) secondRetrieved;
    assertEquals(firstPMMLRuntimeInternal.getKnowledgeBase(), secondPMMLRuntimeInternal.getKnowledgeBase());
    kModulePackageName = "kModulePackageNameB";
    containerModelName = "containerModelNameB";
    PMMLRuntime thirdRetrieved = evaluator.getPMMLRuntime(kModulePackageName, kieBase, containerModelName);
    assertNotNull(thirdRetrieved);
    assertTrue(thirdRetrieved instanceof PMMLRuntimeInternal);
    PMMLRuntimeInternal thirdPMMLRuntimeInternal = (PMMLRuntimeInternal) thirdRetrieved;
    assertNotEquals(firstPMMLRuntimeInternal.getKnowledgeBase(), thirdPMMLRuntimeInternal.getKnowledgeBase());
}
Also used : KieBase(org.kie.api.KieBase) KieServices(org.kie.api.KieServices) PMMLRuntime(org.kie.pmml.api.runtime.PMMLRuntime) PMMLRuntimeInternal(org.kie.pmml.evaluator.api.executor.PMMLRuntimeInternal) KieContainer(org.kie.api.runtime.KieContainer) PMMLContextTest(org.kie.pmml.commons.testingutility.PMMLContextTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 KieBase (org.kie.api.KieBase)1 KieServices (org.kie.api.KieServices)1 KieContainer (org.kie.api.runtime.KieContainer)1 PMMLRuntime (org.kie.pmml.api.runtime.PMMLRuntime)1 PMMLContextTest (org.kie.pmml.commons.testingutility.PMMLContextTest)1 PMMLRuntimeInternal (org.kie.pmml.evaluator.api.executor.PMMLRuntimeInternal)1