Search in sources :

Example 16 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class AbstractTransportTestCase method testGetFileContent_Success.

public void testGetFileContent_Success() throws Exception {
    VFile vFile = VFile.create("a path");
    myUserModel.addUser(mySelf);
    mySelf.setCanAccessMyFiles(true, myUserModel);
    myIdeFacade.setReturnedFileText(vFile, "some tex&&&<<>t" + '');
    String text = mySelf.getVFile(vFile, myIdeFacade);
    assertEquals("Should successfully return file text", "some tex&&&<<>t" + '', text);
    assertEquals("Should put result to vFile", "some tex&&&<<>t" + '', vFile.getContents());
}
Also used : VFile(jetbrains.communicator.core.vfs.VFile)

Example 17 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class AbstractTransportTestCase method testGetFileContent_BigFile.

public void testGetFileContent_BigFile() throws Exception {
    VFile vFile = VFile.create("a path");
    myUserModel.addUser(mySelf);
    mySelf.setCanAccessMyFiles(true, myUserModel);
    char[] buf = new char[100000];
    Arrays.fill(buf, 'd');
    myIdeFacade.setReturnedFileText(vFile, new String(buf));
    WatchDog s = new WatchDog("get 100000 bytes file");
    mySelf.getVFile(vFile, myIdeFacade);
    s.stop();
    assertEquals("Should successfully return file text", new String(buf), vFile.getContents());
}
Also used : WatchDog(jetbrains.communicator.util.WatchDog) VFile(jetbrains.communicator.core.vfs.VFile)

Example 18 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class AbstractTransportTestCase method testGetFileContent_NoRights.

public void testGetFileContent_NoRights() throws Exception {
    VFile vFile = VFile.create("a path");
    myUserModel.addUser(mySelf);
    myIdeFacade.setReturnedFileText(vFile, "some text");
    myIdeFacade.setReturnedAnswer(false);
    mySelf.setCanAccessMyFiles(false, myUserModel);
    String text = mySelf.getVFile(vFile, myIdeFacade);
    assertNull("Should not return file text", text);
    assertNull("Should not put result to vFile", vFile.getContents());
}
Also used : VFile(jetbrains.communicator.core.vfs.VFile)

Example 19 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class AbstractTransportTestCase method testGetFileContent_NoRights_AllowedByUser.

public void testGetFileContent_NoRights_AllowedByUser() throws Exception {
    VFile vFile = VFile.create("a path");
    myUserModel.addUser(mySelf);
    myIdeFacade.setReturnedFileText(vFile, "some text");
    myIdeFacade.setReturnedAnswer(true);
    mySelf.setCanAccessMyFiles(false, myUserModel);
    String text = mySelf.getVFile(vFile, myIdeFacade);
    assertEquals("Should successfully return file text", "some text", text);
}
Also used : VFile(jetbrains.communicator.core.vfs.VFile)

Example 20 with VFile

use of jetbrains.communicator.core.vfs.VFile in project intellij-plugins by JetBrains.

the class VFSUtilTest method checkVFile.

private VFile checkVFile(VirtualFile file, Project project, String expectedPath, String expectedFullPath) {
    VFile vFile = VFSUtil.createFileFrom(file, project);
    if (project != null) {
        assertEquals("Wrong project", project.getName(), vFile.getProjectName());
    } else {
        assertNull("No project expected", vFile.getProjectName());
    }
    assertEquals("Wrong content path", expectedPath, vFile.getContentPath());
    assertEquals("Wrong full path", expectedFullPath, vFile.getFullPath());
    assertEquals("Should restore Virtual File from " + vFile, file, VFSUtil.getVirtualFile(vFile));
    return vFile;
}
Also used : VFile(jetbrains.communicator.core.vfs.VFile)

Aggregations

VFile (jetbrains.communicator.core.vfs.VFile)24 CodePointer (jetbrains.communicator.core.vfs.CodePointer)6 MockUser (jetbrains.communicator.mock.MockUser)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 IDEFacade (jetbrains.communicator.ide.IDEFacade)2 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 Project (com.intellij.openapi.project.Project)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 SendCodePointerCommand (jetbrains.communicator.commands.SendCodePointerCommand)1 ShowDiffCommand (jetbrains.communicator.commands.ShowDiffCommand)1 EventVisitor (jetbrains.communicator.core.EventVisitor)1 IDEtalkAdapter (jetbrains.communicator.core.IDEtalkAdapter)1 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1