1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.config;
12
13 import static org.junit.Assert.assertEquals;
14 import static org.junit.Assert.assertFalse;
15 import static org.junit.Assert.assertNotNull;
16 import static org.junit.Assert.assertTrue;
17
18 import org.mule.api.construct.FlowConstruct;
19 import org.mule.exception.DefaultMessagingExceptionStrategy;
20 import org.mule.tck.AbstractServiceAndFlowTestCase;
21
22 import java.util.Arrays;
23 import java.util.Collection;
24
25 import org.junit.Test;
26 import org.junit.runners.Parameterized.Parameters;
27
28 public class ExceptionStrategyConfigTestCase extends AbstractServiceAndFlowTestCase
29 {
30 public ExceptionStrategyConfigTestCase(ConfigVariant variant, String configResources)
31 {
32 super(variant, configResources);
33 }
34
35 @Parameters
36 public static Collection<Object[]> parameters()
37 {
38 return Arrays.asList(new Object[][]{
39 {ConfigVariant.SERVICE, "org/mule/test/exceptions/exception-strategy-config-service.xml"},
40 {ConfigVariant.FLOW, "org/mule/test/exceptions/exception-strategy-config-flow.xml"}
41 });
42 }
43
44 @Test
45 public void testConfig() throws Exception
46 {
47 FlowConstruct service = muleContext.getRegistry().lookupFlowConstruct("testService1");
48 assertNotNull(service);
49 assertNotNull(service.getExceptionListener());
50 assertTrue(service.getExceptionListener() instanceof DefaultMessagingExceptionStrategy);
51
52 DefaultMessagingExceptionStrategy es = (DefaultMessagingExceptionStrategy)service.getExceptionListener();
53 assertFalse(es.isEnableNotifications());
54 assertNotNull(es.getCommitTxFilter());
55 assertEquals("java.io.*", es.getCommitTxFilter().getPattern());
56
57 assertNotNull(es.getRollbackTxFilter());
58 assertEquals("org.mule.*, javax.*", es.getRollbackTxFilter().getPattern());
59 }
60 }