1
2
3
4
5
6
7
8
9
10
11 package org.mule.impl.config.builders;
12
13 import org.mule.api.MuleContext;
14 import org.mule.api.config.ConfigurationBuilder;
15 import org.mule.api.config.ConfigurationException;
16 import org.mule.api.context.MuleContextFactory;
17 import org.mule.api.exception.MessagingExceptionHandler;
18 import org.mule.api.lifecycle.InitialisationException;
19 import org.mule.config.builders.AutoConfigurationBuilder;
20 import org.mule.config.builders.SimpleConfigurationBuilder;
21 import org.mule.context.DefaultMuleContextFactory;
22 import org.mule.tck.junit4.AbstractMuleContextTestCase;
23 import org.mule.tck.testmodels.mule.TestExceptionStrategy;
24
25 import org.junit.Test;
26
27 import static org.junit.Assert.assertNotNull;
28 import static org.junit.Assert.assertTrue;
29
30 public class AutoConfigurationBuilderTestCase extends AbstractMuleContextTestCase
31 {
32
33 protected MuleContext createMuleContext() throws Exception
34 {
35 MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
36 return muleContextFactory.createMuleContext(new SimpleConfigurationBuilder(null));
37 }
38
39 @Test
40 public void testConfigureSpring() throws ConfigurationException, InitialisationException
41 {
42 ConfigurationBuilder configurationBuilder = new AutoConfigurationBuilder(
43 "org/mule/test/spring/config1/test-xml-mule2-config.xml");
44 configurationBuilder.configure(muleContext);
45
46
47 MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
48 assertNotNull(es);
49 assertTrue(es instanceof TestExceptionStrategy);
50 }
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 }