use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.
the class GuidedScoreCardDRLPersistenceTest method testModelWithImportsAndFactNameDuplicatingExplicitImport.
@Test
public void testModelWithImportsAndFactNameDuplicatingExplicitImport() {
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.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 "));
}
use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools by kiegroup.
the class Helper method createGuidedScoreCard.
public static ScoreCardModel createGuidedScoreCard() {
final ScoreCardModel model = new ScoreCardModel();
model.setName("test");
model.setPackageName("org.drools.workbench.models.guided.scorecard.backend.test1");
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.ApplicantAttribute");
c.setDataType("int");
c.setField("attribute");
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);
return model;
}
use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools-wb by kiegroup.
the class GuidedScoreCardEditorPresenterTest method testGetContentSupplier.
@Test
public void testGetContentSupplier() throws Exception {
final ScoreCardModel content = mock(ScoreCardModel.class);
doReturn(content).when(view).getModel();
final Supplier<ScoreCardModel> contentSupplier = editor.getContentSupplier();
assertEquals(content, contentSupplier.get());
}
use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools-wb by kiegroup.
the class GuidedScoreCardEditorServiceImplTest method testSaveAndRename.
@Test
public void testSaveAndRename() throws Exception {
final Path path = mock(Path.class);
final String newFileName = "newFileName";
final Metadata metadata = mock(Metadata.class);
final ScoreCardModel content = mock(ScoreCardModel.class);
final String comment = "comment";
service.saveAndRename(path, newFileName, metadata, content, comment);
verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);
}
use of org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel in project drools-wb by kiegroup.
the class NewGuidedScoreCardHandler method create.
@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
final ScoreCardModel model = new ScoreCardModel();
model.setName(baseFileName);
model.setPackageName(pkg.getPackageName());
busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
scoreCardService.call(getSuccessCallback(presenter), new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageMainResourcesPath(), buildFileName(baseFileName, resourceType), model, "");
}
Aggregations