use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class AsyncMessageDispatcherTest method testAddMessagesWhileDispatching.
public void testAddMessagesWhileDispatching() throws Exception {
NotifyableMessage mockMessage = new NotifyableMessage(true, myLog);
MockUser user1 = new MockUser("user1", null);
MockUser user2 = new MockUser("user2", null);
user1.setOnline(true);
user2.setOnline(true);
myDispatcher.sendLater(user1, mockMessage);
mockMessage.waitUntilDispatchingStarted();
myDispatcher.sendLater(user2, new MockMessage(true));
assertEquals("Messages not delivered yet", 2, myDispatcher.getUsersWithMessages().length);
triggerMessageProcessing(mockMessage);
new WaitFor(200) {
@Override
protected boolean condition() {
return myDispatcher.getUsersWithMessages().length == 0;
}
};
assertEquals("All messages should be delivered", 0, myDispatcher.getUsersWithMessages().length);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FoundUsersModelTest method testUserIn2Groups.
public void testUserIn2Groups() throws Exception {
MockUser bob = new MockUser("BobName", null);
bob.setProjects(new String[] { "bobProject", "anotherBobProject" });
FoundUsersModel model = createModel(Arrays.asList(new User[] { bob }));
assertEquals("2 projects expected", 2, getRoot(model).getChildCount());
TreeNode projectNode1 = getRoot(model).getChildAt(0);
assertEquals("Invalid project node", "anotherBobProject", projectNode1.toString());
TreeNode projectNode2 = getRoot(model).getChildAt(1);
assertEquals("Invalid project node", "bobProject", projectNode2.toString());
assertEquals("One user in group expected", 1, projectNode1.getChildCount());
assertEquals("One user in group expected", 1, projectNode2.getChildCount());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FoundUsersModelTest method test2UsersInSameGroup.
public void test2UsersInSameGroup() throws Exception {
MockUser bob = new MockUser("bob", null);
MockUser alice = new MockUser("alice", null);
bob.setProjects(new String[] { "Project" });
alice.setProjects(new String[] { "Project" });
FoundUsersModel model = createModel(Arrays.asList(new User[] { bob, alice }));
assertEquals("One project expected", 1, getRoot(model).getChildCount());
assertEquals("Two users expected", 2, getRoot(model).getChildAt(0).getChildCount());
assertEquals("Wrong sorting of users", "alice", getRoot(model).getChildAt(0).getChildAt(0).toString());
assertEquals("Wrong sorting of users", "bob", getRoot(model).getChildAt(0).getChildAt(1).toString());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class FoundUsersModelTest method testUserInProject.
public void testUserInProject() throws Exception {
MockUser bob = new MockUser("BobName", null);
bob.setProjects(new String[] { "bobProject" });
FoundUsersModel model = createModel(Arrays.asList(new User[] { bob }));
assertEquals("One project expected", 1, getRoot(model).getChildCount());
TreeNode projectNode = getRoot(model).getChildAt(0);
assertEquals("Invalid project node", "bobProject", projectNode.toString());
assertEquals("One user in group expected", 1, projectNode.getChildCount());
assertEquals("Invalid user node", bob.getName(), projectNode.getChildAt(0).toString());
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class PersistentUserModelImplTest method testPersistUser.
public void testPersistUser() throws Exception {
myUserModel.addUser(new MockUser("user", "group"));
PersistentUserModelImpl modelInstance = createModelInstance();
User[] users = modelInstance.getAllUsers();
assertEquals(1, users.length);
assertEquals("user", users[0].getName());
assertEquals("group", users[0].getGroup());
}
Aggregations