use of org.uberfire.backend.vfs.ObservablePath 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();
}
use of org.uberfire.backend.vfs.ObservablePath in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkInitialiseKieEditorTabs.
@Test
public void checkInitialiseKieEditorTabs() {
final ObservablePath dtGraphPath = mock(ObservablePath.class);
final PlaceRequest dtGraphPlaceRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent(0);
when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
when(dtGraphPath.getFileName()).thenReturn("filename");
when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
when(versionRecordManager.getVersion()).thenReturn("version");
presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
verify(kieEditorWrapperView, times(1)).clear();
final GuidedDecisionTableView.Presenter document = mock(GuidedDecisionTableView.Presenter.class);
final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
final Imports imports = mock(Imports.class);
final boolean isReadOnly = true;
final ArgumentCaptor<com.google.gwt.user.client.Command> onFocusCommandCaptor = ArgumentCaptor.forClass(com.google.gwt.user.client.Command.class);
presenter.initialiseKieEditorTabs(document, dtGraphContent.getOverview(), dmo, imports, isReadOnly);
verify(kieEditorWrapperView, times(2)).clear();
verify(kieEditorWrapperView, times(2)).addMainEditorPage(view);
verify(kieEditorWrapperView, times(2)).addOverviewPage(eq(overviewWidget), onFocusCommandCaptor.capture());
verify(overviewWidget, times(2)).setContent(eq(dtGraphContent.getOverview()), any());
verify(kieEditorWrapperView, times(1)).addSourcePage(any(ViewDRLSourceWidget.class));
verify(kieEditorWrapperView, times(1)).addImportsTab(eq(importsWidget));
verify(importsWidget, times(1)).setContent(eq(dmo), eq(imports), eq(isReadOnly));
final com.google.gwt.user.client.Command onFocusCommand = onFocusCommandCaptor.getValue();
assertNotNull(onFocusCommand);
onFocusCommand.execute();
verify(overviewWidget, times(1)).refresh(eq("version"));
}
Aggregations