Search in sources :

Example 86 with Path

use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.

the class GuidedDecisionTableEditorServiceImplTest method copyCopyToPackage.

@Test
public void copyCopyToPackage() {
    final Path path = mock(Path.class);
    final String newFileName = "newFileName";
    final Path newPackagePath = mock(Path.class);
    final String comment = "comment";
    service.copy(path, newFileName, newPackagePath, comment);
    verify(copyService, times(1)).copy(eq(path), eq(newFileName), eq(newPackagePath), eq(comment));
}
Also used : Path(org.uberfire.backend.vfs.Path) Test(org.junit.Test)

Example 87 with Path

use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorServiceImplTest method checkRename.

@Test
public void checkRename() {
    final Path path = mock(Path.class);
    final String newFileName = "newFileName";
    final String comment = "comment";
    service.rename(path, newFileName, comment);
    verify(renameService, times(1)).rename(eq(path), eq(newFileName), eq(comment));
}
Also used : Path(org.uberfire.backend.vfs.Path) Test(org.junit.Test)

Example 88 with Path

use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorServiceImplTest method checkConstructContent.

@Test
public void checkConstructContent() {
    final Path path = mock(Path.class);
    final Overview overview = mock(Overview.class);
    when(path.toURI()).thenReturn("default://project/src/main/resources/mypackage/dtable." + dtGraphResourceType.getSuffix());
    final GuidedDecisionTableEditorGraphContent content = service.constructContent(path, overview);
    verify(resourceOpenedEvent, times(1)).fire(any(ResourceOpenedEvent.class));
    assertNotNull(content.getModel());
    assertEquals(overview, content.getOverview());
}
Also used : Path(org.uberfire.backend.vfs.Path) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) Overview(org.guvnor.common.services.shared.metadata.model.Overview) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) Test(org.junit.Test)

Example 89 with Path

use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorServiceImplTest method checkCopy.

@Test
public void checkCopy() {
    final Path path = mock(Path.class);
    final String newFileName = "newFileName";
    final String comment = "comment";
    service.copy(path, newFileName, comment);
    verify(copyService, times(1)).copy(eq(path), eq(newFileName), eq(comment));
}
Also used : Path(org.uberfire.backend.vfs.Path) Test(org.junit.Test)

Example 90 with Path

use of org.uberfire.backend.vfs.Path in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorServiceImplTest method checkSave.

@Test
@SuppressWarnings("unchecked")
public void checkSave() {
    final Path path = mock(Path.class);
    final GuidedDecisionTableEditorGraphModel model = new GuidedDecisionTableEditorGraphModel();
    final Metadata metadata = mock(Metadata.class);
    final String comment = "comment";
    when(path.toURI()).thenReturn("default://project/src/main/resources/mypackage/dtable." + dtGraphResourceType.getSuffix());
    service.save(path, model, metadata, comment);
    verify(ioService, times(1)).write(any(org.uberfire.java.nio.file.Path.class), any(String.class), any(Map.class), any(CommentedOption.class));
}
Also used : Path(org.uberfire.backend.vfs.Path) GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) CommentedOption(org.uberfire.java.nio.base.options.CommentedOption) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Path (org.uberfire.backend.vfs.Path)136 Test (org.junit.Test)98 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)27 Package (org.guvnor.common.services.project.model.Package)23 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)20 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)19 ArrayList (java.util.ArrayList)13 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)13 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)12 GuidedDecisionTableEditorGraphModel (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel)11 ValidationMessage (org.guvnor.common.services.shared.validation.model.ValidationMessage)10 NewResourceSuccessEvent (org.kie.workbench.common.widgets.client.handlers.NewResourceSuccessEvent)9 Mockito.anyString (org.mockito.Mockito.anyString)9 Overview (org.guvnor.common.services.shared.metadata.model.Overview)8 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)8 ObservablePath (org.uberfire.backend.vfs.ObservablePath)8 List (java.util.List)7 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)7 HashMap (java.util.HashMap)6 HashSet (java.util.HashSet)6