日期:2014-05-18 浏览次数:20732 次
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:property-placeholder location="classpath:jdbc.properties" />
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${driverClassName}" />
<property name="jdbcUrl" value="${url}" />
<property name="user" value="${username}" />
<property name="password" value="${password}" />
</bean>
<bean id="dblog" class="com.essp.uas.dao.db.DBLog">
<property name="dataSource" ref="dataSource"></property>
</bean>
</beans>
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/uas?useUnicode=true&characterEncoding=utf-8
username=root
password=
initialSize=1
maxActive=10
maxIdle=2
minIdle=1
package com.essp.uas.test;
import java.sql.Types;
import javax.annotation.Resource;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.essp.uas.dao.ILog;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( { "/applicationContext-db.xml" })
public class DBTestUnit {
@Resource
private ILog log;
@Before
public void init() {
}
@After
public void destory() {
}
@Test
public void testMidifyLdapAttrbute() {