use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithProvider() throws Exception {
pmml = KiePMMLUtil.load(getFileInputStream(MULTIPLE_TARGETS_SOURCE), MULTIPLE_TARGETS_SOURCE);
TestModel model = new TestModel();
pmml.getModels().set(0, model);
final CommonCompilationDTO<TestModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModel(compilationDTO);
assertNotNull(retrieved);
assertTrue(retrieved.isPresent());
assertTrue(retrieved.get() instanceof KiePMMLTestingModel);
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithSourcesCompiledWithoutProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithSourcesCompiledWithoutProvider() throws Exception {
pmml = KiePMMLUtil.load(getFileInputStream(MINING_MODEL_WITH_NESTED_REFERS_SOURCE), MINING_MODEL_WITH_NESTED_REFERS_SOURCE);
MiningModel parentModel = (MiningModel) pmml.getModels().get(0);
Model model = parentModel.getSegmentation().getSegments().get(0).getModel();
final CommonCompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModelWithSourcesCompiled(compilationDTO);
assertNotNull(retrieved);
assertFalse(retrieved.isPresent());
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class ClusteringModelImplementationProviderTest method getKiePMMLModel.
@Test
public void getKiePMMLModel() throws Exception {
PMML pmml = TestUtils.loadFromFile(SOURCE_FILE);
ClusteringModel model = getModel(pmml);
final CommonCompilationDTO<ClusteringModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
KiePMMLClusteringModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
assertNotNull(retrieved);
assertTrue(retrieved instanceof Serializable);
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class DroolsModelProviderTest method getKiePMMLModelWithSourcesNoKnowledgeBuilder.
@Test(expected = KiePMMLException.class)
public void getKiePMMLModelWithSourcesNoKnowledgeBuilder() {
final CommonCompilationDTO<Scorecard> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, scorecard, new HasClassLoaderMock());
droolsModelProvider.getKiePMMLModelWithSources(compilationDTO);
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLNodeFactoryTest method getKiePMMLNode.
@Test
public void getKiePMMLNode() {
final KiePMMLNode retrieved = KiePMMLNodeFactory.getKiePMMLNode(node1, getFieldsFromDataDictionaryAndDerivedFields(dataDictionary1, derivedFields1), PACKAGE_NAME, 1.0, new HasClassLoaderMock());
assertNotNull(retrieved);
commonVerifyNode(retrieved, node1);
}
Aggregations