Search in sources :

Example 6 with MockUser

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

the class AbstractMessageDispatcherTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myIdeFacade = new MockIDEFacade(getClass());
    myDispatcher = createDispatcher();
    myUser = new MockUser("user", null);
    myUser.setOnline(true);
}
Also used : MockIDEFacade(jetbrains.communicator.mock.MockIDEFacade) MockUser(jetbrains.communicator.mock.MockUser)

Example 7 with MockUser

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

the class DeleteCommandTest method testDeleteUser.

public void testDeleteUser() throws Exception {
    MockUser user = new MockUser();
    myUserModel.addUser(user);
    myUserListComponentMock.expects(once()).method("getSelectedNodes").will(returnValue(new Object[] { user }));
    myIDEFacade.expects(once()).method("askQuestion").will(returnValue(true));
    myCommand.execute();
    assertEquals("User should be deleted", 0, myUserModel.getAllUsers().length);
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 8 with MockUser

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

the class DeleteCommandTest method testMessages_WithUsersInDeletedGroups.

public void testMessages_WithUsersInDeletedGroups() throws Exception {
    myUserModel.addUser(new MockUser("userName", "aGroup"));
    assertMessage("group \"aGroup\" with its 1 user", new Object[] { "aGroup" });
    assertMessage("groups \"aGroup\"(1 user) and \"group2\"", new Object[] { "aGroup", "group2" });
    myUserModel.addUser(new MockUser("userName1", "aGroup"));
    assertMessage("group \"aGroup\" with its 2 users", new Object[] { "aGroup" });
    assertMessage("groups \"aGroup\"(2 users) and \"group2\"", new Object[] { "aGroup", "group2" });
    assertMessage("group \"aGroup\"(2 users) and user Some Another User", new Object[] { "aGroup", new MockUser("Some Another User", null) });
}
Also used : MockUser(jetbrains.communicator.mock.MockUser)

Example 9 with MockUser

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

the class DeleteCommandTest method assertMessage.

private void assertMessage(String msg, int users, int emptyGroups) throws UnknownHostException {
    List nodes = new ArrayList();
    for (int i = 0; i < users; i++) {
        MockUser u = new MockUser("user" + i, "");
        u.setDisplayName("User " + i, myUserModel);
        nodes.add(u);
    }
    for (int i = 0; i < emptyGroups; i++) {
        nodes.add("group" + i);
    }
    Object[] selectedNodes = nodes.toArray(new Object[nodes.size()]);
    assertMessage(msg, selectedNodes);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) MockUser(jetbrains.communicator.mock.MockUser)

Example 10 with MockUser

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

the class FindUsersCommandTest method testUsersFromDifferentTransportsFound.

public void testUsersFromDifferentTransportsFound() throws Exception {
    final BaseUserImpl teddy = new MockUser("teddy", "");
    final BaseUserImpl sashka = new MockUser("sashka", "");
    myTransportMock.expects(once()).method("findUsers").will(returnValue(new User[] { teddy }));
    myTransportMock1.expects(once()).method("findUsers").will(returnValue(new User[] { sashka }));
    myUserModelMock.expects(once()).method("getGroups").will(returnValue(null));
    myUserModelMock.expects(once()).method("hasUser").with(eq(teddy)).will(returnValue(false));
    myUserModelMock.expects(once()).method("hasUser").with(eq(sashka)).will(returnValue(false));
    myCommand.execute();
}
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)

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