Search in sources :

Example 96 with ObservablePath

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

the class ColumnsPagePresenterTest method testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAValidPath.

@Test
public void testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAValidPath() {
    final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
    final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
    final ObservablePath path = mock(ObservablePath.class);
    doReturn(true).when(presenter).hasActiveDecisionTable();
    doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
    doReturn(path).when(activeDecisionTable).getCurrentPath();
    doReturn(path).when(event).getFile();
    doNothing().when(presenter).refresh();
    presenter.onUpdatedLockStatusEvent(event);
    verify(presenter).refresh();
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 97 with ObservablePath

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

the class GuidedDecisionTableGraphEditorPresenterTest method checkInitialiseKieEditorTabs.

@Test
public void checkInitialiseKieEditorTabs() {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PlaceRequest dtGraphPlaceRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent(0);
    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphPath.getFileName()).thenReturn("filename");
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(versionRecordManager.getVersion()).thenReturn("version");
    presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
    verify(kieEditorWrapperView, times(1)).clear();
    final GuidedDecisionTableView.Presenter document = mock(GuidedDecisionTableView.Presenter.class);
    final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
    final Imports imports = mock(Imports.class);
    final boolean isReadOnly = true;
    final ArgumentCaptor<com.google.gwt.user.client.Command> onFocusCommandCaptor = ArgumentCaptor.forClass(com.google.gwt.user.client.Command.class);
    presenter.initialiseKieEditorTabs(document, dtGraphContent.getOverview(), dmo, imports, isReadOnly);
    verify(kieEditorWrapperView, times(2)).clear();
    verify(kieEditorWrapperView, times(2)).addMainEditorPage(view);
    verify(kieEditorWrapperView, times(2)).addOverviewPage(eq(overviewWidget), onFocusCommandCaptor.capture());
    verify(overviewWidget, times(2)).setContent(eq(dtGraphContent.getOverview()), any());
    verify(kieEditorWrapperView, times(1)).addSourcePage(any(ViewDRLSourceWidget.class));
    verify(kieEditorWrapperView, times(1)).addImportsTab(eq(importsWidget));
    verify(importsWidget, times(1)).setContent(eq(dmo), eq(imports), eq(isReadOnly));
    final com.google.gwt.user.client.Command onFocusCommand = onFocusCommandCaptor.getValue();
    assertNotNull(onFocusCommand);
    onFocusCommand.execute();
    verify(overviewWidget, times(1)).refresh(eq("version"));
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) Imports(org.kie.soup.project.datamodel.imports.Imports) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) ViewDRLSourceWidget(org.kie.workbench.common.widgets.client.source.ViewDRLSourceWidget) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

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