Package com.calclab.emite.im.roster

Examples of com.calclab.emite.im.roster.RosterGroup


  private RosterGroup group;

  @Before
  public void setup() {
    eventBus = new SimpleEventBus();
    group = new RosterGroup(eventBus, "myGroup");
    group.add(RosterItemHelper.createItem("test3@test", "test3", false, "myGroup"));
    group.add(RosterItemHelper.createItem("test2@test", "test2", true, "myGroup"));
    group.add(RosterItemHelper.createItem("test1@test", "test1", false, "myGroup"));
  }
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  @Test
  public void shouldOrderAvailabiltyAndGroupAndName() {
    final RosterGroup myGroup = new RosterGroup(eventBus, "myGroup");
    myGroup.add(RosterItemHelper.createItem("test2@test", "test2", true, "myGroup"));
    myGroup.add(RosterItemHelper.createItem("test1@test", "test1", false, "other"));
    myGroup.add(RosterItemHelper.createItem("test3@test", "test3", true));
    final Comparator<RosterItem> order = RosterItemsOrder.order(RosterItemsOrder.byAvailability, RosterItemsOrder.groupedFirst, RosterItemsOrder.byName);
    final ArrayList<RosterItem> list = myGroup.getItemList(order);
    // available and grouped
    assertEquals("test2", list.get(0).getName());
    // available
    assertEquals("test3", list.get(1).getName());
    // not available
View Full Code Here

  }

  @Test
  public void shouldOrderByGroupedFirst() {
    final RosterGroup myGroup = new RosterGroup(eventBus, "myGroup");
    myGroup.add(RosterItemHelper.createItem("test2@test", "test2", false));
    myGroup.add(RosterItemHelper.createItem("test1@test", "test1", false, "other"));
    myGroup.add(RosterItemHelper.createItem("test3@test", "test3", false, "myGroup"));
    final RosterItem firstItemNotSorted = myGroup.getItemList(null).get(0);
    assertFalse("test3".equals(firstItemNotSorted.getName()));
    final RosterItem firstItemSorted = myGroup.getItemList(RosterItemsOrder.groupedFirst).get(0);
    assertEquals("test3", firstItemSorted.getName());
  }
View Full Code Here

  @Test
  public void shouldFireChangedItemEventsInGroups() {
    final RosterItem item = newItem("other@domain");
    item.addToGroup("simple");
    setRosterItems(session, item);
    final RosterGroup group = roster.getRosterGroup("simple");
    final RosterItemChangedTestHandler handler = new RosterItemChangedTestHandler();
    group.addRosterItemChangedHandler(handler);
    assertNotNull(group);
    session.receives("<presence from='other@domain'>" + "<show>dnd</show><status>message</status><priority>3</priority></presence>");
    assertTrue(handler.hasEvent());
  }
View Full Code Here

TOP

Related Classes of com.calclab.emite.im.roster.RosterGroup

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.