Search in sources :

Example 1 with GlobalsEditorContent

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

the class GlobalsEditorPresenterTest method loadContent.

@Test
public void loadContent() {
    presenter.loadContent();
    verify(view, times(1)).showLoading();
    verify(globalsEditorService, times(1)).loadContent(any(Path.class));
    when(versionRecordManager.getCurrentPath()).thenReturn(mock(ObservablePath.class));
    // Emulate the globals being successfully loaded
    GlobalsEditorContent globalsEditorContent = mock(GlobalsEditorContent.class);
    Overview overview = mock(Overview.class);
    when(overview.getMetadata()).thenReturn(mock(Metadata.class));
    when(globalsEditorContent.getOverview()).thenReturn(overview);
    GlobalsModel globalsModel = mock(GlobalsModel.class);
    when(globalsEditorContent.getModel()).thenReturn(globalsModel);
    presenter.getModelSuccessCallback().callback(globalsEditorContent);
    verify(view, times(1)).setContent(anyListOf(Global.class), anyListOf(String.class), anyBoolean(), anyBoolean());
    verify(view, times(1)).hideBusyIndicator();
}
Also used : Path(org.uberfire.backend.vfs.Path) ObservablePath(org.uberfire.backend.vfs.ObservablePath) GlobalsEditorContent(org.drools.workbench.screens.globals.model.GlobalsEditorContent) GlobalsModel(org.drools.workbench.screens.globals.model.GlobalsModel) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Overview(org.guvnor.common.services.shared.metadata.model.Overview) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Global(org.drools.workbench.screens.globals.model.Global) Test(org.junit.Test)

Example 2 with GlobalsEditorContent

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

the class GlobalsEditorServiceImpl method constructContent.

@Override
protected GlobalsEditorContent constructContent(Path path, Overview overview) {
    // De-serialize model
    final GlobalsModel model = load(path);
    final ModuleDataModelOracle oracle = dataModelService.getModuleDataModel(path);
    final String[] fullyQualifiedClassNames = new String[oracle.getModuleModelFields().size()];
    oracle.getModuleModelFields().keySet().toArray(fullyQualifiedClassNames);
    // Signal opening to interested parties
    resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
    return new GlobalsEditorContent(model, overview, Arrays.asList(fullyQualifiedClassNames));
}
Also used : GlobalsEditorContent(org.drools.workbench.screens.globals.model.GlobalsEditorContent) GlobalsModel(org.drools.workbench.screens.globals.model.GlobalsModel) ModuleDataModelOracle(org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent)

Aggregations

GlobalsEditorContent (org.drools.workbench.screens.globals.model.GlobalsEditorContent)2 GlobalsModel (org.drools.workbench.screens.globals.model.GlobalsModel)2 Global (org.drools.workbench.screens.globals.model.Global)1 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 Test (org.junit.Test)1 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Path (org.uberfire.backend.vfs.Path)1 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)1