View Javadoc

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