Search in sources :

Example 1 with KiePMMLTreeModel

use of org.kie.pmml.models.tree.model.KiePMMLTreeModel in project drools by kiegroup.

the class TreeModelImplementationProviderTest method getKiePMMLModel.

@Test
public void getKiePMMLModel() {
    TreeModel treeModel = (TreeModel) pmml.getModels().get(0);
    final CommonCompilationDTO<TreeModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, treeModel, new HasClassLoaderMock());
    final KiePMMLTreeModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
    assertNotNull(retrieved);
    assertTrue(retrieved instanceof Serializable);
}
Also used : TreeModel(org.dmg.pmml.tree.TreeModel) KiePMMLTreeModel(org.kie.pmml.models.tree.model.KiePMMLTreeModel) Serializable(java.io.Serializable) KiePMMLTreeModel(org.kie.pmml.models.tree.model.KiePMMLTreeModel) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) Test(org.junit.Test)

Example 2 with KiePMMLTreeModel

use of org.kie.pmml.models.tree.model.KiePMMLTreeModel in project drools by kiegroup.

the class KiePMMLTreeModelFactoryTest method getKiePMMLTreeModel.

@Test
public void getKiePMMLTreeModel() {
    CommonCompilationDTO<TreeModel> source = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml1, treeModel1, new HasClassLoaderMock());
    KiePMMLTreeModel retrieved = KiePMMLTreeModelFactory.getKiePMMLTreeModel(TreeCompilationDTO.fromCompilationDTO(source));
    assertNotNull(retrieved);
    source = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml2, treeModel2, new HasClassLoaderMock());
    retrieved = KiePMMLTreeModelFactory.getKiePMMLTreeModel(TreeCompilationDTO.fromCompilationDTO(source));
    assertNotNull(retrieved);
}
Also used : KiePMMLTreeModel(org.kie.pmml.models.tree.model.KiePMMLTreeModel) TreeModel(org.dmg.pmml.tree.TreeModel) KiePMMLTreeModel(org.kie.pmml.models.tree.model.KiePMMLTreeModel) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) Test(org.junit.Test)

Example 3 with KiePMMLTreeModel

use of org.kie.pmml.models.tree.model.KiePMMLTreeModel in project drools by kiegroup.

the class KiePMMLTreeModelFactory method getKiePMMLTreeModel.

public static KiePMMLTreeModel getKiePMMLTreeModel(final TreeCompilationDTO compilationDTO) {
    logger.trace("getKiePMMLTreeModel {} {}", compilationDTO.getPackageName(), compilationDTO.getModel());
    Map<String, String> sourcesMap = getKiePMMLTreeModelSourcesMap(compilationDTO);
    try {
        Class<?> kiePMMLTreeModelClass = compilationDTO.compileAndLoadClass(sourcesMap);
        return (KiePMMLTreeModel) kiePMMLTreeModelClass.newInstance();
    } catch (Exception e) {
        throw new KiePMMLException(e);
    }
}
Also used : KiePMMLTreeModel(org.kie.pmml.models.tree.model.KiePMMLTreeModel) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException) KiePMMLInternalException(org.kie.pmml.api.exceptions.KiePMMLInternalException) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException)

Aggregations

KiePMMLTreeModel (org.kie.pmml.models.tree.model.KiePMMLTreeModel)3 TreeModel (org.dmg.pmml.tree.TreeModel)2 Test (org.junit.Test)2 HasClassLoaderMock (org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock)2 Serializable (java.io.Serializable)1 KiePMMLException (org.kie.pmml.api.exceptions.KiePMMLException)1 KiePMMLInternalException (org.kie.pmml.api.exceptions.KiePMMLInternalException)1