Search in sources :

Example 1 with LockTarget

use of org.uberfire.client.mvp.LockTarget in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method checkOnStartupBasicInitialisation.

@Test
public void checkOnStartupBasicInitialisation() {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PlaceRequest dtGraphPlaceRequest = mock(PlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent(INITIAL_HASH_CODE);
    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(dtGraphPath.getFileName()).thenReturn("filename");
    presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
    assertEquals(dtGraphPath, presenter.editorPath);
    assertEquals(dtGraphPlaceRequest, presenter.editorPlaceRequest);
    assertEquals(INITIAL_HASH_CODE, (int) presenter.originalGraphHash);
    verify(presenter, times(1)).initialiseEditor(eq(dtGraphPath), eq(dtGraphPlaceRequest));
    verify(presenter, times(1)).initialiseVersionManager();
    verify(presenter, times(1)).addFileChangeListeners(eq(dtGraphPath));
    verify(lockManager, times(1)).init(lockTargetCaptor.capture());
    final LockTarget lockTarget = lockTargetCaptor.getValue();
    assertNotNull(lockTarget);
    assertEquals(dtGraphPath, lockTarget.getPath());
    assertEquals(dtGraphPlaceRequest, lockTarget.getPlace());
    assertNotNull(lockTarget.getTitle());
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) LockTarget(org.uberfire.client.mvp.LockTarget) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)1 Test (org.junit.Test)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 LockTarget (org.uberfire.client.mvp.LockTarget)1 PlaceRequest (org.uberfire.mvp.PlaceRequest)1 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)1