use of org.dmg.pmml.clustering.ClusteringModel in project drools by kiegroup.
the class ClusteringModelImplementationProviderTest method getKiePMMLModelWithSources.
@Test
public void getKiePMMLModelWithSources() throws Exception {
PMML pmml = TestUtils.loadFromFile(SOURCE_FILE);
ClusteringModel model = getModel(pmml);
final CommonCompilationDTO<ClusteringModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
KiePMMLModelWithSources retrieved = PROVIDER.getKiePMMLModelWithSources(compilationDTO);
assertNotNull(retrieved);
Map<String, String> sourcesMap = retrieved.getSourcesMap();
assertNotNull(sourcesMap);
assertFalse(sourcesMap.isEmpty());
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Map<String, Class<?>> compiled = KieMemoryCompiler.compile(sourcesMap, classLoader);
for (Class<?> clazz : compiled.values()) {
assertTrue(clazz instanceof Serializable);
}
}
Aggregations