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