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))));
}
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());
}
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());
}
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();
}
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");
}
Aggregations