1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.jbpm;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.api.client.MuleClient;
15 import org.mule.api.transformer.TransformerException;
16 import org.mule.tck.FunctionalTestCase;
17 import org.mule.tck.exceptions.FunctionalTestException;
18 import org.mule.util.ExceptionUtils;
19
20 public class MessagingExceptionComponentTestCase extends FunctionalTestCase
21 {
22 protected String getConfigResources()
23 {
24 return "jbpm-component-functional-test.xml";
25 }
26
27 public void testNoException() throws Exception
28 {
29 MuleClient client = muleContext.getClient();
30 client.send("vm://exception", "testNoException", null);
31
32
33 assertNotNull(client.request("vm://queueC", 1000));
34 assertNotNull(client.request("vm://queueD", 1000));
35 }
36
37 public void testExceptionInService() throws Exception
38 {
39 MuleClient client = muleContext.getClient();
40
41 MuleMessage response = client.send("vm://exception", "testExceptionInService", null);
42 assertNotNull("Should have thrown an exception", response.getExceptionPayload());
43 assertTrue(ExceptionUtils.getRootCause(response.getExceptionPayload().getException()) instanceof FunctionalTestException);
44
45
46 assertNotNull(client.request("vm://queueC", 1000));
47 assertNull(client.request("vm://queueD", 1000));
48 }
49
50 public void testExceptionInTransformer() throws Exception
51 {
52 MuleClient client = muleContext.getClient();
53
54 MuleMessage response = client.send("vm://exception", "testExceptionInTransformer", null);
55 assertNotNull("Should have thrown an exception", response.getExceptionPayload());
56 assertTrue(ExceptionUtils.getRootCause(response.getExceptionPayload().getException()) instanceof TransformerException);
57
58
59 assertNotNull(client.request("vm://queueC", 1000));
60 assertNull(client.request("vm://queueD", 1000));
61 }
62 }