Package com.calclab.emite.xtesting.handlers

Examples of com.calclab.emite.xtesting.handlers.RoomChatChangedTestHandler


    manager = new RoomChatManagerImpl(new SimpleEventBus(), session, new RoomChatSelectionStrategy());
  }

  @Test
  public void shouldAcceptInvitations() {
    final RoomChatChangedTestHandler handler = new RoomChatChangedTestHandler();
    final ChatProperties properties = new ChatProperties(USER);
    manager.addRoomChatChangedHandler(handler);
    final RoomInvitation invitation = new RoomInvitation(uri("friend@host/resource"), uri("room@room.service"), "theReason", properties);
    manager.acceptRoomInvitation(invitation);
    assertEquals(2, handler.getCalledTimes());
    assertEquals(ChangeType.created, handler.getEvent(0).getChangeType());
    assertEquals(ChangeType.opened, handler.getEvent(1).getChangeType());
  }
View Full Code Here


*/
public class RoomManagerTest extends AbstractChatManagerTest<RoomChatManager, RoomChat> {

  @Test
  public void shouldAcceptInvitations() {
    final RoomChatChangedTestHandler chatCreatedHandler = new RoomChatChangedTestHandler(ChangeType.created);
    manager.addRoomChatChangedHandler(chatCreatedHandler);

    final String reason = "theReason";
    final XmppURI invitor = uri("friend@host/resource");
    final XmppURI roomURI = uri("room@room.service");
    manager.acceptRoomInvitation(new RoomInvitation(invitor, roomURI, reason));
    assertTrue(chatCreatedHandler.isCalledOnce());
    final RoomChat room = chatCreatedHandler.getLastChat();
    assertEquals("room@room.service/self", room.getURI().toString());
  }
View Full Code Here

   * Test to ensure that when an invitation is received, the resulting chat
   * created has the same data properties.
   */
  @Test
  public void shouldPreserveInvitationProperties() {
    final RoomChatChangedTestHandler chatCreatedHandler = new RoomChatChangedTestHandler(ChangeType.created);
    manager.addRoomChatChangedHandler(chatCreatedHandler);

    final String reason = "theReason";
    final XmppURI invitor = uri("friend@host/resource");
    final XmppURI roomURI = uri("room@room.service");
    final ChatProperties properties = new ChatProperties(roomURI);
    final String testDataKey = "TEST_KEY";
    final String testDataValue = "TEST_VALUE";
    properties.setData(testDataKey, testDataValue);
    manager.acceptRoomInvitation(new RoomInvitation(invitor, roomURI, reason, properties));
    final RoomChat room = chatCreatedHandler.getLastChat();
    assertEquals("Chat property not preserved", testDataValue, room.getProperties().getData(testDataKey));
  }
View Full Code Here

  }
 
  @Test
  public void shouldEventWhenAChatIsClosed() {
    final RoomChat chat = manager.open(uri("other@domain/resource"));
    final RoomChatChangedTestHandler handler = new RoomChatChangedTestHandler(ChangeType.closed);
    manager.addRoomChatChangedHandler(handler);
    manager.close(chat);
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

    assertTrue(handler.isCalledOnce());
  }

  @Test
  public void shouldEventWhenChatCreated() {
    final RoomChatChangedTestHandler handler = new RoomChatChangedTestHandler(ChangeType.created);
    manager.addRoomChatChangedHandler(handler);
    manager.open(OTHER);
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.xtesting.handlers.RoomChatChangedTestHandler

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.