Search in sources :

Example 1 with ScorecardCompilationDTO

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());
    }
}
Also used : ScorecardCompilationDTO(org.kie.pmml.models.scorecard.compiler.ScorecardCompilationDTO) Scorecard(org.dmg.pmml.scorecard.Scorecard) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) KiePMMLInternalException(org.kie.pmml.api.exceptions.KiePMMLInternalException) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException) Test(org.junit.Test)

Example 2 with ScorecardCompilationDTO

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());
    }
}
Also used : ScorecardCompilationDTO(org.kie.pmml.models.scorecard.compiler.ScorecardCompilationDTO) Scorecard(org.dmg.pmml.scorecard.Scorecard) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) IOException(java.io.IOException) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException) Test(org.junit.Test)

Aggregations

Scorecard (org.dmg.pmml.scorecard.Scorecard)2 Test (org.junit.Test)2 KiePMMLException (org.kie.pmml.api.exceptions.KiePMMLException)2 HasClassLoaderMock (org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock)2 ScorecardCompilationDTO (org.kie.pmml.models.scorecard.compiler.ScorecardCompilationDTO)2 IOException (java.io.IOException)1 KiePMMLInternalException (org.kie.pmml.api.exceptions.KiePMMLInternalException)1