Search in sources :

Example 26 with VirtualFileSystem

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

the class CreateBaseProjectTypeHandler method onCreateProject.

@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
    VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
    FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
    baseFolder.createFile(README_FILE_NAME, getReadmeContent());
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) FolderEntry(org.eclipse.che.api.project.server.FolderEntry)

Example 27 with VirtualFileSystem

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

the class PythonProjectGenerator method onCreateProject.

@Override
public void onCreateProject(Path projectPath, Map<String, AttributeValue> attributes, Map<String, String> options) throws ForbiddenException, ConflictException, ServerException {
    VirtualFileSystem vfs = virtualFileSystemProvider.getVirtualFileSystem();
    FolderEntry baseFolder = new FolderEntry(vfs.getRoot().createFolder(projectPath.toString()));
    baseFolder.createFile(FILE_NAME, getClass().getClassLoader().getResourceAsStream("files/default_python_content"));
}
Also used : VirtualFileSystem(org.eclipse.che.api.vfs.VirtualFileSystem) FolderEntry(org.eclipse.che.api.project.server.FolderEntry)

Example 28 with VirtualFileSystem

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

the class MemoryVirtualFileSystemProviderTest 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 29 with VirtualFileSystem

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

the class MemoryVirtualFileSystemProviderTest method closesVirtualFileSystemWhenProviderIsClosed.

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

Example 30 with VirtualFileSystem

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

the class LocalVirtualFileSystemProviderTest method resetsVirtualFileSystemInProviderAfterClosingVirtualFileSystem.

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

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