use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UsersTreeModelTest method testRebuildTreeOnOnlineStatusChange.
public void testRebuildTreeOnOnlineStatusChange() throws Exception {
myTree.expandRow(2);
myTree.expandRow(1);
assertEquals("All expanded, root node is hidden", 8, myTree.getRowCount());
// rename user aaa
MockUser mockUser = ((MockUser) myUserModel.getUsers("group1")[1]);
mockUser.setOnline(true);
getBroadcaster().fireEvent(new UserEvent.Online(mockUser));
assertEquals("Nodes expansion should be preserved", 8, myTree.getRowCount());
assertEquals("Online user should go to the top", "ccc", getUserForRow(myTree, 2).getDisplayName());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testGetPort.
public void testGetPort() throws Exception {
User mockUser = UserImpl.create("mock", P2PTransport.CODE);
assertEquals("Sanity check", -1, myTransport.getPort(mockUser));
new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread()).addOnlineUser("localhost", "mock", 3354, null, null);
myTransport.flushCurrentUsers();
assertEquals("Port should be set from available online user", 3354, myTransport.getPort(mockUser));
myTransport.setOnlineUsers(new HashSet<>());
assertEquals("Port should be reset", -1, myTransport.getPort(mockUser));
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testGetUserPresence.
public void testGetUserPresence() throws Exception {
User mockUser = UserImpl.create("mock", P2PTransport.CODE);
assertEquals("Sanity check", PresenceMode.UNAVAILABLE, myTransport.getUserPresence(mockUser).getPresenceMode());
new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread()).addOnlineUser("localhost", "mock", 3354, null, new UserPresence(PresenceMode.DND).toVector());
myTransport.flushCurrentUsers();
assertEquals("User status should be set from available online user", PresenceMode.DND, myTransport.getUserPresence(mockUser).getPresenceMode());
myTransport.setOnlineUsers(new HashSet<>());
assertEquals("Presence should be reset", PresenceMode.UNAVAILABLE, myTransport.getUserPresence(mockUser).getPresenceMode());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testOnUserAdd.
public void testOnUserAdd() throws Exception {
User mockUser = UserImpl.create("user", myTransport.getName());
getBroadcaster().fireEvent(new UserEvent.Added(mockUser));
assertEquals("Should send notification", "sendUserAddedCallback" + mockUser, myLog);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testGetProjects.
public void testGetProjects() throws Exception {
User mockUser = UserImpl.create("mock", P2PTransport.CODE);
assertEquals("Sanity check", 0, myTransport.getProjects(mockUser).length);
Vector<String> projects = new Vector<>(Arrays.asList("project1", "project2"));
new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread()).addOnlineUser("localhost", "mock", 0, projects, null);
myTransport.flushCurrentUsers();
assertEquals("Projects should be set from available online user", projects.toString(), Arrays.asList(myTransport.getProjects(mockUser)).toString());
myTransport.setOnlineUsers(new HashSet<>());
assertEquals("Projects should be reset", 0, myTransport.getProjects(mockUser).length);
}
Aggregations