Search in sources :

Example 11 with GlobalsModel

use of org.drools.workbench.screens.globals.model.GlobalsModel in project drools-wb by kiegroup.

the class GlobalsPersistenceTest method testUnmarshalling.

@Test
public void testUnmarshalling() {
    final String content = "global java.lang.String myString;\n";
    final GlobalsModel model = GlobalsPersistence.getInstance().unmarshal(content);
    assertNotNull(model);
    assertEquals(1, model.getGlobals().size());
    assertEquals("java.lang.String", model.getGlobals().get(0).getClassName());
    assertEquals("myString", model.getGlobals().get(0).getAlias());
}
Also used : GlobalsModel(org.drools.workbench.screens.globals.model.GlobalsModel) Test(org.junit.Test)

Example 12 with GlobalsModel

use of org.drools.workbench.screens.globals.model.GlobalsModel in project drools-wb by kiegroup.

the class DecisionTableXLSToDecisionTableGuidedConverterTest method testGlobalGeneration.

@Test
public // https://bugzilla.redhat.com/show_bug.cgi?id=1310208
void testGlobalGeneration() {
    final InputStream is = this.getClass().getResourceAsStream("BZ1310208.xls");
    when(ioService.newInputStream(any(org.uberfire.java.nio.file.Path.class))).thenReturn(is);
    final ConversionResult result = converter.convert(path);
    assertNotNull(result);
    final ArgumentCaptor<GlobalsModel> globalsModelArgumentCaptor = ArgumentCaptor.forClass(GlobalsModel.class);
    verify(globalsService, times(1)).create(any(Path.class), any(String.class), globalsModelArgumentCaptor.capture(), any(String.class));
    assertNotNull(globalsModelArgumentCaptor.getValue());
    final GlobalsModel globalsModel = globalsModelArgumentCaptor.getValue();
    assertEquals(1, globalsModel.getGlobals().size());
    assertEquals("list", globalsModel.getGlobals().get(0).getAlias());
    assertEquals("java.util.List", globalsModel.getGlobals().get(0).getClassName());
    verify(guidedDecisionTableService, times(1)).create(any(Path.class), any(String.class), any(GuidedDecisionTable52.class), any(String.class));
    verify(drlService, never()).create(any(Path.class), any(String.class), any(String.class), any(String.class));
}
Also used : Path(org.uberfire.backend.vfs.Path) ConversionResult(org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GlobalsModel(org.drools.workbench.screens.globals.model.GlobalsModel) InputStream(java.io.InputStream) Test(org.junit.Test)

Aggregations

GlobalsModel (org.drools.workbench.screens.globals.model.GlobalsModel)12 Test (org.junit.Test)7 Path (org.uberfire.backend.vfs.Path)5 Global (org.drools.workbench.screens.globals.model.Global)3 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)3 GlobalsEditorContent (org.drools.workbench.screens.globals.model.GlobalsEditorContent)2 Matchers.anyString (org.mockito.Matchers.anyString)2 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)2 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Global (org.drools.template.model.Global)1 Import (org.drools.template.model.Import)1 ConversionResult (org.drools.workbench.models.guided.dtable.shared.conversion.ConversionResult)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Pair (org.uberfire.commons.data.Pair)1 HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)1