Search in sources :

Example 1 with UpdatedLockStatusEvent

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());
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) Test(org.junit.Test)

Example 2 with UpdatedLockStatusEvent

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());
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) Test(org.junit.Test)

Example 3 with UpdatedLockStatusEvent

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));
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 4 with UpdatedLockStatusEvent

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));
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 5 with UpdatedLockStatusEvent

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));
}
Also used : UpdatedLockStatusEvent(org.uberfire.client.mvp.UpdatedLockStatusEvent) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Aggregations

UpdatedLockStatusEvent (org.uberfire.client.mvp.UpdatedLockStatusEvent)13 Test (org.junit.Test)12 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)6 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2