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