1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.plugin;
17
18 import org.junit.Test;
19 import org.kuali.rice.core.api.config.property.ConfigContext;
20 import org.kuali.rice.core.api.util.ClasspathOrFileResourceLoader;
21 import org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;
22 import org.kuali.rice.kew.test.KEWTestCase;
23
24 import java.util.List;
25
26 import static org.junit.Assert.assertEquals;
27 import static org.junit.Assert.assertNotNull;
28
29
30
31
32
33
34 public class PluginConfigParserTest extends KEWTestCase {
35
36 private PluginConfigParser parser = new PluginConfigParser();
37 private static final String CONFIG_PATH = "classpath:org/kuali/rice/kew/plugin/workflow.xml";
38
39 @Test public void testParse() throws Exception {
40
41 PluginConfig plugin = parser.parse(new ClasspathOrFileResourceLoader().getResource(CONFIG_PATH).getFile(), ConfigContext.getCurrentContextConfig());
42 assertNotNull(plugin);
43
44 List listeners = plugin.getListeners();
45 assertNotNull(listeners);
46 assertEquals(2, listeners.size());
47 String listenerClassName1 = (String)listeners.get(0);
48 String listenerClassName2 = (String)listeners.get(1);
49 assertEquals("org.kuali.rice.kew.plugin.TestPluginListener", listenerClassName1);
50 assertEquals("org.kuali.rice.kew.plugin.TestPluginListener2", listenerClassName2);
51
52 assertEquals("Plugin resource loader classname should be base resource loader", BaseResourceLoader.class.getName(), plugin.getResourceLoaderClassname());
53 }
54
55 }