Search in sources :

Example 6 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class UserMonitorThread_WaitingForNextSearch_Test method expectSetOneOnlineUser.

private void expectSetOneOnlineUser() throws UnknownHostException {
    User p2PUser = UserImpl.create("nick", P2PTransport.CODE);
    List<String> projects = new ArrayList<>();
    projects.add("project1");
    OnlineUserInfo onlineUserInfo = new OnlineUserInfo(InetAddress.getByName("localhost"), PORT, projects, new UserPresence(PresenceMode.AWAY));
    myUserMonitorClientMock.expects(once()).method("createUser").with(eq("nick"), eq(onlineUserInfo)).will(returnValue(p2PUser));
    myUserMonitorThread.addOnlineUser("localhost", "nick", new Integer(PORT), projects, new UserPresence(PresenceMode.AWAY));
    myUserMonitorClientMock.expects(once()).method("setOnlineUsers").with(eq(new HashSet(Arrays.asList(p2PUser))));
}
Also used : User(jetbrains.communicator.core.users.User) UserPresence(jetbrains.communicator.core.users.UserPresence)

Example 7 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class JabberTransport_ConnectionTest method testLocalChanges_UpdateRoster.

public void testLocalChanges_UpdateRoster() throws Throwable {
    addEventListener();
    addUserFred();
    User user = myUserModel.getAllUsers()[0];
    final Roster roster = myFacade.getConnection().getRoster();
    // Change group:
    user.setGroup("someOtherGroup", myUserModel);
    new WaitFor(TIMEOUT) {

        @Override
        protected boolean condition() {
            return roster.getGroupCount() == 1 && roster.getGroup("someOtherGroup") != null;
        }
    };
    assertEquals("One group expected", 1, roster.getGroupCount());
    RosterGroup group = roster.getGroup("someOtherGroup");
    assertNotNull(group);
    assertEquals(1, group.getEntryCount());
    assertNotNull(group.getEntry(FRED));
    // Change Display name:
    user.setDisplayName("Some new name", myUserModel);
    new WaitFor(TIMEOUT) {

        @Override
        protected boolean condition() {
            return "Some new name".equals(roster.getEntry(FRED).getName());
        }
    };
    assertEquals("User name in Roster should have changed", "Some new name", roster.getEntry(FRED).getName());
    // Delete user:
    myUserModel.removeUser(user);
    new WaitFor(TIMEOUT) {

        @Override
        protected boolean condition() {
            return roster.getEntryCount() == 0;
        }
    };
    assertEquals("User should be removed from Roster", 0, roster.getEntryCount());
}
Also used : User(jetbrains.communicator.core.users.User) WaitFor(jetbrains.communicator.util.WaitFor)

Example 8 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class UsersTreeModelTest method testUserNameChanged.

public void testUserNameChanged() throws Exception {
    final User user = myUserModel.getAllUsers()[0];
    assertEquals("aaa", user.getName());
    TreePath path = new TreePath(new DefaultMutableTreeNode(user));
    myUsersTreeModel.valueForPathChanged(path, "new name");
    assertEquals("new name", user.getDisplayName());
}
Also used : MockUser(jetbrains.communicator.mock.MockUser) User(jetbrains.communicator.core.users.User) TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 9 with User

use of jetbrains.communicator.core.users.User 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)

Example 10 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class SendMessageCommandTest method testSendMessage.

public void testSendMessage() throws Exception {
    addEventListener();
    final User user = UserImpl.create("user", MockTransport.NAME);
    doTest("message1", new User[] { user });
    verifySendMessageLocalEvent(user, "message1");
}
Also used : User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser)

Aggregations

User (jetbrains.communicator.core.users.User)64 MockUser (jetbrains.communicator.mock.MockUser)25 UserPresence (jetbrains.communicator.core.users.UserPresence)6 ArrayList (java.util.ArrayList)5 UserEvent (jetbrains.communicator.core.users.UserEvent)5 TreeNode (javax.swing.tree.TreeNode)4 BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)4 MockTransport (jetbrains.communicator.mock.MockTransport)4 WaitFor (jetbrains.communicator.util.WaitFor)4 Project (com.intellij.openapi.project.Project)3 TreePath (javax.swing.tree.TreePath)3 IOException (java.io.IOException)2 URL (java.net.URL)2 List (java.util.List)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)2 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)2 Message (jetbrains.communicator.core.dispatcher.Message)2 Transport (jetbrains.communicator.core.transport.Transport)2 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)2