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);
}
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);
}
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);
}
}
Aggregations