1   /*
2    * $Id: NestedRouterTestCase.java 11583 2008-04-17 08:26:02Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.routing.nested;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class NestedRouterTestCase extends FunctionalTestCase
18  {
19      private static final int RECEIVE_TIMEOUT = 7000;
20  
21      private static final int number = 0xC0DE;
22  
23      protected String getConfigResources()
24      {
25          return "org/mule/test/integration/routing/nested/nestedrouter-test.xml";
26      }
27  
28      private void internalTest(String prefix) throws Exception
29      {
30          MuleClient client = new MuleClient();
31          String message = "Mule";
32          client.dispatch(prefix + "invoker.in", message, null);
33          MuleMessage reply = client.request(prefix + "invoker.out", RECEIVE_TIMEOUT);
34          assertNotNull(reply);
35          assertNull(reply.getExceptionPayload());
36          assertEquals("Received: Hello " + message + " " + number, reply.getPayload());
37      }
38  
39      public void testNestedRouter() throws Exception
40      {
41          internalTest("vm://");
42      }
43  
44      public void testJmsQueueNestedRouter() throws Exception
45      {
46          internalTest("jms://");
47      }
48  
49      public void testJmsTopicNestedRouter() throws Exception
50      {
51          internalTest("jms://topic:t");
52      }
53  }