use of org.uberfire.backend.vfs.ObservablePath 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.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkMayCloseWithDirtyDecisionTable.
@Test
public void checkMayCloseWithDirtyDecisionTable() {
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);
when(dtPresenter.getOriginalHashCode()).thenReturn(10);
when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
assertFalse(presenter.mayClose());
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class DecisionTableXLSEditorPresenterTest method testOnUploadWhenConcurrentUpdateSessionInfoIsNull.
@Test
public void testOnUploadWhenConcurrentUpdateSessionInfoIsNull() {
final ObservablePath path = mock(ObservablePath.class);
doReturn(path).when(versionRecordManager).getCurrentPath();
presenter.onUpload();
verify(view).submit(path);
assertNull(presenter.getConcurrentUpdateSessionInfo());
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method refreshDocument.
@Override
public void refreshDocument(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath versionPath = dtPresenter.getCurrentPath();
view.showLoading();
service.call(getRefreshContentSuccessCallback(dtPresenter), getNoSuchFileExceptionErrorCallback()).loadContent(versionPath);
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method getRefreshContentSuccessCallback.
private RemoteCallback<GuidedDecisionTableEditorContent> getRefreshContentSuccessCallback(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath path = dtPresenter.getLatestPath();
final PlaceRequest place = dtPresenter.getPlaceRequest();
final boolean isReadOnly = dtPresenter.isReadOnly();
return (content) -> {
// Refresh Decision Table in modeller
modeller.refreshDecisionTable(dtPresenter, path, place, content, isReadOnly);
activateDocument(dtPresenter);
view.hideBusyIndicator();
};
}
Aggregations