View Javadoc

1   /*
2    * Copyright 2006-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.rice.kew.plugin;
18  
19  import static org.junit.Assert.assertEquals;
20  import static org.junit.Assert.assertNotNull;
21  
22  import java.io.File;
23  import java.util.List;
24  
25  import org.junit.Test;
26  import org.kuali.rice.core.api.config.property.ConfigContext;
27  import org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;
28  import org.kuali.rice.kew.test.KEWTestCase;
29  
30  
31  /**
32   * Tests that the PluginConfigParser properly parses the plugin config xml file.
33   * 
34   * @author Kuali Rice Team (rice.collab@kuali.org)
35   */
36  public class PluginConfigParserTest extends KEWTestCase {
37  
38      private PluginConfigParser parser = new PluginConfigParser();
39      private static final String CONFIG_PATH_SUFFIX = "/src/test/resources/org/kuali/rice/kew/plugin/workflow.xml";
40      
41      @Test public void testParse() throws Exception {
42      	
43          PluginConfig plugin = parser.parse(new File(getBaseDir() + CONFIG_PATH_SUFFIX), ConfigContext.getCurrentContextConfig());
44          assertNotNull(plugin);
45  
46          List listeners = plugin.getListeners();
47          assertNotNull(listeners);
48          assertEquals(2, listeners.size());
49          String listenerClassName1 = (String)listeners.get(0);
50          String listenerClassName2 = (String)listeners.get(1);
51          assertEquals("org.kuali.rice.kew.plugin.TestPluginListener", listenerClassName1);
52          assertEquals("org.kuali.rice.kew.plugin.TestPluginListener2", listenerClassName2);
53  
54          assertEquals("Plugin resource loader classname should be base resource loader", BaseResourceLoader.class.getName(), plugin.getResourceLoaderClassname());
55      }
56  
57  }