Search in sources :

Example 16 with Imports

use of org.kie.soup.project.datamodel.imports.Imports in project drools-wb by kiegroup.

the class ScenarioTestEditorServiceImplTest method runScenarioWithoutDependentImports.

@Test
public void runScenarioWithoutDependentImports() throws Exception {
    when(dataModelService.getDataModel(path)).thenReturn(modelOracle);
    when(scenario.getImports()).thenReturn(new Imports());
    testEditorService.addDependentImportsToScenario(scenario, path);
    assertEquals(0, scenario.getImports().getImports().size());
}
Also used : Imports(org.kie.soup.project.datamodel.imports.Imports) Test(org.junit.Test)

Example 17 with Imports

use of org.kie.soup.project.datamodel.imports.Imports in project drools-wb by kiegroup.

the class FactModelPersistence method unmarshal.

public static FactModels unmarshal(final String content) {
    try {
        // De-serialize model
        final List<FactMetaModel> models = toModel(content);
        final FactModels factModels = new FactModels();
        factModels.getModels().addAll(models);
        // De-serialize Package name
        final String packageName = PackageNameParser.parsePackageName(content);
        factModels.setPackageName(packageName);
        // De-serialize imports
        final Imports imports = ImportsParser.parseImports(content);
        factModels.setImports(imports);
        return factModels;
    } catch (final DroolsParserException e) {
        throw new RuntimeException(e);
    }
// TODO {porcelli} needs define error handling strategy
// log.error( "Unable to parse the DRL for the model - falling back to text (" + e.getMessage() + ")" );
// RuleContentText text = new RuleContentText();
// text.content = item.getContent();
// asset.setContent( text );
}
Also used : FactMetaModel(org.drools.workbench.screens.factmodel.model.FactMetaModel) Imports(org.kie.soup.project.datamodel.imports.Imports) FactModels(org.drools.workbench.screens.factmodel.model.FactModels) DroolsParserException(org.drools.compiler.compiler.DroolsParserException)

Aggregations

Imports (org.kie.soup.project.datamodel.imports.Imports)17 Test (org.junit.Test)8 Import (org.kie.soup.project.datamodel.imports.Import)8 ArrayList (java.util.ArrayList)5 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)5 HashMap (java.util.HashMap)4 Fixture (org.drools.workbench.models.testscenarios.shared.Fixture)4 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)3 Mockito.anyString (org.mockito.Mockito.anyString)3 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)2 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)2 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)2 Before (org.junit.Before)2 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)2 URI (java.net.URI)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DroolsParserException (org.drools.compiler.compiler.DroolsParserException)1 AnnotationDescr (org.drools.compiler.lang.descr.AnnotationDescr)1 RuleDescr (org.drools.compiler.lang.descr.RuleDescr)1