use of org.uberfire.client.workbench.widgets.multipage.MultiPageEditor in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testAddColumnsTab.
@Test
public void testAddColumnsTab() {
final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
doReturn(pageEditor).when(presenter).getKieEditorWrapperMultiPage();
presenter.addColumnsTab();
verify(columnsPage).init(modeller);
verify(presenter).addEditorPage(COLUMNS_TAB_INDEX, columnsPage);
}
use of org.uberfire.client.workbench.widgets.multipage.MultiPageEditor in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method enableColumnsPage.
void enableColumnsPage() {
final MultiPageEditor multiPage = getKieEditorWrapperMultiPage();
multiPage.enablePage(COLUMNS_TAB_INDEX);
}
use of org.uberfire.client.workbench.widgets.multipage.MultiPageEditor 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();
}
use of org.uberfire.client.workbench.widgets.multipage.MultiPageEditor in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedWhenAvailableNotSelected.
@Test
public void checkOnDecisionTableSelectedWhenAvailableNotSelected() {
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);
final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
when(modeller.isDecisionTableAvailable(any(GuidedDecisionTableView.Presenter.class))).thenReturn(true);
when(presenter.getActiveDocument()).thenReturn(null);
when(presenter.getKieEditorWrapperMultiPage()).thenReturn(pageEditor);
presenter.onStartup(path, placeRequest);
presenter.onDecisionTableSelected(event);
verify(presenter, times(1)).activateDocument(any(GuidedDecisionTableView.Presenter.class));
verify(radarMenuItem, atLeast(1)).setEnabled(eq(true));
assertTrue(getMenuState(presenter.getMenus(), MenuItems.VALIDATE));
}
use of org.uberfire.client.workbench.widgets.multipage.MultiPageEditor in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testActivateDocument.
@Test
public void testActivateDocument() {
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
final Overview overview = mock(Overview.class);
final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
final Imports imports = mock(Imports.class);
final GuidedDecisionTablePresenter.Access access = mock(GuidedDecisionTablePresenter.Access.class);
final MultiPageEditor pageEditor = mock(MultiPageEditor.class);
final boolean isEditable = true;
doReturn(overview).when(dtPresenter).getOverview();
doReturn(oracle).when(dtPresenter).getDataModelOracle();
doReturn(model).when(dtPresenter).getModel();
doReturn(imports).when(model).getImports();
doReturn(access).when(dtPresenter).getAccess();
doReturn(isEditable).when(access).isEditable();
doReturn(pageEditor).when(presenter).getKieEditorWrapperMultiPage();
doNothing().when(presenter).activateDocument(any(), any(), any(), any(), anyBoolean());
presenter.activateDocument(dtPresenter);
verify(dtPresenter).activate();
verify(presenter).enableMenus(true);
verify(presenter).addColumnsTab();
verify(presenter).enableColumnsTab(dtPresenter);
verify(presenter).activateDocument(dtPresenter, overview, oracle, imports, !isEditable);
}
Aggregations