Search in sources :

Example 6 with ProjectsData

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

the class ViewFilesCommandTest method testExecute_NoInformation.

public void testExecute_NoInformation() throws Exception {
    final ProjectsData projectsData = new ProjectsData();
    MockUser mockUser = new MockUser("user", null) {

        @Override
        public ProjectsData getProjectsData(IDEFacade ideFacade) {
            return projectsData;
        }
    };
    mockUser.setOnline(true);
    myMockUserListComponent.setSelectedNodes(new User[] { mockUser });
    myFacadeMock.expects(once()).method("showMessage");
    myCommand.execute();
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData) IDEFacade(jetbrains.communicator.ide.IDEFacade) MockUser(jetbrains.communicator.mock.MockUser)

Example 7 with ProjectsData

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

the class ProjectsDataTest method testSerializeDeserialize.

public void testSerializeDeserialize() throws Exception {
    myProjectsData.setProjectFiles("project1", new VFile[] { VFile.create("a path") });
    myProjectsData.setProjectFiles("project2", new VFile[0]);
    ProjectsData userStatus1 = new ProjectsData(myProjectsData.serialize());
    assertEquals(2, userStatus1.getProjects().length);
    assertEquals(1, userStatus1.getProjectFiles("project1").length);
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 8 with ProjectsData

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

the class IDEAFacade method getProjectsData.

@Override
public ProjectsData getProjectsData() {
    final ProjectsData result = new ProjectsData();
    ApplicationManager.getApplication().runReadAction(() -> {
        try {
            new ProjectsDataFiller(result).fillProjectsData();
        } catch (Throwable e) {
            LOG.info(e, e);
        }
    });
    return result;
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 9 with ProjectsData

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

the class ViewFilesCommandTest method testExecute_WithInformation.

public void testExecute_WithInformation() throws Exception {
    final ProjectsData projectsData = new ProjectsData();
    projectsData.addNonProjectFile(VFile.create("a path"));
    MockUser mockUser = new MockUser("user", null) {

        @Override
        public ProjectsData getProjectsData(IDEFacade ideFacade) {
            return projectsData;
        }
    };
    mockUser.setOnline(true);
    myMockUserListComponent.setSelectedNodes(new User[] { mockUser });
    myFacadeMock.expects(once()).method("showUserFiles").with(eq(mockUser), eq(projectsData));
    myCommand.execute();
}
Also used : ProjectsData(jetbrains.communicator.core.vfs.ProjectsData) IDEFacade(jetbrains.communicator.ide.IDEFacade) MockUser(jetbrains.communicator.mock.MockUser)

Example 10 with ProjectsData

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

the class AbstractTransportTestCase method testGetUserStatus.

public void testGetUserStatus() throws Exception {
    User someone = createAnotherOnlineUser();
    myUserModel.addUser(mySelf);
    myUserModel.addUser(someone);
    mySelf.setCanAccessMyFiles(true, myUserModel);
    someone.setCanAccessMyFiles(true, myUserModel);
    ProjectsData projectsData = someone.getProjectsData(myIdeFacade);
    assertSame("No self status yet", ProjectsData.NULL, projectsData);
    myIdeFacade.setReturnedProjects(new String[] { "project1" });
    assert mySelf.isOnline();
    ProjectsData status = mySelf.getProjectsData(myIdeFacade);
    assertNotSame("Real status is expected", ProjectsData.NULL, status);
    assertEquals("A project is expected in the status", 1, status.getProjects().length);
    assertEquals("Wrong project returned", "project1", status.getProjects()[0]);
}
Also used : User(jetbrains.communicator.core.users.User) ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Aggregations

ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)17 IDEFacade (jetbrains.communicator.ide.IDEFacade)3 MockUser (jetbrains.communicator.mock.MockUser)3 User (jetbrains.communicator.core.users.User)2 Semaphore (java.util.concurrent.Semaphore)1 GetProjectsDataXmlMessage (jetbrains.communicator.core.transport.GetProjectsDataXmlMessage)1 CanceledException (jetbrains.communicator.ide.CanceledException)1 Element (org.jdom.Element)1