Search in sources :

Example 66 with ObservablePath

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));
}
Also used : MenuItems(org.uberfire.ext.editor.commons.client.menu.MenuItems) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 67 with ObservablePath

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());
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 68 with ObservablePath

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);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 69 with ObservablePath

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);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Example 70 with ObservablePath

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;
}
Also used : KieDocument(org.kie.workbench.common.widgets.metadata.client.KieDocument) ObservablePath(org.uberfire.backend.vfs.ObservablePath)

Aggregations

ObservablePath (org.uberfire.backend.vfs.ObservablePath)97 Test (org.junit.Test)70 PlaceRequest (org.uberfire.mvp.PlaceRequest)38 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)32 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)29 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)19 Path (org.uberfire.backend.vfs.Path)14 GuidedDecisionTablePresenter (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter)13 GuidedDecisionTableEditorGraphContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent)13 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)11 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)11 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)11 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)9 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)8 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)7 OverviewWidgetPresenter (org.kie.workbench.common.widgets.metadata.client.widget.OverviewWidgetPresenter)7 List (java.util.List)6 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)6 Command (org.uberfire.mvp.Command)6 ArrayList (java.util.ArrayList)5