Package com.calclab.emite.xtesting.handlers

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


  @Test
  public void chatStateDontFireOnChatCreatedButMustAfterOpenChat() {
    final Message message = new Message(null, MYSELF, OTHER);
    message.getXML().addChild("gone", "http://jabber.org/protocol/chatstates");

    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    session.receives(message);
    assertTrue(handler.isNotCalled());
    manager.open(OTHER);
    assertTrue(handler.isCalled());
  }
View Full Code Here


    assertTrue(handler.isCalled());
  }

  @Test
  public void managerShouldCreateOneChatForSameResource() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    session.receives(new Message("message 1", MYSELF, uri("source@domain/resource1")));
    session.receives(new Message("message 2", MYSELF, uri("source@domain/resource1")));
    assertEquals(1, handler.getCalledTimes());
  }
View Full Code Here

    assertEquals(ChatStatus.ready, chat.getStatus());
  }

  @Test
  public void roomInvitationsShouldDontFireOnChatCreated() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    session.receives("<message to='" + MYSELF + "' from='someroom@domain'><x xmlns='http://jabber.org/protocol/muc#user'>" + "<invite from='" + OTHER
        + "'><reason>Join to our conversation</reason></invite>" + "</x><x jid='someroom@domain' xmlns='jabber:x:conference' /></message>");
    assertTrue(handler.isNotCalled());
  }
View Full Code Here

    assertTrue(handler.isNotCalled());
  }

  @Test
  public void roomInvitationsShouldDontFireOnChatCreatedButMustAfterOpenChat() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    session.receives("<message to='" + MYSELF + "' from='someroom@domain'><x xmlns='http://jabber.org/protocol/muc#user'>" + "<invite from='" + OTHER
        + "'><reason>Join to our conversation</reason></invite>" + "</x><x jid='someroom@domain' xmlns='jabber:x:conference' /></message>");
    assertTrue(handler.isNotCalled());
    manager.open(OTHER);
    assertTrue(handler.isCalled());
  }
View Full Code Here

  }

  @Test
  public void shouldReuseChatIfNotResouceSpecified() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    session.receives(new Message("message 1", MYSELF, uri("source@domain")));
    session.receives(new Message("message 2", MYSELF, uri("source@domain/resource1")));
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

    assertTrue(handler.isCalledOnce());
  }

  @Test
  public void shouldReuseChatWhenAnsweringWithDifferentResources() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    final PairChat chat = manager.open(uri("someone@domain"));
    assertTrue(handler.isCalledOnce());
    assertEquals(chat, handler.getLastChat());
    session.receives(new Message("answer", MYSELF, uri("someone@domain/resource")));
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

    session.receives(new Message("answer", MYSELF, uri("someone@domain/resource")));
    assertTrue(handler.isCalledOnce());
  }

  private PairChatChangedTestHandler addChatCreatedHandler() {
    final PairChatChangedTestHandler handler = new PairChatChangedTestHandler(ChangeType.created);
    manager.addPairChatChangedHandler(handler);
    return handler;
  }
View Full Code Here

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

    assertTrue(handler.isCalledOnce());
  }

  @Test
  public void shouldEventWhenChatCreated() {
    final PairChatChangedTestHandler handler = addChatCreatedHandler();
    manager.open(OTHER);
    assertTrue(handler.isCalledOnce());
  }
View Full Code Here

TOP

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

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.