Search in sources :

Example 31 with VirtualFileSystem

use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.

the class LocalVirtualFileSystemProviderTest method closesVirtualFileSystemWhenProviderIsClosed.

@Test
public void closesVirtualFileSystemWhenProviderIsClosed() throws Exception {
    AtomicReference<VirtualFileSystem> fileSystemReference = getFileSystemReference();
    VirtualFileSystem fileSystem = mock(VirtualFileSystem.class);
    fileSystemReference.set(fileSystem);
    fileSystemProvider.close();
    verify(fileSystem).close();
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) Test(org.junit.Test)

Example 32 with VirtualFileSystem

use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.

the class LocalVirtualFileSystemProviderTest method returnsSameInstanceOfVirtualFileSystemOnceItWasCreated.

@Test
public void returnsSameInstanceOfVirtualFileSystemOnceItWasCreated() throws Exception {
    VirtualFileSystem fileSystem = fileSystemProvider.getVirtualFileSystem(true);
    assertNotNull(fileSystem);
    assertSame(fileSystem, fileSystemProvider.getVirtualFileSystem(false));
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) Test(org.junit.Test)

Example 33 with VirtualFileSystem

use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.

the class FSLuceneSearcherProviderTest method doesNotCreateSearcherWhenItIsNotCreatedYetAndCreationIsNotRequested.

@Test
public void doesNotCreateSearcherWhenItIsNotCreatedYetAndCreationIsNotRequested() throws Exception {
    VirtualFileSystem virtualFileSystem = mockVirtualFileSystem();
    assertNull(fsLuceneSearcherProvider.getSearcher(virtualFileSystem, false));
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) Test(org.junit.Test)

Example 34 with VirtualFileSystem

use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.

the class FSLuceneSearcherProviderTest method createsAndInitializeSearcherWhenCreationRequested.

@Test
public void createsAndInitializeSearcherWhenCreationRequested() throws Exception {
    VirtualFileSystem virtualFileSystem = mockVirtualFileSystem();
    assertNotNull(fsLuceneSearcherProvider.getSearcher(virtualFileSystem, true));
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) Test(org.junit.Test)

Example 35 with VirtualFileSystem

use of org.eclipse.che.api.vfs.VirtualFileSystem in project che by eclipse.

the class FSLuceneSearcherProviderTest method mockVirtualFileSystem.

private VirtualFileSystem mockVirtualFileSystem() {
    VirtualFileSystem virtualFileSystem = mock(VirtualFileSystem.class);
    VirtualFile root = mock(VirtualFile.class);
    when(virtualFileSystem.getRoot()).thenReturn(root);
    return virtualFileSystem;
}
Also used : VirtualFile(org.eclipse.che.api.vfs.VirtualFile) VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem)

Aggregations

VirtualFileSystem (org.eclipse.che.api.vfs.VirtualFileSystem)63 MemoryVirtualFileSystem (org.eclipse.che.api.vfs.impl.memory.MemoryVirtualFileSystem)32 Test (org.junit.Test)29 QueryExpression (org.eclipse.che.api.vfs.search.QueryExpression)28 VirtualFile (org.eclipse.che.api.vfs.VirtualFile)27 Test (org.testng.annotations.Test)18 FolderEntry (org.eclipse.che.api.project.server.FolderEntry)9 Searcher (org.eclipse.che.api.vfs.search.Searcher)7 SearchResult (org.eclipse.che.api.vfs.search.SearchResult)6 ServerException (org.eclipse.che.api.core.ServerException)5 Path (java.nio.file.Path)3 SearcherProvider (org.eclipse.che.api.vfs.search.SearcherProvider)3 IOException (java.io.IOException)2 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 File (java.io.File)1 InputStream (java.io.InputStream)1 TimeoutException (java.util.concurrent.TimeoutException)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ProjectImporter (org.eclipse.che.api.project.server.importer.ProjectImporter)1