View Javadoc

1   /*
2    * $Id: XmppFunctionalTestCase.java 22449 2011-07-19 07:40:43Z justin.calleja $
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 static org.junit.Assert.assertFalse;
14  import static org.junit.Assert.assertNotNull;
15  
16  import java.util.Arrays;
17  import java.util.Collection;
18  
19  import org.junit.Test;
20  import org.junit.runners.Parameterized.Parameters;
21  import org.mule.api.MuleMessage;
22  import org.mule.module.client.MuleClient;
23  import org.mule.transport.NullPayload;
24  
25  public class XmppFunctionalTestCase extends XmppEnableDisableTestCase
26  {
27      
28      public XmppFunctionalTestCase(ConfigVariant variant, String configResources)
29      {
30          super(variant, configResources);
31      }
32  
33      @Parameters
34      public static Collection<Object[]> parameters()
35      {
36          return Arrays.asList(new Object[][]{
37              {ConfigVariant.SERVICE, AbstractXmppTestCase.COMMON_CONFIG + "," + "xmpp-functional-config-service.xml"},
38              {ConfigVariant.FLOW, AbstractXmppTestCase.COMMON_CONFIG + "," + "xmpp-functional-config-flow.xml"}
39          });
40      }
41  
42  //    @Test
43  //    public void testDispatchNormalMessage() throws Exception
44  //    {
45  //        MuleClient client = new MuleClient(muleContext);
46  //        Map<String, String> messageProperties = new HashMap<String, String>();
47  //        messageProperties.put(XmppConnector.XMPP_SUBJECT, "da subject");
48  //        client.dispatch("vm://in", TEST_MESSAGE, messageProperties);
49  //        
50  //        Thread.sleep(10000);
51  //    }
52      
53  //    @Test
54  //    public void testSendNormalMessage() throws Exception
55  //    {
56  //        MuleClient client = new MuleClient(muleContext);
57  //        MuleMessage result = client.send("vm://in", TEST_MESSAGE, null);
58  //        assertNotNull(result);
59  //        assertFalse(result.getPayload() instanceof NullPayload);
60  //    }
61  
62  //    @Test
63  //    public void testDispatchChat() throws Exception
64  //    {
65  //        MuleClient client = new MuleClient(muleContext);
66  //        client.dispatch("vm://in", TEST_MESSAGE, null);
67  //
68  //        Thread.sleep(10000);
69  //    }
70  
71      @Test
72      public void testSendChat() throws Exception
73      {
74          MuleClient client = new MuleClient(muleContext);
75          MuleMessage result = client.send("vm://in", TEST_MESSAGE, null);
76          assertNotNull(result);
77          assertFalse(result.getPayload() instanceof NullPayload);
78      }
79  }