use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method testOnUpdatedLockStatusEvent_LockedByCurrentUser.
@Test
public void testOnUpdatedLockStatusEvent_LockedByCurrentUser() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
when(event.getFile()).thenReturn(dtPath);
when(event.isLockedByCurrentUser()).thenReturn(true);
when(event.isLocked()).thenReturn(true);
dtPresenter.onUpdatedLockStatusEvent(event);
verify(dtPresenter).refreshColumnsPage();
verify(dtPresenter).refreshMenus();
assertEquals(CURRENT_USER, dtPresenter.getAccess().getLock());
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testOnUpdatedLockStatusEventWhenActiveDecisionTableIsNull.
@Test
public void testOnUpdatedLockStatusEventWhenActiveDecisionTableIsNull() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
doReturn(Optional.empty()).when(modeller).getActiveDecisionTable();
presenter.onUpdatedLockStatusEvent(event);
verify(presenter, never()).enableColumnsTab(any());
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testOnUpdatedLockStatusEventWhenIsLockedByTheCurrentUser.
@Test
public void testOnUpdatedLockStatusEventWhenIsLockedByTheCurrentUser() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
doReturn(true).when(event).isLocked();
doReturn(true).when(event).isLockedByCurrentUser();
doReturn(true).when(presenter).isGuidedDecisionTableEditable(activeDecisionTable);
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doNothing().when(presenter).enableColumnsTab(anyBoolean());
presenter.onUpdatedLockStatusEvent(event);
verify(presenter).enableColumnsTab(eq(true));
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testOnUpdatedLockStatusEventWhenTableIsNotLockedAndIsEditable.
@Test
public void testOnUpdatedLockStatusEventWhenTableIsNotLockedAndIsEditable() {
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(true).when(presenter).isGuidedDecisionTableEditable(activeDecisionTable);
doReturn(Optional.of(activeDecisionTable)).when(modeller).getActiveDecisionTable();
doNothing().when(presenter).enableColumnsTab(anyBoolean());
presenter.onUpdatedLockStatusEvent(event);
verify(presenter).enableColumnsTab(eq(true));
}
use of org.uberfire.client.mvp.UpdatedLockStatusEvent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method testOnUpdatedLockStatusEventWhenIsLockedByAnotherUser.
@Test
public void testOnUpdatedLockStatusEventWhenIsLockedByAnotherUser() {
final UpdatedLockStatusEvent event = mock(UpdatedLockStatusEvent.class);
final GuidedDecisionTableView.Presenter activeDecisionTable = mock(GuidedDecisionTableView.Presenter.class);
doReturn(true).when(event).isLocked();
doReturn(false).when(event).isLockedByCurrentUser();
doReturn(true).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