1
2
3
4
5
6
7 package org.mule.module.bpm.config;
8
9 import org.mule.module.bpm.BPMS;
10 import org.mule.module.bpm.ProcessComponent;
11 import org.mule.module.bpm.test.TestBpms;
12 import org.mule.tck.junit4.FunctionalTestCase;
13
14 import org.junit.Test;
15
16 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.Assert.assertNull;
19
20
21
22
23
24 public class BpmNamespaceHandlerTestCase extends FunctionalTestCase
25 {
26
27 @Override
28 protected String getConfigResources()
29 {
30 return "bpm-namespace-config.xml";
31 }
32
33 @Test
34 public void testDefaultsComponent() throws Exception
35 {
36 ProcessComponent c = (ProcessComponent) muleContext.getRegistry().lookupService("Service1").getComponent();
37 assertNotNull(c);
38
39 assertEquals("test.def", c.getResource());
40 assertNull(c.getProcessIdField());
41
42
43 BPMS bpms = c.getBpms();
44 assertNotNull(bpms);
45 assertEquals(TestBpms.class, bpms.getClass());
46 assertEquals("bar", ((TestBpms) bpms).getFoo());
47 }
48
49 @Test
50 public void testConfigComponent() throws Exception
51 {
52 ProcessComponent c = (ProcessComponent) muleContext.getRegistry().lookupService("Service2").getComponent();
53 assertNotNull(c);
54
55 assertEquals("test.def", c.getResource());
56 assertEquals("myId", c.getProcessIdField());
57
58
59 BPMS bpms = c.getBpms();
60 assertNotNull(bpms);
61 assertEquals(TestBpms.class, bpms.getClass());
62 assertEquals("bar", ((TestBpms) bpms).getFoo());
63 }
64
65 }