use of jetbrains.communicator.core.users.UserPresence in project intellij-plugins by JetBrains.
the class UserMonitorThreadTest method testAddRemoteUser_LoopbackAddress.
public void testAddRemoteUser_LoopbackAddress() throws Exception {
Pico.setUnitTest(false);
try {
myUserMonitorClientMock.expects(once()).method("setOnlineUsers").with(eq(new HashSet()));
myUserMonitorThread.addOnlineUser("localhost", "nick", new Integer(PORT), new HashSet<>(), new UserPresence(PresenceMode.AWAY));
myUserMonitorThread.flushOnlineUsers();
} finally {
Pico.setUnitTest(true);
}
}
use of jetbrains.communicator.core.users.UserPresence 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.UserPresence in project intellij-plugins by JetBrains.
the class UserTest method testIsOnline.
public void testIsOnline() throws Exception {
assertFalse(myUser.isOnline());
final MockTransport mockTransport = new MockTransport() {
@Override
public UserPresence getUserPresence(User user) {
return new UserPresence(true);
}
};
Pico.getInstance().registerComponentInstance(mockTransport);
myUser = UserImpl.create("someUser", MockTransport.NAME);
assertTrue("Corresponding transport is created - should be online now", myUser.isOnline());
}
use of jetbrains.communicator.core.users.UserPresence in project intellij-plugins by JetBrains.
the class JabberFacadeImpl method setOnlinePresence.
public void setOnlinePresence(UserPresence userPresence) {
final Presence.Mode mode;
String status = "";
PresenceMode presenceMode = userPresence.getPresenceMode();
switch(presenceMode) {
case AWAY:
mode = Presence.Mode.away;
break;
case EXTENDED_AWAY:
mode = Presence.Mode.xa;
break;
case DND:
mode = Presence.Mode.dnd;
break;
default:
mode = Presence.Mode.available;
}
Presence presence = new Presence(Presence.Type.available, status, 0, mode);
myConnection.sendPacket(presence);
}
use of jetbrains.communicator.core.users.UserPresence in project intellij-plugins by JetBrains.
the class UserMonitorThreadTest 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))));
}
Aggregations