use of org.kie.pmml.models.drools.scorecard.model.KiePMMLScorecardModel in project drools by kiegroup.
the class ScorecardModelImplementationProviderTest method getKiePMMLModel.
@Test
public void getKiePMMLModel() throws Exception {
final PMML pmml = getPMML(SOURCE_1);
KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
final CommonCompilationDTO<Scorecard> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, (Scorecard) pmml.getModels().get(0), new HasKnowledgeBuilderMock(knowledgeBuilder));
final KiePMMLScorecardModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
assertNotNull(retrieved);
commonVerifyIsDeepCloneable(retrieved);
}
use of org.kie.pmml.models.drools.scorecard.model.KiePMMLScorecardModel in project drools by kiegroup.
the class KiePMMLScorecardModelFactory method getKiePMMLScorecardModel.
public static KiePMMLScorecardModel getKiePMMLScorecardModel(final DroolsCompilationDTO<Scorecard> compilationDTO) throws IllegalAccessException, InstantiationException {
logger.trace("getKiePMMLScorecardModel {} {}", compilationDTO.getPackageName(), compilationDTO.getModel());
Map<String, String> sourcesMap = getKiePMMLScorecardModelSourcesMap(compilationDTO);
try {
Class<?> kiePMMLScorecardModelClass = compilationDTO.compileAndLoadClass(sourcesMap);
return (KiePMMLScorecardModel) kiePMMLScorecardModelClass.newInstance();
} catch (Exception e) {
throw new KiePMMLException(e);
}
}
use of org.kie.pmml.models.drools.scorecard.model.KiePMMLScorecardModel in project drools by kiegroup.
the class KiePMMLScorecardModelFactoryTest method getKiePMMLScorecardModel.
@Test
public void getKiePMMLScorecardModel() throws Exception {
final DataDictionary dataDictionary = pmml.getDataDictionary();
final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap = getFieldTypeMap(dataDictionary, pmml.getTransformationDictionary(), scorecardModel.getLocalTransformations());
KnowledgeBuilderImpl knowledgeBuilder = new KnowledgeBuilderImpl();
final CommonCompilationDTO<Scorecard> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, scorecardModel, new HasKnowledgeBuilderMock(knowledgeBuilder));
final DroolsCompilationDTO<Scorecard> droolsCompilationDTO = DroolsCompilationDTO.fromCompilationDTO(compilationDTO, fieldTypeMap);
KiePMMLScorecardModel retrieved = KiePMMLScorecardModelFactory.getKiePMMLScorecardModel(droolsCompilationDTO);
assertNotNull(retrieved);
assertEquals(scorecardModel.getModelName(), retrieved.getName());
assertEquals(TARGET_FIELD, retrieved.getTargetField());
}
Aggregations