use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.
the class KieMultipleDocumentEditorTest method testConcurrentRenameCommandIgnore.
@Test
@SuppressWarnings("unchecked")
public void testConcurrentRenameCommandIgnore() {
final TestDocument document = createTestDocument();
final ObservablePath path = document.getLatestPath();
concurrentRenameCommand = editor.getConcurrentRenameOnIgnoreCommand();
editor.setupMenuBar();
registerDocument(document);
final ArgumentCaptor<ParameterizedCommand> renameCommandCaptor = ArgumentCaptor.forClass(ParameterizedCommand.class);
verify(path, times(1)).onConcurrentRename(renameCommandCaptor.capture());
final ParameterizedCommand renameCommand = renameCommandCaptor.getValue();
assertNotNull(renameCommand);
final ObservablePath.OnConcurrentRenameEvent info = mock(ObservablePath.OnConcurrentRenameEvent.class);
renameCommand.execute(info);
verify(editor, times(1)).enableMenus(eq(false));
verify(editor, times(4)).enableMenuItem(eq(false), any(MenuItems.class));
verify(saveMenuItem, times(1)).setEnabled(eq(false));
verify(versionManagerMenuItem, times(1)).setEnabled(eq(false));
}
use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.
the class OverviewWidgetPresenterTest method testDirty.
@Test
public void testDirty() throws Exception {
Metadata metadata = new Metadata();
overview.setMetadata(metadata);
ObservablePath observablePath = mock(ObservablePath.class);
editor.setContent(overview, observablePath);
assertFalse(editor.isDirty());
presenter.onDescriptionEdited("Hello");
assertTrue(editor.isDirty());
editor.resetDirty();
assertFalse(editor.isDirty());
}
use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddCopy.
@Test
public void testAddCopy() {
final ObservablePath observablePath = mock(ObservablePath.class);
doReturn(observablePath).when(versionRecordManager).getCurrentPath();
presenter.addCopy(fileMenuBuilder);
verify(fileMenuBuilder).addCopy(observablePath, assetUpdateValidator);
}
use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.
the class KieEditorTest method testAddRenameWhenSaveAndRenameIsNotEnabled.
@Test
public void testAddRenameWhenSaveAndRenameIsNotEnabled() {
final ObservablePath observablePath = mock(ObservablePath.class);
doReturn(observablePath).when(versionRecordManager).getPathToLatest();
doReturn(null).when(presenter).getSaveAndRenameServiceCaller();
presenter.addRename(fileMenuBuilder);
verify(fileMenuBuilder).addRename(observablePath, assetUpdateValidator);
}
use of org.uberfire.backend.vfs.ObservablePath in project kie-wb-common by kiegroup.
the class RegisteredDocumentsMenuBuilderTest method makeKieDocument.
private KieDocument makeKieDocument() {
final KieDocument document = mock(KieDocument.class);
final ObservablePath currentPath = mock(ObservablePath.class);
when(document.getCurrentPath()).thenReturn(currentPath);
when(currentPath.getFileName()).thenReturn("filename");
return document;
}
Aggregations