Search in sources :

Example 11 with ScoreCardModel

use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.

the class GuidedScoreCardDRLPersistenceTest method testEmptyModelEmptyStringPackageName.

@Test
public void testEmptyModelEmptyStringPackageName() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    model.setPackageName("");
    final String drl = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl);
    assertFalse(drl.contains("package"));
    assertEquals(12, StringUtil.countMatches(drl, "rule \""));
    assertEquals(2, StringUtil.countMatches(drl, "import "));
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Test(org.junit.Test)

Example 12 with ScoreCardModel

use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.

the class GuidedScoreCardDRLPersistenceTest method testBasicModel.

@Test
public void testBasicModel() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    model.setPackageName("org.drools.workbench.models.guided.scorecard.backend");
    model.getImports().addImport(new Import("org.drools.workbench.models.guided.scorecard.backend.test1.Applicant"));
    model.setReasonCodesAlgorithm("none");
    model.setBaselineScore(0.0);
    model.setInitialScore(0.0);
    model.setFactName("org.drools.workbench.models.guided.scorecard.backend.test1.Applicant");
    model.setFieldName("score");
    model.setUseReasonCodes(false);
    model.setReasonCodeField("");
    final Characteristic c = new Characteristic();
    c.setName("c1");
    c.setFact("org.drools.workbench.models.guided.scorecard.backend.test1.Applicant");
    c.setDataType("Double");
    c.setField("age");
    c.setBaselineScore(0.0);
    c.setReasonCode("");
    final Attribute a = new Attribute();
    a.setOperator("=");
    a.setValue("10");
    a.setPartialScore(0.1);
    a.setReasonCode("");
    c.getAttributes().add(a);
    model.getCharacteristics().add(c);
    final String drl1 = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl1);
    final String drl2 = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl2);
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Attribute(org.drools.workbench.models.guided.scorecard.shared.Attribute) Characteristic(org.drools.workbench.models.guided.scorecard.shared.Characteristic) Test(org.junit.Test)

Example 13 with ScoreCardModel

use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.

the class GuidedScoreCardDRLPersistenceTest method testModelWithImportsAndFactName.

@Test
public void testModelWithImportsAndFactName() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    model.setPackageName("org.drools.workbench.models.guided.scorecard.backend");
    model.getImports().addImport(new Import("org.smurf.Pupa"));
    model.setFactName("org.drools.MoreCheese");
    final String drl = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl);
    assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend"));
    assertEquals(12, StringUtil.countMatches(drl, "rule \""));
    assertEquals(3, StringUtil.countMatches(drl, "import "));
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Test(org.junit.Test)

Example 14 with ScoreCardModel

use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.

the class GuidedScoreCardDRLPersistenceTest method testEmptyModelInPackage.

@Test
public void testEmptyModelInPackage() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    model.setPackageName("org.drools.workbench.models.guided.scorecard.backend");
    final String drl = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl);
    assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend"));
    assertEquals(12, StringUtil.countMatches(drl, "rule \""));
    assertEquals(2, StringUtil.countMatches(drl, "import "));
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Test(org.junit.Test)

Example 15 with ScoreCardModel

use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.

the class GuidedScoreCardDRLPersistenceTest method testModelWithImports.

@Test
public void testModelWithImports() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    model.setPackageName("org.drools.workbench.models.guided.scorecard.backend");
    model.getImports().addImport(new Import("org.smurf.Pupa"));
    final String drl = GuidedScoreCardDRLPersistence.marshal(model);
    assertNotNull(drl);
    assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend"));
    assertEquals(12, StringUtil.countMatches(drl, "rule \""));
    assertEquals(3, StringUtil.countMatches(drl, "import "));
}
Also used : Import(org.kie.soup.project.datamodel.imports.Import) ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Test(org.junit.Test)

Aggregations

ScoreCardModel (org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel)19 Test (org.junit.Test)10 Import (org.kie.soup.project.datamodel.imports.Import)5 Characteristic (org.drools.workbench.models.guided.scorecard.shared.Characteristic)3 Attribute (org.drools.workbench.models.guided.scorecard.shared.Attribute)2 Query (org.apache.lucene.search.Query)1 ScoreCardModelContent (org.drools.workbench.screens.guided.scorecard.model.ScoreCardModelContent)1 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)1 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)1 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)1 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)1 BaseIndexingTest (org.kie.workbench.common.services.refactoring.backend.server.BaseIndexingTest)1 DefaultIndexBuilder (org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)1 SingleTermQueryBuilder (org.kie.workbench.common.services.refactoring.backend.server.query.builder.SingleTermQueryBuilder)1 ValuePartReferenceIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValuePartReferenceIndexTerm)1 ValueReferenceIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueReferenceIndexTerm)1 Path (org.uberfire.backend.vfs.Path)1 HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)1 Path (org.uberfire.java.nio.file.Path)1 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)1