Search in sources :

Example 6 with UpdatedLockStatusEvent

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

Example 7 with UpdatedLockStatusEvent

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

Example 8 with UpdatedLockStatusEvent

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

Example 9 with UpdatedLockStatusEvent

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

Example 10 with UpdatedLockStatusEvent

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));
}
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