View Javadoc

1   /*
2    * $Id: XmppChatSyncTestCase.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  import org.jivesoftware.smack.packet.Message.Type;
17  
18  public class XmppChatSyncTestCase extends XmppMessageSyncTestCase
19  {
20      @Override
21      protected String getXmppConfigResources()
22      {
23          return "xmpp-chat-sync-config.xml";
24      }
25  
26      @Override
27      public void testRequestSync() throws Exception
28      {
29          doTestRequest("xmpp://CHAT/mule2@localhost?exchangePattern=request-response");
30      }
31  
32      @Override
33      protected Type expectedXmppMessageType()
34      {
35          return Message.Type.chat;
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  }