Package com.calclab.emite.xtesting.handlers

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


    return room;
  }

  @Test
  public void shouldAddOccupantAndFireListeners() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler();
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/user");
    final Occupant occupant = room.setOccupantPresence(userURI, occupantUri, "aff", "role", Show.unknown, null);
    assertTrue(handler.isCalledOnce());
    final Occupant result = room.getOccupantByOccupantUri(occupantUri);
    assertEquals(occupant, result);
  }
View Full Code Here


    assertEquals("the subject", handler.getLastEvent().getSubject());
  }

  @Test
  public void shouldRemoveOccupant() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler("removed");
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/name");
    room.setOccupantPresence(userURI, occupantUri, "owner", "participant", Show.notSpecified, null);
    assertEquals(1, room.getOccupantsCount());
    room.removeOccupant(occupantUri);
    assertEquals(0, room.getOccupantsCount());
    assertEquals(1, handler.getCalledTimes());
    assertNull(room.getOccupantByOccupantUri(occupantUri));
  }
View Full Code Here

    assertTrue(handler.isCalledOnce());
  }

  @Test
  public void shouldUpdateOccupantAndFireListeners() {
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler("modified");
    room.addOccupantChangedHandler(handler);
    final XmppURI occupantUri = uri("room@domain/name");
    final Occupant occupant = room.setOccupantPresence(userURI, occupantUri, "owner", "participant", Show.notSpecified, null);
    final Occupant occupant2 = room.setOccupantPresence(userURI, occupantUri, "admin", "moderator", Show.notSpecified, null);
    assertEquals(1, handler.getCalledTimes());
    assertSame(occupant, occupant2);
  }
View Full Code Here

  }

  @Test
  public void shouldIgnoreLetterCaseInURIS() {
    final RoomChat room = manager.open(uri("ROOM@domain/nick"));
    final OccupantChangedTestHandler handler = new OccupantChangedTestHandler();
    room.addOccupantChangedHandler(handler);
    session.receives("<presence to='user@domain/resource' xmlns='jabber:client' from='ROom@domain/otherUser'>"
        + "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='moderator' affiliation='owner' jid='user@domain' /></x></presence>");
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

TOP

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

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.