View Javadoc

1   /*
2    * $Id: MessageVersionCompatibilityTestCase.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.test.integration.message;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  /**
18   * Test case for EE-1820
19   */
20  public class MessageVersionCompatibilityTestCase extends FunctionalTestCase
21  {
22      private int TIMEOUT = 5000;
23      @Override
24      protected String getConfigResources()
25      {
26          return "org/mule/test/integration/messaging/message-version-compatibility.xml";
27      }
28  
29      public void testOldToOld() throws Exception
30      {
31          MuleClient client = new MuleClient(muleContext);
32          client.dispatch("vm://in1", "test", null);
33  
34          MuleMessage reply = client.request("vm://out1", TIMEOUT);
35          assertNotNull(reply);
36          assertEquals("test", reply.getPayload());
37      }
38  
39      public void testOldToNew() throws Exception
40      {
41          MuleClient client = new MuleClient(muleContext);
42          client.dispatch("vm://in2", "test", null);
43  
44          MuleMessage reply = client.request("vm://out2", TIMEOUT);
45          assertNotNull(reply);
46          assertEquals("test", reply.getPayload());
47      }
48  
49      public void testNewToOld() throws Exception
50      {
51          MuleClient client = new MuleClient(muleContext);
52          client.dispatch("vm://in3", "test", null);
53  
54          MuleMessage reply = client.request("vm://out3", TIMEOUT);
55          // No output is received because the receiver throws an exception:
56          // "java.lang.IllegalArgumentException: Session variable ... is malfomed and cannot be read"
57          assertNull(reply);
58      }
59      
60      public void testNewToNew() throws Exception
61      {
62          MuleClient client = new MuleClient(muleContext);
63          client.dispatch("vm://in4", "test", null);
64  
65          MuleMessage reply = client.request("vm://out4", TIMEOUT);
66          assertNotNull(reply);
67          assertEquals("test", reply.getPayload());
68      }
69  }