Package jetbrains.communicator.mock

Examples of jetbrains.communicator.mock.MockMessage


  private boolean hasMessagesWhichRequireIconBlinking() {
    return myDispatcher.getBlinkingIcon() != null;
  }

  public void testAddPendingMessage() throws Exception {
    MockMessage message = new MockMessage();
    myDispatcher.addPendingMessage(myUser, message);

    assertEquals(1, myDispatcher.getPendingMessages(myUser).length);
    assertSame(message, myDispatcher.getPendingMessages(myUser)[0]);
View Full Code Here


  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"){});
View Full Code Here

  }

  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));
View Full Code Here

    assertSame(localMessage, history[0]);
    assertSame(localMessage1, history[1]);
  }

  public void testPersistency() throws Exception {
    myDispatcher.addPendingMessage(myUser, new MockMessage());
    assertEquals("Should have no problems with nulls", 1, myDispatcher.getPendingMessages(myUser).length);

    // test persistency
    LocalMessageDispatcherImpl localMessageDispatcher = createLocalMessageDispatcher();
    assertEquals(1, localMessageDispatcher.getPendingMessages(myUser).length);
View Full Code Here

  }

  public void testHistory() throws Exception {
    assertEquals(0, myDispatcher.getHistory(myUser, null).length);

    MockMessage message = new MockMessage();
    myDispatcher.addPendingMessage(myUser, message);

    assertEquals(1, myDispatcher.getPendingMessages(myUser).length);
    assertEquals(0, myDispatcher.getHistory(myUser, null).length);

    myDispatcher.sendNow(myUser, message);

    assertEquals(0, myDispatcher.getPendingMessages(myUser).length);
    assertEquals(1, myDispatcher.getHistory(myUser, null).length);

    MockMessage message2 = new MockMessage();
    myDispatcher.sendNow(myUser, message2);

    LocalMessage[] history = myDispatcher.getHistory(myUser, null);
    assertEquals(2, history.length);
    assertSame(message, history[0]);
View Full Code Here

    assertSame(message, history[0]);
    assertSame(message2, history[1]);
  }

  public void testHistoryWithDate() throws Exception {
    MockMessage message = new MockMessage();
    myDispatcher.sendNow(myUser, message);

    Thread.sleep(10);
    assertEquals(1, myDispatcher.getHistory(myUser, a_moment_ago()).length);
    assertEquals("Do not expect old history", 0, myDispatcher.getHistory(myUser, new Date()).length);
View Full Code Here

  }

  public void testClearHistory() throws Exception {
    assertTrue(myDispatcher.isHistoryEmpty());

    MockMessage message = new MockMessage();
    myDispatcher.sendNow(myUser, message);
    myDispatcher.clearHistory();

    assertEquals(0, myDispatcher.getHistory(myUser, null).length);
  }
View Full Code Here

    assertEquals(0, myDispatcher.getHistory(myUser, null).length);
  }

  public void testHistoryPersistence() throws Exception {
    // Test Saving history message:
    MockMessage message = new MockMessage(new Date(), "some text \u0420\u041f \u0422\u0425\u0423\u0423\u041b\u0419");
    myDispatcher.sendNow(myUser, message);

    Thread.sleep(SAVE_WAIT_TIMEOUT);

    LocalMessageDispatcherImpl localMessageDispatcher = createLocalMessageDispatcher();
View Full Code Here

    assertEquals("some text \u0420\u041f \u0422\u0425\u0423\u0423\u041b\u0419",
                 ((MockMessage) localMessageDispatcher.getHistory(myUser, null)[0]).getMessage());
  }

  public void testHistoryPersistence_SortLoadedHistory() throws Exception {
    myDispatcher.sendNow(myUser, new MockMessage(yesterday(), "someText"));

    MockMessage message = new MockMessage();
    myDispatcher.sendNow(myUser, message);

    Thread.sleep(SAVE_WAIT_TIMEOUT);

    LocalMessageDispatcherImpl localMessageDispatcher = createLocalMessageDispatcher();
View Full Code Here

    disposeOnTearDown(localMessageDispatcher);
    return localMessageDispatcher;
  }

  public void testHistoryInSeveralFiles() throws Exception {
    myDispatcher.sendNow(myUser, new MockMessage(new Date()));
    myDispatcher.sendNow(myUser, new MockMessage(yesterday()));

    Thread.sleep(SAVE_WAIT_TIMEOUT);
    assertEquals(2, new File(myIdeFacade.getCacheDir(), "history").listFiles().length);

    LocalMessageDispatcherImpl localMessageDispatcher = createLocalMessageDispatcher();
View Full Code Here

TOP

Related Classes of jetbrains.communicator.mock.MockMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.