Search in sources :

Example 81 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkRefreshDocument.

@Test
public void checkRefreshDocument() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
    final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
    presenter.onStartup(path, placeRequest);
    verify(view, times(1)).showLoading();
    verify(dtService, times(1)).loadContent(eq(path));
    verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
    verify(view, times(1)).hideBusyIndicator();
    final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
    assertNotNull(dtSelectedEvent);
    assertTrue(dtSelectedEvent.getPresenter().isPresent());
    assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
    when(dtPresenter.getCurrentPath()).thenReturn(path);
    when(presenter.getKieEditorWrapperMultiPage()).thenReturn(pageEditor);
    presenter.refreshDocument(dtPresenter);
    verify(view, times(2)).showLoading();
    verify(dtService, times(2)).loadContent(eq(path));
    verify(modeller, times(1)).refreshDecisionTable(eq(dtPresenter), eq(path), eq(placeRequest), eq(content), any(Boolean.class));
    verify(presenter, times(1)).activateDocument(eq(dtPresenter));
    verify(view, times(2)).hideBusyIndicator();
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Matchers.anyBoolean(org.mockito.Matchers.anyBoolean) ObservablePath(org.uberfire.backend.vfs.ObservablePath) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 82 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkMayCloseWithDirtyDecisionTable.

@Test
public void checkMayCloseWithDirtyDecisionTable() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
    when(dtPresenter.getOriginalHashCode()).thenReturn(10);
    when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });
    assertFalse(presenter.mayClose());
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 83 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.

the class DecisionTableXLSEditorPresenterTest method testOnUploadWhenConcurrentUpdateSessionInfoIsNull.

@Test
public void testOnUploadWhenConcurrentUpdateSessionInfoIsNull() {
    final ObservablePath path = mock(ObservablePath.class);
    doReturn(path).when(versionRecordManager).getCurrentPath();
    presenter.onUpload();
    verify(view).submit(path);
    assertNull(presenter.getConcurrentUpdateSessionInfo());
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 84 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method refreshDocument.

@Override
public void refreshDocument(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath versionPath = dtPresenter.getCurrentPath();
    view.showLoading();
    service.call(getRefreshContentSuccessCallback(dtPresenter), getNoSuchFileExceptionErrorCallback()).loadContent(versionPath);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Example 85 with ObservablePath

use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenter method getRefreshContentSuccessCallback.

private RemoteCallback<GuidedDecisionTableEditorContent> getRefreshContentSuccessCallback(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getLatestPath();
    final PlaceRequest place = dtPresenter.getPlaceRequest();
    final boolean isReadOnly = dtPresenter.isReadOnly();
    return (content) -> {
        // Refresh Decision Table in modeller
        modeller.refreshDecisionTable(dtPresenter, path, place, content, isReadOnly);
        activateDocument(dtPresenter);
        view.hideBusyIndicator();
    };
}
Also used : DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PerspectiveManager(org.uberfire.client.mvp.PerspectiveManager) GuidedDecisionTableEditorService(org.drools.workbench.screens.guided.dtable.service.GuidedDecisionTableEditorService) AlertsButtonMenuItemBuilder(org.guvnor.messageconsole.client.console.widget.button.AlertsButtonMenuItemBuilder) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) GuidedDecisionTableModellerView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableModellerView) ChangeTitleWidgetEvent(org.uberfire.client.workbench.events.ChangeTitleWidgetEvent) ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) KieEditorView(org.kie.workbench.common.widgets.metadata.client.KieEditorView) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) HTMLElement(elemental2.dom.HTMLElement) Observes(javax.enterprise.event.Observes) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) IsWidget(com.google.gwt.user.client.ui.IsWidget) VERIFIER_DOCK(org.drools.workbench.screens.guided.dtable.client.editor.GuidedDecisionTableDocksHandler.VERIFIER_DOCK) AnalysisReportScreen(org.kie.workbench.common.services.verifier.reporting.client.panel.AnalysisReportScreen) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) MultiPageEditor(org.uberfire.client.workbench.widgets.multipage.MultiPageEditor) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) WorkspaceProjectContext(org.guvnor.common.services.project.client.context.WorkspaceProjectContext) RegisteredDocumentsMenuBuilder(org.kie.workbench.common.widgets.metadata.client.menu.RegisteredDocumentsMenuBuilder) PlaceRequest(org.uberfire.mvp.PlaceRequest) Objects(java.util.Objects) List(java.util.List) DownloadMenuItemBuilder(org.uberfire.ext.editor.commons.client.menu.DownloadMenuItemBuilder) RadarMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.RadarMenuBuilder) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Caller(org.jboss.errai.common.client.api.Caller) Optional(java.util.Optional) AssetUpdateValidator(org.kie.workbench.common.widgets.metadata.client.validation.AssetUpdateValidator) ProvidesResize(com.google.gwt.user.client.ui.ProvidesResize) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) AnalysisDockPlaceHolder(org.kie.workbench.common.services.verifier.reporting.client.panel.AnalysisDockPlaceHolder) SavePopUpPresenter(org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter) RequiresResize(com.google.gwt.user.client.ui.RequiresResize) PlaceManager(org.uberfire.client.mvp.PlaceManager) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MenuItems(org.uberfire.ext.editor.commons.client.menu.MenuItems) ViewMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.ViewMenuBuilder) AbstractPlaceEvent(org.uberfire.client.workbench.events.AbstractPlaceEvent) EditMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.EditMenuBuilder) MenuItem(org.uberfire.workbench.model.menu.MenuItem) Page(org.uberfire.client.workbench.widgets.multipage.Page) CommonConstants(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants) XLSConversionResultMessage(org.drools.workbench.screens.guided.dtable.shared.XLSConversionResultMessage) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) Event(javax.enterprise.event.Event) ColumnsPage(org.drools.workbench.screens.guided.dtable.client.editor.page.ColumnsPage) PlaceHiddenEvent(org.uberfire.client.workbench.events.PlaceHiddenEvent) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) OverviewWidgetPresenter(org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter) VersionRecordManager(org.uberfire.ext.editor.commons.client.history.VersionRecordManager) ValidationPopup(org.kie.workbench.common.widgets.client.popups.validation.ValidationPopup) KieMultipleDocumentEditorWrapperView(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditorWrapperView) ElementWrapperWidget(org.jboss.errai.common.client.ui.ElementWrapperWidget) ImportsWidgetPresenter(org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter) FileMenuBuilder(org.kie.workbench.common.widgets.client.menu.FileMenuBuilder) KieMultipleDocumentEditor(org.kie.workbench.common.widgets.metadata.client.KieMultipleDocumentEditor) AuthoringWorkbenchDocks(org.kie.workbench.common.workbench.client.docks.AuthoringWorkbenchDocks) InsertMenuBuilder(org.drools.workbench.screens.guided.dtable.client.editor.menu.InsertMenuBuilder) SyncBeanManager(org.jboss.errai.ioc.client.container.SyncBeanManager) DefaultFileNameValidator(org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator) DockPlaceHolderPlace(org.kie.workbench.common.widgets.client.docks.DockPlaceHolderPlace) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Aggregations

ObservablePath (org.uberfire.backend.vfs.ObservablePath)97 Test (org.junit.Test)70 PlaceRequest (org.uberfire.mvp.PlaceRequest)38 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)32 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)29 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)19 Path (org.uberfire.backend.vfs.Path)14 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)13 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)13 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)11 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)11 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)11 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)9 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)8 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)7 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)7 List (java.util.List)6 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)6 Command (org.uberfire.mvp.Command)6 ArrayList (java.util.ArrayList)5