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));
}
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());
}
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));
}
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);
}
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();
}
Aggregations