View Javadoc

1   /*
2    * $Id: SynchronousMessagingExceptionStrategyTestCase.java 19692 2010-09-21 23:50:35Z aperepel $
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.exceptions;
12  
13  import org.mule.api.MuleMessage;
14  
15  import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
16  
17  public class SynchronousMessagingExceptionStrategyTestCase extends AbstractExceptionStrategyTestCase
18  {
19      @Override
20      protected String getConfigResources()
21      {
22          return "org/mule/test/integration/exceptions/synch-messaging-exception-strategy.xml";
23      }
24  
25      public void testInboundTransformer() throws Exception
26      {
27          client.send("vm://in1", TEST_MESSAGE, null);
28          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
29          assertEquals(1, serviceExceptionCounter.get());
30          assertEquals(0, systemExceptionCounter.get());
31      }
32      
33      public void testInboundResponseTransformer() throws Exception
34      {
35          client.send("vm://in2", TEST_MESSAGE, null);
36          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
37          assertEquals(1, serviceExceptionCounter.get());
38          assertEquals(0, systemExceptionCounter.get());
39      }
40      
41      public void testOutboundTransformer() throws Exception
42      {
43          client.send("vm://in3", TEST_MESSAGE, null);
44          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
45          assertEquals(1, serviceExceptionCounter.get());
46          assertEquals(0, systemExceptionCounter.get());
47          MuleMessage response = client.request("vm://out3", 500);
48          assertNull(response);
49      }
50      
51      public void testOutboundResponseTransformer() throws Exception
52      {
53          client.send("vm://in4", TEST_MESSAGE, null);
54          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
55          assertEquals(1, serviceExceptionCounter.get());
56          assertEquals(0, systemExceptionCounter.get());
57          MuleMessage response = client.request("vm://out4", 500);
58          assertNull(response);
59      }
60      
61      public void testComponent() throws Exception
62      {
63          client.send("vm://in5", TEST_MESSAGE, null);
64          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
65          assertEquals(1, serviceExceptionCounter.get());
66          assertEquals(0, systemExceptionCounter.get());
67      }
68  
69      public void testInboundRouter() throws Exception
70      {
71          client.send("vm://in6", TEST_MESSAGE, null);
72          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
73          assertEquals(1, serviceExceptionCounter.get());
74          assertEquals(0, systemExceptionCounter.get());
75      }
76      
77      public void testOutboundRouter() throws Exception
78      {
79          client.send("vm://in7", TEST_MESSAGE, null);
80          latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS); 
81          assertEquals(1, serviceExceptionCounter.get());
82          assertEquals(0, systemExceptionCounter.get());
83          MuleMessage response = client.request("vm://out7", 500);
84          assertNull(response);
85      }    
86  }
87  
88