Search in sources :

Example 1 with ScoreCardConfiguration

use of org.kie.internal.builder.ScoreCardConfiguration in project drools by kiegroup.

the class ScorecardProviderTest method testDrlGenerationWithExternalTypes.

@Test
public void testDrlGenerationWithExternalTypes() throws Exception {
    InputStream is = ScorecardProviderTest.class.getResourceAsStream("/scoremodel_externalmodel.xls");
    assertNotNull(is);
    ScoreCardConfiguration scconf = KnowledgeBuilderFactory.newScoreCardConfiguration();
    scconf.setWorksheetName("scorecards");
    scconf.setUsingExternalTypes(true);
    String drl = scoreCardProvider.loadFromInputStream(is, scconf);
    assertNotNull(drl);
    assertTrue(drl.length() > 0);
    assertTrue(drl.contains("org.drools.scorecards.example.Applicant"));
}
Also used : ScoreCardConfiguration(org.kie.internal.builder.ScoreCardConfiguration) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 2 with ScoreCardConfiguration

use of org.kie.internal.builder.ScoreCardConfiguration in project drools by kiegroup.

the class ScorecardProviderTest method testDrlWithSheetName.

@Test
public void testDrlWithSheetName() throws Exception {
    InputStream is = ScorecardProviderTest.class.getResourceAsStream("/scoremodel_c.xls");
    assertNotNull(is);
    ScoreCardConfiguration scconf = KnowledgeBuilderFactory.newScoreCardConfiguration();
    scconf.setWorksheetName("scorecards");
    drl = scoreCardProvider.loadFromInputStream(is, scconf);
    assertNotNull(drl);
    assertTrue(drl.length() > 0);
}
Also used : ScoreCardConfiguration(org.kie.internal.builder.ScoreCardConfiguration) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 3 with ScoreCardConfiguration

use of org.kie.internal.builder.ScoreCardConfiguration in project drools by kiegroup.

the class ScorecardProviderTest method testDrlWithoutSheetName.

@Test
public void testDrlWithoutSheetName() throws Exception {
    InputStream is = ScorecardProviderTest.class.getResourceAsStream("/scoremodel_c.xls");
    assertNotNull(is);
    ScoreCardConfiguration scconf = KnowledgeBuilderFactory.newScoreCardConfiguration();
    drl = scoreCardProvider.loadFromInputStream(is, scconf);
    assertNotNull(drl);
    assertTrue(drl.length() > 0);
// System.out.println(drl);
}
Also used : ScoreCardConfiguration(org.kie.internal.builder.ScoreCardConfiguration) InputStream(java.io.InputStream) Test(org.junit.Test)

Example 4 with ScoreCardConfiguration

use of org.kie.internal.builder.ScoreCardConfiguration in project drools by kiegroup.

the class KnowledgeBuilderImpl method scoreCardToPackageDescr.

PackageDescr scoreCardToPackageDescr(Resource resource, ResourceConfiguration configuration) throws DroolsParserException, IOException {
    ScoreCardConfiguration scardConfiguration = configuration instanceof ScoreCardConfiguration ? (ScoreCardConfiguration) configuration : null;
    String string = ScoreCardFactory.loadFromInputStream(resource.getInputStream(), scardConfiguration);
    return generatedDrlToPackageDescr(resource, string);
}
Also used : ScoreCardConfiguration(org.kie.internal.builder.ScoreCardConfiguration)

Example 5 with ScoreCardConfiguration

use of org.kie.internal.builder.ScoreCardConfiguration in project drools by kiegroup.

the class ScorecardProviderPMMLTest method testDrlGeneration.

@Test
public void testDrlGeneration() throws Exception {
    InputStream is = ScorecardProviderPMMLTest.class.getResourceAsStream("/SimpleScorecard.pmml");
    assertNotNull(is);
    ScoreCardConfiguration scconf = KnowledgeBuilderFactory.newScoreCardConfiguration();
    scconf.setInputType(SCORECARD_INPUT_TYPE.PMML);
    drl = scoreCardProvider.loadFromInputStream(is, scconf);
    assertNotNull(drl);
    assertTrue(drl.length() > 0);
}
Also used : ScoreCardConfiguration(org.kie.internal.builder.ScoreCardConfiguration) InputStream(java.io.InputStream) Test(org.junit.Test)

Aggregations

ScoreCardConfiguration (org.kie.internal.builder.ScoreCardConfiguration)6 Test (org.junit.Test)5 InputStream (java.io.InputStream)4 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)1 FactType (org.kie.api.definition.type.FactType)1 KieSession (org.kie.api.runtime.KieSession)1 KnowledgeBuilder (org.kie.internal.builder.KnowledgeBuilder)1