Search in sources :

Example 16 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class ToggleFileAccessCommandTest method testEnableAccessToGroup.

public void testEnableAccessToGroup() throws Exception {
    MockUser enabled = new MockUser("enabled", "group");
    enabled.setCanAccessMyFiles(true, myUserModel);
    MockUser disabled = new MockUser("disabled", "group");
    disabled.setCanAccessMyFiles(false, myUserModel);
    myUserModel.addUser(enabled);
    myUserModel.addUser(disabled);
    myUserListComponent.stubs().method("getSelectedNodes").will(returnValue(new Object[] { "group" }));
    myCommand.execute();
    assertTrue("Should change access to disabled", disabled.canAccessMyFiles());
    assertFalse("Should change access to enabled", enabled.canAccessMyFiles());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 17 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class FindUsersCommandTest method testOnlySelfFound.

public void testOnlySelfFound() throws Exception {
    final BaseUserImpl self = new MockUser();
    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[] { self }));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[] { self }));
    myCommand.execute();
    assertTrue(myIDEFacade.getAndClearLog().startsWith("showMessage"));
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) BaseUserImpl(jetbrains.communicator.core.impl.users.BaseUserImpl) MockUser(jetbrains.communicator.mock.MockUser)

Example 18 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class UserListComponentTest method testGetSelectedNodes.

public void testGetSelectedNodes() throws Exception {
    myUserModel.addGroup("a group");
    MockUser user = new MockUser("user", "group");
    myUserModel.addUser(user);
    JTree jTree = getTree();
    jTree.expandRow(1);
    jTree.setSelectionInterval(0, 2);
    Object[] selectedNodes = myUserListComponent.getSelectedNodes();
    assertEquals("a group", selectedNodes[0]);
    assertEquals("group", selectedNodes[1]);
    assertEquals(user, selectedNodes[2]);
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 19 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class UserListComponentTest method testSaveLoadTreeState.

public void testSaveLoadTreeState() throws Exception {
    myUserModel.addUser(new MockUser("user1", "group"));
    myUserModel.addUser(new MockUser("user2", "group"));
    myUserModel.addGroup("daaa");
    myUserModel.addUser(new MockUser("user3", "zzzz"));
    TreeUtils.collapseAll(getTree());
    getTree().expandRow(1);
    assertEquals("Sanity check", 5, getTree().getRowCount());
    myUserListComponent.saveState();
    myUserListComponent = new UserListComponentImpl(myUserModel, myIdeFacade, myLocalMessageDispatcher);
    disposeOnTearDown(myUserListComponent);
    assertEquals("Tree state should be restored", 5, getTree().getRowCount());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 20 with MockUser

use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.

the class AsyncMessageDispatcherTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myIdeFacade = new MockIDEFacade(getClass());
    myUser = new MockUser("user", null);
    myUser.setOnline(true);
    myDispatcher = new AsyncMessageDispatcherImpl(getBroadcaster(), myIdeFacade);
    new WaitFor(1000) {

        @Override
        protected boolean condition() {
            return myDispatcher.isRunning();
        }
    };
    myLog = new String[] { "" };
}
Also used : WaitFor(jetbrains.communicator.util.WaitFor) MockIDEFacade(jetbrains.communicator.mock.MockIDEFacade) MockUser(jetbrains.communicator.mock.MockUser)

Aggregations

MockUser (jetbrains.communicator.mock.MockUser)55 User (jetbrains.communicator.core.users.User)13 VFile (jetbrains.communicator.core.vfs.VFile)5 IDEFacade (jetbrains.communicator.ide.IDEFacade)5 MockIDEFacade (jetbrains.communicator.mock.MockIDEFacade)4 AddOnlineUserP2PCommand (jetbrains.communicator.p2p.commands.AddOnlineUserP2PCommand)4 TreeNode (javax.swing.tree.TreeNode)3 CodePointer (jetbrains.communicator.core.vfs.CodePointer)3 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)3 EventBroadcaster (jetbrains.communicator.core.EventBroadcaster)2 BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)2 UserModelImpl (jetbrains.communicator.core.impl.users.UserModelImpl)2 UserEvent (jetbrains.communicator.core.users.UserEvent)2 WaitFor (jetbrains.communicator.util.WaitFor)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Vector (java.util.Vector)1 TreePath (javax.swing.tree.TreePath)1 LocalMessageDispatcherImpl (jetbrains.communicator.core.impl.dispatcher.LocalMessageDispatcherImpl)1 MockMessage (jetbrains.communicator.mock.MockMessage)1