1
2
3
4
5
6
7
8
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 AsynchronousMessagingExceptionStrategyTestCase extends AbstractExceptionStrategyTestCase
18 {
19 @Override
20 protected String getConfigResources()
21 {
22 return "org/mule/test/integration/exceptions/asynch-messaging-exception-strategy.xml";
23 }
24
25 public void testInboundTransformer() throws Exception
26 {
27 client.dispatch("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.dispatch("vm://in2", TEST_MESSAGE, null);
36 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
37
38 assertEquals(0, serviceExceptionCounter.get());
39 assertEquals(0, systemExceptionCounter.get());
40 }
41
42 public void testOutboundTransformer() throws Exception
43 {
44 client.dispatch("vm://in3", TEST_MESSAGE, null);
45 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
46 assertEquals(1, serviceExceptionCounter.get());
47 assertEquals(0, systemExceptionCounter.get());
48 MuleMessage response = client.request("vm://out3", 500);
49 assertNull(response);
50 }
51
52 public void testOutboundResponseTransformer() throws Exception
53 {
54 client.dispatch("vm://in4", TEST_MESSAGE, null);
55 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
56
57 assertEquals(0, serviceExceptionCounter.get());
58 assertEquals(0, systemExceptionCounter.get());
59 MuleMessage response = client.request("vm://out4", 500);
60 assertNotNull(response);
61 }
62
63 public void testComponent() throws Exception
64 {
65 client.dispatch("vm://in5", TEST_MESSAGE, null);
66 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
67 assertEquals(1, serviceExceptionCounter.get());
68 assertEquals(0, systemExceptionCounter.get());
69 }
70
71 public void testInboundRouter() throws Exception
72 {
73 client.dispatch("vm://in6", TEST_MESSAGE, null);
74 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
75 assertEquals(1, serviceExceptionCounter.get());
76 assertEquals(0, systemExceptionCounter.get());
77 }
78
79 public void testOutboundRouter() throws Exception
80 {
81 client.dispatch("vm://in7", TEST_MESSAGE, null);
82 latch.await(LATCH_AWAIT_TIMEOUT, TimeUnit.MILLISECONDS);
83 assertEquals(1, serviceExceptionCounter.get());
84 assertEquals(0, systemExceptionCounter.get());
85 MuleMessage response = client.request("vm://out7", 500);
86 assertNull(response);
87 }
88 }
89
90