Search in sources :

Example 16 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedWhenNotAvailable.

@Test
public void checkOnDecisionTableSelectedWhenNotAvailable() {
    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);
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
    when(modeller.isDecisionTableAvailable(any(GuidedDecisionTableView.Presenter.class))).thenReturn(false);
    presenter.onDecisionTableSelected(event);
    verify(presenter, never()).activateDocument(any(GuidedDecisionTableView.Presenter.class));
    assertTrue(getMenuState(presenter.getMenus(), MenuItems.VALIDATE));
}
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) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 17 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedEventReselection.

@Test
public void checkOnDecisionTableSelectedEventReselection() {
    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);
    final DecisionTableSelectedEvent eventSelect = new DecisionTableSelectedEvent(dtPresenter);
    doReturn(true).when(modeller).isDecisionTableAvailable(dtPresenter);
    presenter.onStartup(path, placeRequest);
    presenter.onDecisionTableSelected(eventSelect);
    assertEquals(dtPresenter, presenter.getActiveDocument());
    final DecisionTableSelectedEvent eventDeselect = DecisionTableSelectedEvent.NONE;
    presenter.onDecisionTableSelected(eventDeselect);
    assertNull(presenter.getActiveDocument());
    presenter.onDecisionTableSelected(eventSelect);
    assertEquals(dtPresenter, presenter.getActiveDocument());
}
Also used : PlaceRequest(org.uberfire.mvp.PlaceRequest) 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) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 18 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedEventNoTableSelected.

@Test
public void checkOnDecisionTableSelectedEventNoTableSelected() {
    final DecisionTableSelectedEvent event = DecisionTableSelectedEvent.NONE;
    presenter.onDecisionTableSelected(event);
    verify(presenter, never()).activateDocument(any(GuidedDecisionTableView.Presenter.class));
    assertFalse(getMenuState(presenter.getMenus(), MenuItems.VALIDATE));
}
Also used : GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 19 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method testOnDecisionTableSelectedWhenPresenterIsNotNull.

@Test
public void testOnDecisionTableSelectedWhenPresenterIsNotNull() {
    final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
    final Overview overview = mock(Overview.class);
    final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    final GuidedDecisionTablePresenter.Access access = new GuidedDecisionTablePresenter.Access();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
    final ObservablePath path = mock(ObservablePath.class);
    doNothing().when(presenter).initialiseKieEditorTabs(dtPresenter, overview, oracle, model.getImports(), false);
    doNothing().when(presenter).initialiseEditorTabsWhenNoDocuments();
    doReturn(true).when(modeller).isDecisionTableAvailable(dtPresenter);
    doReturn(Optional.of(dtPresenter)).when(modeller).getActiveDecisionTable();
    doReturn(overview).when(dtPresenter).getOverview();
    doReturn(oracle).when(dtPresenter).getDataModelOracle();
    doReturn(model).when(dtPresenter).getModel();
    doReturn(access).when(dtPresenter).getAccess();
    doReturn(path).when(dtPresenter).getLatestPath();
    presenter.registerDocument(dtPresenter);
    presenter.onDecisionTableSelected(event);
    verify(presenter, never()).initialiseEditorTabsWhenNoDocuments();
    verify(presenter).addColumnsTab();
    verify(presenter).enableColumnsTab(dtPresenter);
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) Overview(org.guvnor.common.services.shared.metadata.model.Overview) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) ObservablePath(org.uberfire.backend.vfs.ObservablePath) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 20 with DecisionTableSelectedEvent

use of org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method testOnDecisionTableSelectedWhenPresenterIsNull.

@Test
public void testOnDecisionTableSelectedWhenPresenterIsNull() {
    final DecisionTableSelectedEvent event = mock(DecisionTableSelectedEvent.class);
    doReturn(Optional.empty()).when(event).getPresenter();
    doNothing().when(presenter).initialiseEditorTabsWhenNoDocuments();
    presenter.onDecisionTableSelected(event);
    verify(presenter).initialiseEditorTabsWhenNoDocuments();
}
Also used : DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Aggregations

DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)58 Test (org.junit.Test)54 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)14 ObservablePath (org.uberfire.backend.vfs.ObservablePath)10 PlaceRequest (org.uberfire.mvp.PlaceRequest)10 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)9 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)9 MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)7 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)5 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)2 GuidedDecisionTableGraphEntry (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel.GuidedDecisionTableGraphEntry)2 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)2 Matchers.anyBoolean (org.mockito.Matchers.anyBoolean)2 MultiPageEditor (org.uberfire.client.workbench.widgets.multipage.MultiPageEditor)2 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)2 PostConstruct (javax.annotation.PostConstruct)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)1 ImportsWidgetPresenter (org.kie.workbench.common.widgets.configresource.client.widget.bound.ImportsWidgetPresenter)1