Search in sources :

Example 61 with VirtualFileSystem

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

the class MemoryLuceneSearcherProviderTest method createsAndInitializeSearcherWhenCreationRequested.

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

Example 62 with VirtualFileSystem

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

the class MemoryLuceneSearcherProviderTest method resetsSearcherInProviderAfterClosingSearcher.

@Test
public void resetsSearcherInProviderAfterClosingSearcher() throws Exception {
    VirtualFileSystem virtualFileSystem = mockVirtualFileSystem();
    Searcher searcher = memoryLuceneSearcherProvider.getSearcher(virtualFileSystem, true);
    assertNotNull(searcher);
    searcher.close();
    assertNull(memoryLuceneSearcherProvider.getSearcher(virtualFileSystem, false));
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) Searcher(org.eclipse.che.api.vfs.search.Searcher) Test(org.junit.Test)

Example 63 with VirtualFileSystem

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

the class MemoryLuceneSearcherProviderTest 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