View Javadoc

1   /**
2    * Copyright 2005-2013 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  package org.kuali.rice.kew.plugin;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  import java.io.File;
22  import java.util.List;
23  
24  import org.junit.Test;
25  import org.kuali.rice.core.api.config.property.ConfigContext;
26  import org.kuali.rice.core.framework.resourceloader.BaseResourceLoader;
27  import org.kuali.rice.kew.test.KEWTestCase;
28  
29  
30  /**
31   * Tests that the PluginConfigParser properly parses the plugin config xml file.
32   * 
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  public class PluginConfigParserTest extends KEWTestCase {
36  
37      private PluginConfigParser parser = new PluginConfigParser();
38      private static final String CONFIG_PATH_SUFFIX = "/src/test/resources/org/kuali/rice/kew/plugin/workflow.xml";
39      
40      @Test public void testParse() throws Exception {
41      	
42          PluginConfig plugin = parser.parse(new File(getBaseDir() + CONFIG_PATH_SUFFIX), ConfigContext.getCurrentContextConfig());
43          assertNotNull(plugin);
44  
45          List listeners = plugin.getListeners();
46          assertNotNull(listeners);
47          assertEquals(2, listeners.size());
48          String listenerClassName1 = (String)listeners.get(0);
49          String listenerClassName2 = (String)listeners.get(1);
50          assertEquals("org.kuali.rice.kew.plugin.TestPluginListener", listenerClassName1);
51          assertEquals("org.kuali.rice.kew.plugin.TestPluginListener2", listenerClassName2);
52  
53          assertEquals("Plugin resource loader classname should be base resource loader", BaseResourceLoader.class.getName(), plugin.getResourceLoaderClassname());
54      }
55  
56  }