View Javadoc

1   /*
2    * $Id: JmsTemporaryReplyToTestCase.java 22497 2011-07-21 12:12:26Z dfeist $
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 static org.junit.Assert.assertEquals;
14  
15  import org.mule.api.MuleException;
16  import org.mule.api.MuleMessage;
17  import org.mule.module.client.MuleClient;
18  import org.mule.transport.NullPayload;
19  
20  import org.junit.Test;
21  
22  /**
23   * TODO this test does not use the Test scenarios, I think it would need a new Method
24   * sendAndReceive It might make sense to leave this test as is because it tests that
25   * the client also works with ReplyTo correctly
26   */
27  public class JmsTemporaryReplyToTestCase extends AbstractJmsFunctionalTestCase
28  {
29  
30      @Override
31      protected String getConfigResources()
32      {
33          return "integration/jms-temporary-replyTo.xml";
34      }
35      
36      @Test
37      public void testTemporaryReplyEnabledSync() throws MuleException
38      {
39          MuleClient muleClient = new MuleClient(muleContext);
40          MuleMessage response = muleClient.send("vm://in1Sync", TEST_MESSAGE, null);
41          assertEquals(TEST_MESSAGE + " TestService1", response.getPayload());
42      }
43  
44      @Test
45      public void testTemporaryReplyDisabledSync() throws MuleException
46      {
47          MuleClient muleClient = new MuleClient(muleContext);
48          MuleMessage response = muleClient.send("vm://in2Sync", TEST_MESSAGE, null);
49          assertEquals(TEST_MESSAGE, response.getPayload());
50      }    
51      
52      @Test
53      public void testDisableTemporaryReplyOnTheConnector() throws MuleException
54      {
55          MuleClient muleClient = new MuleClient(muleContext);
56          MuleMessage response = muleClient.send("vm://in3", TEST_MESSAGE, null);
57          
58          assertEquals(NullPayload.getInstance(), response.getPayload());
59      }
60  
61      @Test
62      public void testExplicitReplyToAsyncSet() throws MuleException
63      {
64          MuleClient muleClient = new MuleClient(muleContext);
65          MuleMessage response = muleClient.send("vm://in4", TEST_MESSAGE, null);
66          // We get the original message back, not the result from the remote component
67          assertEquals(TEST_MESSAGE + " TestService1", response.getPayload());
68      }
69  }