Search in sources :

Example 1 with TransportEvent

use of jetbrains.communicator.core.transport.TransportEvent 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());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) User(jetbrains.communicator.core.users.User) MockUser(jetbrains.communicator.mock.MockUser) MockTransport(jetbrains.communicator.mock.MockTransport)

Example 2 with TransportEvent

use of jetbrains.communicator.core.transport.TransportEvent in project intellij-plugins by JetBrains.

the class IDEAFacadeTest method testCreateLocalMessage_IncomingMessage.

public void testCreateLocalMessage_IncomingMessage() throws Exception {
    TransportEvent event = EventFactory.createMessageEvent(myTransport, "user", "comment123");
    Date when = new Date();
    event.setWhen(when.getTime());
    LocalMessage localMessage = myFacade.createLocalMessageForIncomingEvent(event);
    assertTrue("instance of Stacktracelocalmessage expected:" + localMessage.getClass().getName(), localMessage instanceof IncomingLocalMessage);
    assertEquals("comment123", ((BaseLocalMessage) localMessage).getComment());
    assertEquals(when, localMessage.getWhen());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) Date(java.util.Date)

Example 3 with TransportEvent

use of jetbrains.communicator.core.transport.TransportEvent in project intellij-plugins by JetBrains.

the class IDEAFacadeTest method testCreateLocalMessage_Stacktrace.

public void testCreateLocalMessage_Stacktrace() throws Exception {
    TransportEvent event = EventFactory.createStacktraceEvent(myTransport, "user", "stacktrace", "comment123");
    LocalMessage localMessage = myFacade.createLocalMessageForIncomingEvent(event);
    assertTrue("instance of Stacktracelocalmessage expected", localMessage instanceof IncomingStacktraceMessage);
    assertEquals("comment123", ((BaseLocalMessage) localMessage).getComment());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingStacktraceMessage(jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)

Example 4 with TransportEvent

use of jetbrains.communicator.core.transport.TransportEvent 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());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) MockMessage(jetbrains.communicator.mock.MockMessage) Message(jetbrains.communicator.core.dispatcher.Message) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) MockTransport(jetbrains.communicator.mock.MockTransport) MockMessage(jetbrains.communicator.mock.MockMessage)

Example 5 with TransportEvent

use of jetbrains.communicator.core.transport.TransportEvent in project intellij-plugins by JetBrains.

the class IDEAFacadeTest method testCreateLocalMessage_CodeInterval.

public void testCreateLocalMessage_CodeInterval() throws Exception {
    TransportEvent event = EventFactory.createCodePointerEvent(myTransport, "user22", VFile.create("a path"), 0, 0, 1, 2, "some comment1");
    LocalMessage localMessage = myFacade.createLocalMessageForIncomingEvent(event);
    assertTrue("instance of IncomingCodePointerMessage expected:" + localMessage, localMessage instanceof IncomingCodePointerMessage);
    assertEquals("some comment1", ((BaseLocalMessage) localMessage).getComment());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingCodePointerMessage(jetbrains.communicator.idea.codePointer.IncomingCodePointerMessage)

Aggregations

TransportEvent (jetbrains.communicator.core.transport.TransportEvent)5 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)4 IncomingLocalMessage (jetbrains.communicator.idea.sendMessage.IncomingLocalMessage)3 MockTransport (jetbrains.communicator.mock.MockTransport)2 Date (java.util.Date)1 Message (jetbrains.communicator.core.dispatcher.Message)1 User (jetbrains.communicator.core.users.User)1 IncomingCodePointerMessage (jetbrains.communicator.idea.codePointer.IncomingCodePointerMessage)1 IncomingStacktraceMessage (jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)1 MockMessage (jetbrains.communicator.mock.MockMessage)1 MockUser (jetbrains.communicator.mock.MockUser)1