⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basedaotestcase.java

📁 this is for appfuse1.8 source using strut 1.x, spring and hibernate.
💻 JAVA
字号:
package org.appfuse.dao;import java.util.Enumeration;import java.util.HashMap;import java.util.Map;import java.util.MissingResourceException;import java.util.ResourceBundle;import org.apache.commons.beanutils.BeanUtils;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.springframework.test.AbstractDependencyInjectionSpringContextTests;/** * Base class for running DAO tests. * @author mraible */public abstract class BaseDAOTestCase extends AbstractDependencyInjectionSpringContextTests {    protected final Log log = LogFactory.getLog(getClass());    protected ResourceBundle rb;        protected String[] getConfigLocations() {        return new String [] {"classpath*:/**/dao/applicationContext-*.xml",                              "classpath*:META-INF/applicationContext-*.xml"};    }        public BaseDAOTestCase() {        // Since a ResourceBundle is not required for each class, just        // do a simple check to see if one exists        String className = this.getClass().getName();        try {            rb = ResourceBundle.getBundle(className);        } catch (MissingResourceException mre) {            //log.warn("No resource bundle found for: " + className);        }    }        /**     * Utility method to populate a javabean-style object with values     * from a Properties file     * @param obj     * @return     * @throws Exception     */    protected Object populate(Object obj) throws Exception {        // loop through all the beans methods and set its properties from        // its .properties file        Map map = new HashMap();        for (Enumeration keys = rb.getKeys(); keys.hasMoreElements();) {            String key = (String) keys.nextElement();            map.put(key, rb.getString(key));        }        BeanUtils.copyProperties(obj, map);        return obj;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -