View Javadoc

1   /*
2    * $Id: XmppChatAsyncTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.xmpp;
12  
13  import org.mule.transport.xmpp.JabberSender.Callback;
14  
15  import org.jivesoftware.smack.packet.Message;
16  
17  public class XmppChatAsyncTestCase extends XmppMessageAsyncTestCase
18  {
19      @Override
20      protected String getXmppConfigResources()
21      {
22          return "xmpp-chat-async-config.xml";
23      }
24      
25      @Override
26      protected Message.Type expectedXmppMessageType()
27      {
28          return Message.Type.chat;
29      }
30  
31      @Override
32      protected void assertXmppMessage(Message message)
33      {
34          assertEquals(Message.Type.chat, message.getType());
35          assertEquals(TEST_MESSAGE, message.getBody());
36      }
37      
38      @Override
39      protected void sendJabberMessageFromNewThread()
40      {
41          JabberSender sender = new JabberSender(new Callback()
42          {
43              public void doit() throws Exception
44              {
45                  Thread.sleep(JABBER_SEND_THREAD_SLEEP_TIME);
46                  jabberClient.sendChatMessage(muleJabberUserId, TEST_MESSAGE);
47              }
48          });
49          startSendThread(sender);
50      }
51  }