Search in sources :

Example 26 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 27 with ObservablePath

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

the class ColumnsPagePresenterTest method testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAnInvalidPath.

@Test
public void testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAnInvalidPath() {
    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(null).when(event).getFile();
    presenter.onUpdatedLockStatusEvent(event);
    verify(presenter, never()).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 28 with ObservablePath

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

the class GuidedDecisionTableModellerPresenterTest method refreshDecisionTable.

@Test
public void refreshDecisionTable() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
    final GuidedDecisionTableView dtView = dtPresenter.getView();
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
    presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
    verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
    final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
    assertNotNull(afterRemovalCommand);
    afterRemovalCommand.execute();
    verify(view, times(1)).addDecisionTable(eq(dtView));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) Command(com.google.gwt.user.client.Command) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 29 with ObservablePath

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

the class GuidedDecisionTableModellerPresenterTest method addDecisionTable.

@Test
public void addDecisionTable() {
    final ObservablePath path = mock(ObservablePath.class);
    final PlaceRequest placeRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
    presenter.addDecisionTable(path, placeRequest, dtContent, false, null, null);
    verify(presenter, times(1)).updateLinks();
    verify(gridLayer, times(1)).refreshGridWidgetConnectors();
    verify(view, times(1)).addDecisionTable(eq(dtableView));
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 30 with ObservablePath

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

the class BaseGuidedDecisionTableEditorPresenter method onValidate.

@Override
public void onValidate(final GuidedDecisionTableView.Presenter dtPresenter) {
    final ObservablePath path = dtPresenter.getCurrentPath();
    final GuidedDecisionTable52 model = dtPresenter.getModel();
    service.call(new RemoteCallback<List<ValidationMessage>>() {

        @Override
        public void callback(final List<ValidationMessage> results) {
            if (results == null || results.isEmpty()) {
                notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemValidatedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
            } else {
                showValidationPopup(results);
            }
        }
    }).validate(path, model);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ValidationMessage(org.guvnor.common.services.shared.validation.model.ValidationMessage) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Aggregations

ObservablePath (org.uberfire.backend.vfs.ObservablePath)51 Test (org.junit.Test)38 PlaceRequest (org.uberfire.mvp.PlaceRequest)33 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)29 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)27 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)15 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 Path (org.uberfire.backend.vfs.Path)9 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)7 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)7 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)6 GuidedDecisionTableGraphEntry (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry)5 GuidedDecisionTableEditorGraphModel (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel)4 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)4 List (java.util.List)3 Overview (org.guvnor.common.services.shared.metadata.model.Overview)3 ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)3