use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelFactoryUtilsTest method commonPopulateGetCreatedKiePMMLOutputFieldsMethod.
@Test
public void commonPopulateGetCreatedKiePMMLOutputFieldsMethod() throws IOException {
final CompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmmlModel, model, new HasClassLoaderMock());
final MethodDeclaration methodDeclaration = new MethodDeclaration();
KiePMMLModelFactoryUtils.commonPopulateGetCreatedKiePMMLOutputFieldsMethod(methodDeclaration, compilationDTO.getOutput().getOutputFields());
String text = getFileContent(TEST_05_SOURCE);
MethodDeclaration expected = JavaParserUtils.parseMethod(text);
assertTrue(JavaParserUtils.equalsNode(expected, methodDeclaration));
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromDataDictionaryAndModelWithSourcesWithoutProvider.
@Test
public void getFromDataDictionaryAndModelWithSourcesWithoutProvider() throws Exception {
pmml = KiePMMLUtil.load(getFileInputStream(ONE_MINING_TARGET_SOURCE), ONE_MINING_TARGET_SOURCE);
final CommonCompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, pmml.getModels().get(0), new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModelWithSources(compilationDTO);
assertNotNull(retrieved);
assertFalse(retrieved.isPresent());
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithoutProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithoutProvider() throws Exception {
pmml = KiePMMLUtil.load(getFileInputStream(ONE_MINING_TARGET_SOURCE), ONE_MINING_TARGET_SOURCE);
final CommonCompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, pmml.getModels().get(0), new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModel(compilationDTO);
assertNotNull(retrieved);
assertFalse(retrieved.isPresent());
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithSourcesCompiledWithProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithSourcesCompiledWithProvider() throws Exception {
pmml = getPMMLWithMiningRandomTestModel();
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);
assertTrue(retrieved.isPresent());
}
use of org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock in project drools by kiegroup.
the class KiePMMLModelRetrieverTest method getFromCommonDataAndTransformationDictionaryAndModelWithSourcesWithProvider.
@Test
public void getFromCommonDataAndTransformationDictionaryAndModelWithSourcesWithProvider() {
pmml = getPMMLWithRandomTestModel();
final CommonCompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, pmml.getModels().get(0), new HasClassLoaderMock());
final Optional<KiePMMLModel> retrieved = getFromCommonDataAndTransformationDictionaryAndModelWithSources(compilationDTO);
assertNotNull(retrieved);
}
Aggregations