use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkOnUpdatedLockStatusEvent.
private void checkOnUpdatedLockStatusEvent(final ObservablePath path, final boolean locked, final boolean lockedByCurrentUser, final Command assertion) {
presenter.editorPath = path;
presenter.access.setLock(LockedBy.NOBODY);
final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(path, locked, lockedByCurrentUser);
presenter.onUpdatedLockStatusEvent(event);
assertion.execute();
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent 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.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnUpdatedLockStatusEventWhenDoesNotHaveActiveDecisionTable.
@Test
public void testOnUpdatedLockStatusEventWhenDoesNotHaveActiveDecisionTable() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
doReturn(false).when(presenter).hasActiveDecisionTable();
presenter.onUpdatedLockStatusEvent(event);
verify(presenter, never()).refresh();
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent 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.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testOnUpdatedLockStatusEventWhenTableIsNotLockedAndIsNotEditable.
@Test
public void testOnUpdatedLockStatusEventWhenTableIsNotLockedAndIsNotEditable() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
doReturn(false).when(event).isLocked();
doReturn(false).when(event).isLockedByCurrentUser();
doReturn(false).when(presenter).isGuidedDecisionTableEditable(activeDecisionTable);
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doNothing().when(presenter).enableColumnsTab(anyBoolean());
presenter.onUpdatedLockStatusEvent(event);
verify(presenter).enableColumnsTab(eq(false));
}
Aggregations