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.jms.integration;
8   
9   import org.mule.tck.testmodels.fruit.Apple;
10  
11  import java.awt.Color;
12  import java.io.Serializable;
13  
14  import org.junit.Test;
15  
16  /**
17   * Message is sent to and received from simple queue.
18   */
19  public class JmsQueueMessageTypesTestCase extends AbstractJmsFunctionalTestCase
20  {
21      protected String getConfigResources()
22      {
23          return "integration/jms-queue-message-types.xml";
24      }
25  
26      @Test
27      public void testTextMessage() throws Exception
28      {
29          dispatchMessage("TEST MESSAGE");
30          receiveMessage("TEST MESSAGE");
31          receive(scenarioNotReceive);
32      }
33  
34      @Test
35      public void testNumberMessage() throws Exception
36      {
37          dispatchMessage(25.75);
38          receiveMessage(25.75);
39          receive(scenarioNotReceive);
40      }
41  
42      @Test
43      public void testBinaryMessage() throws Exception
44      {
45          byte[] bytes = new byte[] {'\u0000', '\u007F', '\u0033', '\u007F', '\u0055'};
46          dispatchMessage(bytes);
47          receiveMessage(bytes);
48          receive(scenarioNotReceive);
49      }
50  
51      @Test
52      public void testJdkObjectMessage() throws Exception
53      {
54          Serializable obj = new Color(0);
55          dispatchMessage(obj);
56          receiveMessage(obj);
57          receive(scenarioNotReceive);
58      }
59  
60      @Test
61      public void testCustomObjectMessage() throws Exception
62      {
63          Serializable obj = new Apple();
64          dispatchMessage(obj);
65          receiveMessage(obj);
66          receive(scenarioNotReceive);
67      }
68  
69  }