Search in sources :

Example 6 with ScoreCardModel

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

the class GuidedScoreCardFactory method makeScoreCardWithoutCharacteristics.

public static ScoreCardModel makeScoreCardWithoutCharacteristics(final String packageName, final Collection<Import> imports, final String name) {
    final ScoreCardModel model = new ScoreCardModel();
    model.getImports().getImports().addAll(imports);
    model.setPackageName(packageName);
    model.setName(name);
    model.setFactName("Applicant");
    model.setFieldName("age");
    return model;
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel)

Example 7 with ScoreCardModel

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());
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Test(org.junit.Test)

Example 8 with ScoreCardModel

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);
}
Also used : Path(org.uberfire.backend.vfs.Path) ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Test(org.junit.Test)

Example 9 with ScoreCardModel

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, "");
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)

Example 10 with ScoreCardModel

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

the class GuidedScoreCardDRLPersistenceTest method testEmptyModel.

@Test
public void testEmptyModel() {
    final ScoreCardModel model = new ScoreCardModel();
    model.setName("test");
    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)

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