use of org.kie.pmml.models.scorecard.compiler.ScorecardCompilationDTO in project drools by kiegroup.
the class KiePMMLScorecardModelFactoryTest method getKiePMMLScorecardModelSourcesMap.
@Test
public void getKiePMMLScorecardModelSourcesMap() {
final CommonCompilationDTO<Scorecard> source = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, basicComplexPartialScorePmml, basicComplexPartialScore, new HasClassLoaderMock());
ScorecardCompilationDTO compilationDTO = ScorecardCompilationDTO.fromCompilationDTO(source);
final Map<String, String> retrieved = KiePMMLScorecardModelFactory.getKiePMMLScorecardModelSourcesMap(compilationDTO);
assertNotNull(retrieved);
assertEquals(2, retrieved.size());
assertTrue(retrieved.containsKey(compilationDTO.getPackageCanonicalClassName()));
assertTrue(retrieved.containsKey(compilationDTO.getPackageCanonicalCharacteristicsClassName()));
try {
KieMemoryCompiler.compile(retrieved, Thread.currentThread().getContextClassLoader());
} catch (Exception e) {
fail(e.getMessage());
}
}
use of org.kie.pmml.models.scorecard.compiler.ScorecardCompilationDTO in project drools by kiegroup.
the class KiePMMLCharacteristicsFactoryTest method getKiePMMLCharacteristicsSourcesMap.
@Test
public void getKiePMMLCharacteristicsSourcesMap() {
final CommonCompilationDTO<Scorecard> source = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, basicComplexPartialScorePmml, basicComplexPartialScore, new HasClassLoaderMock());
ScorecardCompilationDTO compilationDTO = ScorecardCompilationDTO.fromCompilationDTO(source);
final Map<String, String> retrieved = KiePMMLCharacteristicsFactory.getKiePMMLCharacteristicsSourcesMap(compilationDTO);
assertNotNull(retrieved);
assertEquals(1, retrieved.size());
String expected = compilationDTO.getPackageCanonicalCharacteristicsClassName();
assertTrue(retrieved.containsKey(expected));
try {
KieMemoryCompiler.compile(retrieved, Thread.currentThread().getContextClassLoader());
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations