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

📄 baseservicetest.java

📁 SSHMail Ajax方式提交,自动抓取页面内容,统计关键字个数.
💻 JAVA
字号:
package com.leo.dao;

import java.util.Date;

import junit.framework.TestCase;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.leo.service.IUserService;

/**
 * @author Superleo
 * 
 */
public class BaseServiceTest extends TestCase {

	/**
	 * 生成测试工厂
	 */
	protected static ApplicationContext factory;

	protected static String ID; // 在此只是申明 ID 赋值在 oneTimeSetUp() 后,否则报错

	protected Logger logger = Logger.getLogger(this.getClass());

	private Date date;

	private static final String APPLICATION_CONTEXT = "WebRoot\\WEB-INF\\applicationContext.xml";

	// private static final String SERVLET_CONTEXT =
	// "WebRoot\\WEB-INF\\servletContext.xml";

	protected void setUp() throws Exception {

		date = new Date();
		factory = new FileSystemXmlApplicationContext(
				new String[] { APPLICATION_CONTEXT });
		logger.info("测试启动开始,当前时间:" + date.toString()
				+ "...............................");

	}

	protected void tearDown() throws Exception {

		logger.info("测试正常结束,历时:"
				+ (System.currentTimeMillis() - date.getTime())
				+ " ms...............................");
	}

	/** ***************************************************************************** */

	public static IUserService getUserService() {
		return (IUserService) factory.getBean("userService");
	}

}

⌨️ 快捷键说明

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