Search in sources :

Example 1 with HasKnowledgeBuilderMock

use of org.kie.pmml.models.drools.tree.evaluator.implementations.HasKnowledgeBuilderMock in project drools by kiegroup.

the class PMMLTreeModelEvaluatorTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    evaluator = new PMMLTreeModelEvaluator();
    final PMML pmml = TestUtils.loadFromFile(SOURCE_1);
    assertNotNull(pmml);
    assertEquals(1, pmml.getModels().size());
    assertTrue(pmml.getModels().get(0) instanceof TreeModel);
    KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
    final CommonCompilationDTO<TreeModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, (TreeModel) pmml.getModels().get(0), new HasKnowledgeBuilderMock(knowledgeBuilder));
    kiePMMLModel = provider.getKiePMMLModel(compilationDTO);
    kieBase = new KieHelper().addContent(knowledgeBuilder.getPackageDescrs(kiePMMLModel.getKModulePackageName()).get(0)).setReleaseId(RELEASE_ID).build(ExecutableModelProject.class);
    assertNotNull(kieBase);
}
Also used : KiePMMLTreeModel(org.kie.pmml.models.drools.tree.model.KiePMMLTreeModel) TreeModel(org.dmg.pmml.tree.TreeModel) HasKnowledgeBuilderMock(org.kie.pmml.models.drools.tree.evaluator.implementations.HasKnowledgeBuilderMock) KnowledgeBuilderImpl(org.drools.compiler.builder.impl.KnowledgeBuilderImpl) PMML(org.dmg.pmml.PMML) KieHelper(org.kie.internal.utils.KieHelper) ExecutableModelProject(org.drools.modelcompiler.ExecutableModelProject) BeforeClass(org.junit.BeforeClass)

Aggregations

PMML (org.dmg.pmml.PMML)1 TreeModel (org.dmg.pmml.tree.TreeModel)1 KnowledgeBuilderImpl (org.drools.compiler.builder.impl.KnowledgeBuilderImpl)1 ExecutableModelProject (org.drools.modelcompiler.ExecutableModelProject)1 BeforeClass (org.junit.BeforeClass)1 KieHelper (org.kie.internal.utils.KieHelper)1 HasKnowledgeBuilderMock (org.kie.pmml.models.drools.tree.evaluator.implementations.HasKnowledgeBuilderMock)1 KiePMMLTreeModel (org.kie.pmml.models.drools.tree.model.KiePMMLTreeModel)1