use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorPresenterTest method startUpSelectsDecisionTable.
@Test
public void startUpSelectsDecisionTable() {
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);
presenter.onStartup(path, placeRequest);
verify(decisionTableSelectedEvent, times(1)).fire(dtSelectedEventCaptor.capture());
final DecisionTableSelectedEvent dtSelectedEvent = dtSelectedEventCaptor.getValue();
assertNotNull(dtSelectedEvent);
assertTrue(dtSelectedEvent.getPresenter().isPresent());
assertEquals(dtPresenter, dtSelectedEvent.getPresenter().get());
verify(modellerGridPanel).setFocus(eq(true));
}
use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class GuidedDecisionTableEditorPresenterTest method checkRemoveDocumentClosesEditor.
@Test
public void checkRemoveDocumentClosesEditor() {
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
presenter.editorPlaceRequest = placeRequest;
presenter.removeDocument(dtPresenter);
final ArgumentCaptor<Scheduler.ScheduledCommand> commandCaptor = ArgumentCaptor.forClass(Scheduler.ScheduledCommand.class);
verify(presenter, times(1)).scheduleClosure(commandCaptor.capture());
final Scheduler.ScheduledCommand command = commandCaptor.getValue();
assertNotNull(command);
command.execute();
verify(placeManager, times(1)).forceClosePlace(eq(placeRequest));
}
use of org.uberfire.mvp.PlaceRequest 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.mvp.PlaceRequest in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnValidateWithoutErrors.
@Test
public void checkOnValidateWithoutErrors() {
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(dtService.validate(any(Path.class), any(GuidedDecisionTable52.class))).thenReturn(Collections.emptyList());
presenter.onValidate(dtPresenter);
final ArgumentCaptor<GuidedDecisionTable52> modelCaptor = ArgumentCaptor.forClass(GuidedDecisionTable52.class);
verify(dtService, times(1)).validate(eq(path), modelCaptor.capture());
assertNotNull(modelCaptor.getValue());
assertEquals(dtPresenter.getModel(), modelCaptor.getValue());
verify(notification, times(1)).fire(any(NotificationEvent.class));
}
use of org.uberfire.mvp.PlaceRequest 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();
}
Aggregations