use of jetbrains.communicator.mock.MockMessage 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.MockMessage in project intellij-plugins by JetBrains.
the class AbstractMessageDispatcherTest method testSendMessageToOnlineUser.
public void testSendMessageToOnlineUser() throws Exception {
MockMessage message = new MockMessage(true);
myDispatcher.performDispatch(myUser, message);
assertEquals("should send to online user", "sent to " + myUser + ":success", message.getLog());
}
use of jetbrains.communicator.mock.MockMessage 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.MockMessage 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.MockMessage in project intellij-plugins by JetBrains.
the class LocalMessageDispatcherTest method testIconBlinkingStatus.
public void testIconBlinkingStatus() throws Exception {
assertFalse(hasMessagesWhichRequireIconBlinking());
MockMessage message = new MockMessage();
myDispatcher.addPendingMessage(myUser, message);
assertEquals(1, myDispatcher.getPendingMessages(myUser).length);
assertTrue("Should blink to inform user about urgent event", hasMessagesWhichRequireIconBlinking());
myDispatcher.sendNow(myUser, message);
assertFalse("No more blinking expected - message was dispatched", hasMessagesWhichRequireIconBlinking());
}
Aggregations