Ejemplo n.º 1
0
 @Test
 public void shouldStartStateNegotiationOnce() {
   chat.send(new Message("message1"));
   chat.send(new Message("message2"));
   session.verifySent("<message><body>message1</body><active /></message>");
   session.verifySent("<message><body>message2</body></message>");
   session.verifyNotSent("<message><body>message2</body><active /></message>");
 }
Ejemplo n.º 2
0
 @Test
 public void shouldStartStateNegotiation() {
   chat.send(new Message("test message"));
   chat.send(new Message("test message"));
   session.verifySent(
       "<message><active xmlns='http://jabber.org/protocol/chatstates' /></message>");
 }
Ejemplo n.º 3
0
 @Test
 public void shouldSendActiveIfTheOtherStartNegotiation() {
   session.receives(
       "<message from='other@domain/other' to='self@domain/res' type='chat'>"
           + "<active xmlns='http://jabber.org/protocol/chatstates'/></message>");
   session.verifySent(
       "<message from='self@domain/res' to='other@domain/other' type='chat'>"
           + "<active xmlns='http://jabber.org/protocol/chatstates'/></message>");
 }
Ejemplo n.º 4
0
 @Test
 public void shouldSendStateIfNegotiationAccepted() {
   session.receives(
       "<message from='other@domain/other' to='self@domain/res' type='chat'>"
           + "<active xmlns='http://jabber.org/protocol/chatstates'/></message>");
   chatStateManager.setOwnState(ChatState.composing);
   session.verifySent(
       "<message from='self@domain/res' to='other@domain/other' type='chat'>"
           + "<composing xmlns='http://jabber.org/protocol/chatstates'/></message>");
 }
Ejemplo n.º 5
0
 @Test
 public void shouldStopAfterGone() {
   session.receives(
       "<message from='other@domain/other' to='self@domain/res' type='chat'><active /></message>");
   session.receives(
       "<message from='other@domain/other' to='self@domain/res' type='chat'><gone /></message>");
   chatStateManager.setOwnState(ChatStateManager.ChatState.composing);
   chatStateManager.setOwnState(ChatStateManager.ChatState.pause);
   session.verifySent("<message><active /></message>");
   session.verifyNotSent("<message><composing /></message>");
   session.verifyNotSent("<message><pause /></message>");
   session.verifyNotSent("<message><gone /></message>");
 }
Ejemplo n.º 6
0
 @Test
 public void shouldStartStateAfterNegotiation() {
   chat.send(new Message("test message"));
   session.receives(
       "<message from='other@domain/other' to='self@domain/res' type='chat'>"
           + "<active xmlns='http://jabber.org/protocol/chatstates'/></message>");
   final Message message = new Message(MYSELF, OTHER, "test message");
   message.addChild(ChatStateManager.ChatState.active.toString(), ChatStateManager.XMLNS);
   chatStateManager.setOwnState(ChatStateManager.ChatState.composing);
   session.verifySent(
       message.toString()
           + "<message from='self@domain/res' to='other@domain/other' type='chat'>"
           + "<composing xmlns='http://jabber.org/protocol/chatstates'/></message>");
 }