Search in sources :

Example 1 with RestoreEvent

use of org.uberfire.ext.editor.commons.version.events.RestoreEvent in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method checkOnRestore.

@Test
public void checkOnRestore() {
    final ObservablePath dtGraphPath = mock(ObservablePath.class);
    final PathPlaceRequest dtGraphPlaceRequest = mock(PathPlaceRequest.class);
    final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
    final RestoreEvent event = new RestoreEvent(dtGraphPath);
    when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
    when(dtGraphPath.getFileName()).thenReturn("filename");
    when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
    when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
    when(versionRecordManager.getPathToLatest()).thenReturn(dtGraphPath);
    presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
    verify(presenter, times(1)).initialiseEditor(eq(dtGraphPath), eq(dtGraphPlaceRequest));
    presenter.onRestore(event);
    verify(presenter, times(2)).initialiseEditor(eq(dtGraphPath), eq(dtGraphPlaceRequest));
    verify(notification, times(1)).fire(any(NotificationEvent.class));
}
Also used : GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RestoreEvent(org.uberfire.ext.editor.commons.version.events.RestoreEvent) 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 RestoreEvent (org.uberfire.ext.editor.commons.version.events.RestoreEvent)1 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)1 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)1