use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAValidPath.
@Test
public void testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAValidPath() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
final ObservablePath path = mock(ObservablePath.class);
doReturn(true).when(presenter).hasActiveDecisionTable();
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doReturn(path).when(activeDecisionTable).getCurrentPath();
doReturn(path).when(event).getFile();
doNothing().when(presenter).refresh();
presenter.onUpdatedLockStatusEvent(event);
verify(presenter).refresh();
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAnInvalidPath.
@Test
public void testOnUpdatedLockStatusEventWhenActiveDecisionTableHasAnInvalidPath() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
final ObservablePath path = mock(ObservablePath.class);
doReturn(true).when(presenter).hasActiveDecisionTable();
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doReturn(path).when(activeDecisionTable).getCurrentPath();
doReturn(null).when(event).getFile();
presenter.onUpdatedLockStatusEvent(event);
verify(presenter, never()).refresh();
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method refreshDecisionTable.
@Test
public void refreshDecisionTable() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
final GuidedDecisionTableView dtView = dtPresenter.getView();
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
assertNotNull(afterRemovalCommand);
afterRemovalCommand.execute();
verify(view, times(1)).addDecisionTable(eq(dtView));
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method addDecisionTable.
@Test
public void addDecisionTable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
presenter.addDecisionTable(path, placeRequest, dtContent, false, null, null);
verify(presenter, times(1)).updateLinks();
verify(gridLayer, times(1)).refreshGridWidgetConnectors();
verify(view, times(1)).addDecisionTable(eq(dtableView));
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenter method onValidate.
@Override
public void onValidate(final GuidedDecisionTableView.Presenter dtPresenter) {
final ObservablePath path = dtPresenter.getCurrentPath();
final GuidedDecisionTable52 model = dtPresenter.getModel();
service.call(new RemoteCallback<List<ValidationMessage>>() {
@Override
public void callback(final List<ValidationMessage> results) {
if (results == null || results.isEmpty()) {
notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemValidatedSuccessfully(), NotificationEvent.NotificationType.SUCCESS));
} else {
showValidationPopup(results);
}
}
}).validate(path, model);
}
Aggregations