use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class UsersTreeModel_OnlyOfflineShownTest method testOfflineUserWithMessage.
public void testOfflineUserWithMessage() throws Exception {
myTree.expandRow(2);
myTree.expandRow(1);
myIDEFacade.setReturnedMessage(new MockMessage());
getBroadcaster().fireEvent(EventFactory.createMessageEvent(new MockTransport(), myUserModel.getUsers("group1")[0].getName(), "text"));
TreeUtil.expandAll(myTree);
assertEquals("Should include user with pending local message", 5, myTree.getRowCount());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class UserListComponentTest method testExpandGroupMessageReceived.
public void testExpandGroupMessageReceived() throws Exception {
MockTransport transport = new MockTransport();
User user = UserImpl.create("nick", transport.getName());
user.setGroup("some non-default group", myUserModel);
myUserModel.addUser(user);
TreeUtils.collapseAll(getTree());
assertEquals("Sanity check", 1, getTree().getRowCount());
myBroadcaster.fireEvent(new TransportEvent(transport, "nick") {
});
assertEquals("User group should be expanded to show incoming message icon", 2, getTree().getRowCount());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class LocalMessageDispatcherTest method testSendMessageEvent.
public void testSendMessageEvent() throws Exception {
MockTransport mockTransport = new MockTransport();
MockMessage localMessage = new MockMessage();
MockMessage localMessage1 = new MockMessage();
myIdeFacade.setReturnedMessage(localMessage);
getBroadcaster().fireEvent(new SendMessageEvent("text", myUser));
myIdeFacade.setReturnedMessage(localMessage1);
getBroadcaster().fireEvent(new SendMessageEvent("text", myUser));
LocalMessage[] history = myDispatcher.getHistory(myUser, null);
assertEquals("Expect localMessages as a result to OwnMessageEvent", 2, history.length);
assertSame(localMessage, history[0]);
assertSame(localMessage1, history[1]);
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class LocalMessageDispatcherTest method testTransportEvent.
public void testTransportEvent() throws Exception {
MockTransport mockTransport = new MockTransport();
MockMessage localMessage = new MockMessage();
MockMessage localMessage1 = new MockMessage();
myIdeFacade.setReturnedMessage(localMessage);
getBroadcaster().fireEvent(new TransportEvent(mockTransport, "user") {
});
myIdeFacade.setReturnedMessage(localMessage1);
getBroadcaster().fireEvent(new TransportEvent(mockTransport, "user") {
});
Message[] pendingMessages = myDispatcher.getPendingMessages(myUser);
assertEquals("Expect a local localMessages as a result to TransportEvent", 2, pendingMessages.length);
assertSame(localMessage, pendingMessages[0]);
assertSame(localMessage1, pendingMessages[1]);
assertEquals("", localMessage.getLog());
}
use of jetbrains.communicator.mock.MockTransport in project intellij-plugins by JetBrains.
the class UserModelImplTest method testStacktrace.
public void testStacktrace() throws Exception {
int hadUsers = myUserModel.getAllUsers().length;
getBroadcaster().fireEvent(EventFactory.createStacktraceEvent(new MockTransport(), "aaaaaa", "statcktrace", "comment"));
assertEquals("Another user should be added", hadUsers + 1, myUserModel.getAllUsers().length);
User addedUser = myUserModel.getAllUsers()[0];
assertEquals("aaaaaa", addedUser.getName());
}
Aggregations