Java單元測試之junit
在寫dao的時候,我們會對sql進行拼接,有時候sql在拼接過程中會出現錯誤,如果一個程式的執行時間比較長,一個sql拼接出現錯誤就需要重新測試,會耽誤大量的時間進行測試,因此我們需要使用junit進行單元測試。
Spring配置檔案如下:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
">
<!-- c3p0資料庫連線池 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
destroy-method="close">
<!-- 資料庫基本資訊配置 -->
<property name="url" value="jdbc:oracle:thin:@192.168.1.234:1521:ORCL" />
<property name="username" value="LS" />
<property name="password" value="LS" />
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"></property>
</bean>
<bean id="pathWayDmDaoImp" class="com.winning.dm.test.dao.PathWayDmDaoImp">
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
<bean id="pathWayService" class="com.winning.dm.test.service.PathWayService">
<property name="pathWayDmDaoImp" ref="pathWayDmDaoImp"></property>
</bean>
<!-- <context:annotation-config></context:annotation-config>
<context:component-scan base-package="com.winning"></context:component-scan>
-->
</beans>
dao類如下:
package com.winning.dm.test.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import com.winning.entity.bzfx.FxLjYzMx;
//@Component
public class PathWayDmDaoImp extends JdbcDaoSupport implements IPathWayDmDao {
@Override
// 使用中
public List<Long> findGhdjidList(String sql) {
List<Long> resultlist = new ArrayList<Long>();
String insertsql = " select id from (" + sql + ") where rownum<500";
resultlist = this.getJdbcTemplate().query(insertsql, new RowMapper() {
@Override
public Long mapRow(ResultSet arg0, int arg1) throws SQLException {
return arg0.getLong(1);
}
});
return resultlist;
}
@Override
// 使用中
public List<FxLjYzMx> findcfmx(String sql) {
// TODO Auto-generated method stub
List<FxLjYzMx> fxljyzmxvolist = new ArrayList<FxLjYzMx>();
String findsql = "select ghdjijd,xmmc,rq,je from (select ghdjid,xmmc,"
+ "dense_rank() over(partition by ghdjid order by rq) rq,"
+ "je"
+ "from (select ghdjid, xmmc, floor((cfrq - min) + 1) rq, je"
+ "from (select s.ghdjid, xmmc, cfrq, je, min"
+ "from (select ghdjid, xmmc, cfrq, je"
+ "from ck10_cfmx"
+ "where ghdjid in ("
+ sql
+ ")) s,"
+ "(select ghdjid, min(cfrq) min"
+ "from ck10_cfmx"
+ "where ghdjid in ("
+ sql
+ ")"
+ "group by ghdjid) h"
+ " where s.ghdjid = h.ghdjid(+)))) group by ghdjid,xmmc,rq,je;";
fxljyzmxvolist = this.getJdbcTemplate().query(findsql, new RowMapper() {
@Override
public FxLjYzMx mapRow(ResultSet arg0, int arg1)
throws SQLException {
FxLjYzMx fxljyzmxvo = new FxLjYzMx();
fxljyzmxvo.setGhdjid(String.valueOf(arg0.getLong("ghdjid")));
fxljyzmxvo.setXmmc(arg0.getString("xmmc"));
fxljyzmxvo.setRq(arg0.getInt("rq"));
fxljyzmxvo.setJe(arg0.getDouble("je"));
return fxljyzmxvo;
}
});
return fxljyzmxvolist;
}
}
junit測試方法如下:
package com.winning.dm.test;
import javax.sql.DataSource;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.winning.dm.test.dao.PathWayDmDaoImp;
public class PathWayDmDaoImpTest {
PathWayDmDaoImp pwd;
@Before
public void newPathWayDmDaoImp() {
// pwd = new PathWayDmDaoImp();
ApplicationContext context = new ClassPathXmlApplicationContext(
"applicationContext.xml");
pwd = (PathWayDmDaoImp) context.getBean("pathWayDmDaoImp");
}
@Test
public void testFindGhdjidList() {
pwd.findGhdjidList("select id from ghdjid_lwy");
}
}
測試結果如下:
log4j:WARN [debug] should be System.out or System.err.
log4j:WARN Using previously set target, System.out by default.
2016-12-29 09:31:45 -0 [main] INFO - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@f84386: startup date [Thu Dec 29 09:31:45 CST 2016]; root of context hierarchy
2016-12-29 09:31:45 -82 [main] INFO - Loading XML bean definitions from class path resource [applicationContext.xml]
2016-12-29 09:31:45 -136 [main] DEBUG - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
2016-12-29 09:31:46 -218 [main] DEBUG - Trying to resolve XML entity with public id [null] and system id [http://www.springframework.org/schema/beans/spring-beans-3.0.xsd]
2016-12-29 09:31:46 -218 [main] DEBUG - Loading schema mappings from [META-INF/spring.schemas]
2016-12-29 09:31:46 -220 [main] DEBUG - Loaded schema mappings: {http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd}
2016-12-29 09:31:46 -221 [main] DEBUG - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-3.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-3.0.xsd
2016-12-29 09:31:46 -245 [main] DEBUG - Loading bean definitions
2016-12-29 09:31:46 -263 [main] DEBUG - Loaded 4 bean definitions from location pattern [applicationContext.xml]
2016-12-29 09:31:46 -263 [main] DEBUG - Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@f84386: org.springframework.beans.factory.support.DefaultListableBeanFactory@1c86be5: defining beans [dataSource,jdbcTemplate,pathWayDmDaoImp,pathWayService]; root of factory hierarchy
2016-12-29 09:31:46 -320 [main] DEBUG - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@177b3cd]
2016-12-29 09:31:46 -321 [main] DEBUG - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@b8c8e6]
2016-12-29 09:31:46 -321 [main] INFO - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c86be5: defining beans [dataSource,jdbcTemplate,pathWayDmDaoImp,pathWayService]; root of factory hierarchy
2016-12-29 09:31:46 -322 [main] DEBUG - Creating shared instance of singleton bean 'dataSource'
2016-12-29 09:31:46 -322 [main] DEBUG - Creating instance of bean 'dataSource'
2016-12-29 09:31:46 -427 [main] DEBUG - Eagerly caching bean 'dataSource' to allow for resolving potential circular references
2016-12-29 09:31:46 -458 [main] DEBUG - Getting BeanInfo for class [com.alibaba.druid.pool.DruidDataSource]
2016-12-29 09:31:46 -499 [main] DEBUG - Caching PropertyDescriptors for class [com.alibaba.druid.pool.DruidDataSource]
2016-12-29 09:31:46 -499 [main] DEBUG - Found bean property 'ID' of type [long]
2016-12-29 09:31:46 -500 [main] DEBUG - Found bean property 'accessToUnderlyingConnectionAllowed' of type [boolean]
2016-12-29 09:31:46 -500 [main] DEBUG - Found bean property 'activeConnectionStackTrace' of type [java.util.List]
2016-12-29 09:31:46 -500 [main] DEBUG - Found bean property 'activeConnections' of type [java.util.Set]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'activeCount' of type [int]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'activePeak' of type [int]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'activePeakTime' of type [java.util.Date]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'asyncCloseConnectionEnable' of type [boolean]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'breakAfterAcquireFailure' of type [boolean]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'cachedPreparedStatementAccessCount' of type [long]
2016-12-29 09:31:46 -501 [main] DEBUG - Found bean property 'cachedPreparedStatementCount' of type [long]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'cachedPreparedStatementDeleteCount' of type [long]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'cachedPreparedStatementHitCount' of type [long]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'cachedPreparedStatementMissCount' of type [long]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'class' of type [java.lang.Class]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'clearFiltersEnable' of type [boolean]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'closeCount' of type [long]
2016-12-29 09:31:46 -502 [main] DEBUG - Found bean property 'closedPreparedStatementCount' of type [long]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'commitCount' of type [long]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'compositeData' of type [javax.management.openmbean.CompositeDataSupport]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'connectCount' of type [long]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'connectErrorCount' of type [long]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'connectProperties' of type [java.util.Properties]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'connection' of type [com.alibaba.druid.pool.DruidPooledConnection]
2016-12-29 09:31:46 -503 [main] DEBUG - Found bean property 'connectionErrorRetryAttempts' of type [int]
2016-12-29 09:31:46 -504 [main] DEBUG - Found bean property 'connectionInitSqls' of type [java.util.Collection]
2016-12-29 09:31:46 -504 [main] DEBUG - Found bean property 'connectionProperties' of type [java.lang.String]
2016-12-29 09:31:46 -505 [main] DEBUG - Found bean property 'createCount' of type [long]
2016-12-29 09:31:46 -505 [main] DEBUG - Found bean property 'createErrorCount' of type [long]
2016-12-29 09:31:46 -505 [main] DEBUG - Found bean property 'createScheduler' of type [java.util.concurrent.ScheduledExecutorService]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'createTimespanMillis' of type [long]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'createTimespanNano' of type [long]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'createdTime' of type [java.util.Date]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'dataSourceStat' of type [com.alibaba.druid.stat.JdbcDataSourceStat]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'dbType' of type [java.lang.String]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'defaultAutoCommit' of type [boolean]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'defaultCatalog' of type [java.lang.String]
2016-12-29 09:31:46 -506 [main] DEBUG - Found bean property 'defaultReadOnly' of type [java.lang.Boolean]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'defaultTransactionIsolation' of type [java.lang.Integer]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'destroyCount' of type [long]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'destroyScheduler' of type [java.util.concurrent.ScheduledExecutorService]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'discardCount' of type [long]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'driver' of type [java.sql.Driver]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'driverClassLoader' of type [java.lang.ClassLoader]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'driverClassName' of type [java.lang.String]
2016-12-29 09:31:46 -507 [main] DEBUG - Found bean property 'driverMajorVersion' of type [int]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'driverMinorVersion' of type [int]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'dupCloseCount' of type [long]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'dupCloseLogEnable' of type [boolean]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'enable' of type [boolean]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'errorCount' of type [long]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'exceptionSorter' of type [com.alibaba.druid.pool.ExceptionSorter]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'exceptionSorterClassName' of type [java.lang.String]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'executeCount' of type [long]
2016-12-29 09:31:46 -508 [main] DEBUG - Found bean property 'filterClassNames' of type [java.util.List]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'filterClasses' of type [[Ljava.lang.String;]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'filters' of type [java.lang.String]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'full' of type [boolean]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'initStackTrace' of type [java.lang.String]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'inited' of type [boolean]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'initialSize' of type [int]
2016-12-29 09:31:46 -509 [main] DEBUG - Found bean property 'lastCreateError' of type [java.lang.Throwable]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lastCreateErrorTime' of type [java.util.Date]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lastCreateErrorTimeMillis' of type [long]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lastError' of type [java.lang.Throwable]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lastErrorTime' of type [java.util.Date]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lastErrorTimeMillis' of type [long]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lock' of type [java.util.concurrent.locks.Lock]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'lockQueueLength' of type [int]
2016-12-29 09:31:46 -510 [main] DEBUG - Found bean property 'logAbandoned' of type [boolean]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'logDifferentThread' of type [boolean]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'logWriter' of type [java.io.PrintWriter]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'loginTimeout' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxActive' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxCreateTaskCount' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxIdle' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxOpenPreparedStatements' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxPoolPreparedStatementPerConnectionSize' of type [int]
2016-12-29 09:31:46 -511 [main] DEBUG - Found bean property 'maxWait' of type [long]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'maxWaitThreadCount' of type [int]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'mbeanRegistered' of type [boolean]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'minEvictableIdleTimeMillis' of type [long]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'minIdle' of type [int]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'name' of type [java.lang.String]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'notEmptySignalCount' of type [long]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'notEmptyWaitCount' of type [long]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'notEmptyWaitMillis' of type [long]
2016-12-29 09:31:46 -512 [main] DEBUG - Found bean property 'notEmptyWaitNanos' of type [long]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'notEmptyWaitThreadCount' of type [int]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'notEmptyWaitThreadPeak' of type [int]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'notFullTimeoutRetryCount' of type [int]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'numTestsPerEvictionRun' of type [int]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'objectName' of type [javax.management.ObjectName]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'oracle' of type [boolean]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'parentLogger' of type [java.util.logging.Logger]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'password' of type [java.lang.String]
2016-12-29 09:31:46 -513 [main] DEBUG - Found bean property 'passwordCallback' of type [javax.security.auth.callback.PasswordCallback]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'passwordCallbackClassName' of type [java.lang.String]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'poolPreparedStatements' of type [boolean]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'pooledConnection' of type [javax.sql.PooledConnection]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'poolingConnectionInfo' of type [java.util.List]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'poolingCount' of type [int]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'poolingPeak' of type [int]
2016-12-29 09:31:46 -514 [main] DEBUG - Found bean property 'poolingPeakTime' of type [java.util.Date]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'preparedStatementCount' of type [long]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'properties' of type [java.lang.String]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'proxyFilters' of type [java.util.List]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'queryTimeout' of type [int]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'rawDriver' of type [java.sql.Driver]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'rawDriverMajorVersion' of type [int]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'rawDriverMinorVersion' of type [int]
2016-12-29 09:31:46 -515 [main] DEBUG - Found bean property 'rawJdbcUrl' of type [java.lang.String]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'recycleCount' of type [long]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'recycleErrorCount' of type [long]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'reference' of type [javax.naming.Reference]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'removeAbandoned' of type [boolean]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'removeAbandonedCount' of type [long]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'removeAbandonedTimeout' of type [int]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'removeAbandonedTimeoutMillis' of type [long]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'resetCount' of type [long]
2016-12-29 09:31:46 -516 [main] DEBUG - Found bean property 'resetStatEnable' of type [boolean]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'rollbackCount' of type [long]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'sharePreparedStatements' of type [boolean]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'sqlStat'
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'sqlStatMap' of type [java.util.Map]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'startTransactionCount' of type [long]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'statData' of type [java.util.Map]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'statDataForMBean' of type [java.util.Map]
2016-12-29 09:31:46 -517 [main] DEBUG - Found bean property 'statLogger' of type [com.alibaba.druid.pool.DruidDataSourceStatLogger]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'statLoggerClassName' of type [java.lang.String]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'statValueAndReset' of type [com.alibaba.druid.pool.DruidDataSourceStatValue]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'testOnBorrow' of type [boolean]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'testOnReturn' of type [boolean]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'testWhileIdle' of type [boolean]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'timeBetweenConnectErrorMillis' of type [long]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'timeBetweenEvictionRunsMillis' of type [long]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'timeBetweenLogStatsMillis' of type [long]
2016-12-29 09:31:46 -518 [main] DEBUG - Found bean property 'transactionHistogram' of type [com.alibaba.druid.util.Histogram]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'transactionHistogramRanges' of type [[J]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'transactionHistogramValues' of type [[J]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'transactionQueryTimeout' of type [int]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'transactionThresholdMillis' of type [long]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'url' of type [java.lang.String]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'useGlobalDataSourceStat' of type [boolean]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'useLocalSessionState' of type [boolean]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'useOracleImplicitCache' of type [boolean]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'useUnfairLock' of type [boolean]
2016-12-29 09:31:46 -519 [main] DEBUG - Found bean property 'userCallback' of type [javax.security.auth.callback.NameCallback]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'username' of type [java.lang.String]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'validConnectionChecker' of type [com.alibaba.druid.pool.ValidConnectionChecker]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'validConnectionCheckerClassName' of type [java.lang.String]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'validationQuery' of type [java.lang.String]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'validationQueryTimeout' of type [int]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'version' of type [java.lang.String]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'waitThreadCount' of type [int]
2016-12-29 09:31:46 -520 [main] DEBUG - Found bean property 'wallStatMap' of type [java.util.Map]
2016-12-29 09:31:46 -523 [main] DEBUG - Finished creating instance of bean 'dataSource'
2016-12-29 09:31:46 -523 [main] DEBUG - Creating shared instance of singleton bean 'jdbcTemplate'
2016-12-29 09:31:46 -524 [main] DEBUG - Creating instance of bean 'jdbcTemplate'
2016-12-29 09:31:46 -527 [main] DEBUG - Eagerly caching bean 'jdbcTemplate' to allow for resolving potential circular references
2016-12-29 09:31:46 -527 [main] DEBUG - Returning cached instance of singleton bean 'dataSource'
2016-12-29 09:31:46 -528 [main] DEBUG - Getting BeanInfo for class [org.springframework.jdbc.core.JdbcTemplate]
2016-12-29 09:31:46 -532 [main] DEBUG - Caching PropertyDescriptors for class [org.springframework.jdbc.core.JdbcTemplate]
2016-12-29 09:31:46 -532 [main] DEBUG - Found bean property 'class' of type [java.lang.Class]
2016-12-29 09:31:46 -532 [main] DEBUG - Found bean property 'dataSource' of type [javax.sql.DataSource]
2016-12-29 09:31:46 -532 [main] DEBUG - Found bean property 'databaseProductName' of type [java.lang.String]
2016-12-29 09:31:46 -532 [main] DEBUG - Found bean property 'exceptionTranslator' of type [org.springframework.jdbc.support.SQLExceptionTranslator]
2016-12-29 09:31:46 -532 [main] DEBUG - Found bean property 'fetchSize' of type [int]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'ignoreWarnings' of type [boolean]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'lazyInit' of type [boolean]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'maxRows' of type [int]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'nativeJdbcExtractor' of type [org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'queryTimeout' of type [int]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'resultsMapCaseInsensitive' of type [boolean]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'skipResultsProcessing' of type [boolean]
2016-12-29 09:31:46 -533 [main] DEBUG - Found bean property 'skipUndeclaredResults' of type [boolean]
2016-12-29 09:31:46 -533 [main] DEBUG - Invoking afterPropertiesSet() on bean with name 'jdbcTemplate'
2016-12-29 09:31:46 -533 [main] DEBUG - Finished creating instance of bean 'jdbcTemplate'
2016-12-29 09:31:46 -534 [main] DEBUG - Creating shared instance of singleton bean 'pathWayDmDaoImp'
2016-12-29 09:31:46 -534 [main] DEBUG - Creating instance of bean 'pathWayDmDaoImp'
2016-12-29 09:31:46 -534 [main] DEBUG - Eagerly caching bean 'pathWayDmDaoImp' to allow for resolving potential circular references
2016-12-29 09:31:46 -534 [main] DEBUG - Returning cached instance of singleton bean 'jdbcTemplate'
2016-12-29 09:31:46 -534 [main] DEBUG - Getting BeanInfo for class [com.winning.dm.test.dao.PathWayDmDaoImp]
2016-12-29 09:31:46 -537 [main] DEBUG - Caching PropertyDescriptors for class [com.winning.dm.test.dao.PathWayDmDaoImp]
2016-12-29 09:31:46 -537 [main] DEBUG - Found bean property 'class' of type [java.lang.Class]
2016-12-29 09:31:46 -537 [main] DEBUG - Found bean property 'dataSource' of type [javax.sql.DataSource]
2016-12-29 09:31:46 -537 [main] DEBUG - Found bean property 'jdbcTemplate' of type [org.springframework.jdbc.core.JdbcTemplate]
2016-12-29 09:31:46 -537 [main] DEBUG - Invoking afterPropertiesSet() on bean with name 'pathWayDmDaoImp'
2016-12-29 09:31:46 -537 [main] DEBUG - Finished creating instance of bean 'pathWayDmDaoImp'
2016-12-29 09:31:46 -538 [main] DEBUG - Creating shared instance of singleton bean 'pathWayService'
2016-12-29 09:31:46 -538 [main] DEBUG - Creating instance of bean 'pathWayService'
2016-12-29 09:31:46 -538 [main] DEBUG - Eagerly caching bean 'pathWayService' to allow for resolving potential circular references
2016-12-29 09:31:46 -538 [main] DEBUG - Returning cached instance of singleton bean 'pathWayDmDaoImp'
2016-12-29 09:31:46 -538 [main] DEBUG - Getting BeanInfo for class [com.winning.dm.test.service.PathWayService]
2016-12-29 09:31:46 -540 [main] DEBUG - Caching PropertyDescriptors for class [com.winning.dm.test.service.PathWayService]
2016-12-29 09:31:46 -540 [main] DEBUG - Found bean property 'class' of type [java.lang.Class]
2016-12-29 09:31:46 -541 [main] DEBUG - Found bean property 'pathWayDaoImp' of type [com.winning.dm.test.dao.PathWayDaoImp]
2016-12-29 09:31:46 -541 [main] DEBUG - Found bean property 'pathWayDmDaoImp' of type [com.winning.dm.test.dao.PathWayDmDaoImp]
2016-12-29 09:31:46 -541 [main] DEBUG - Finished creating instance of bean 'pathWayService'
2016-12-29 09:31:46 -542 [main] DEBUG - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@42552c]
2016-12-29 09:31:46 -543 [main] DEBUG - Returning cached instance of singleton bean 'lifecycleProcessor'
2016-12-29 09:31:46 -543 [main] DEBUG - Publishing event in org.springframework.context.support.ClassPathXmlApplicationContext@f84386: org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@f84386: startup date [Thu Dec 29 09:31:45 CST 2016]; root of context hierarchy]
2016-12-29 09:31:46 -543 [main] DEBUG - Returning cached instance of singleton bean 'pathWayDmDaoImp'
2016-12-29 09:31:46 -544 [main] DEBUG - Executing SQL query [ select id from (select id from ghdjid_lwy) where rownum<500]
2016-12-29 09:31:46 -582 [main] DEBUG - Fetching JDBC Connection from DataSource
2016-12-29 09:31:46 -889 [main] INFO - {dataSource-1} inited
2016-12-29 09:31:46 -1090 [main] DEBUG - Returning JDBC Connection to DataSource
測試成功。
相關文章
- Java單元測試之JUnit 5快速上手Java
- 1.13-java單元測試junitJava
- JUnit單元測試
- Junit 單元測試.
- junit-單元測試
- JUnit 4 單元測試
- JUnit測試單元框架框架
- Junit單元測試—MavenMaven
- JUnit3.8的Junit單元測試.
- Java Junit單元測試(入門必看篇)Java
- Junit4單元測試
- 測試 之Java單元測試、Android單元測試JavaAndroid
- 使用JUnit進行單元測試
- 使用junit單元測試SpringMvcSpringMVC
- Junit 單元測試使用總結
- 實驗三junit單元測試
- JUnit+Mockito單元測試之打樁when().thenReturn();Mockito
- junit單元測試時,java.lang.ClassNotFoundException: java.pakc.SimpleTestJavaException
- 用Junit Framework編寫單元測試Framework
- Java單元測試神器之MockitoJavaMockito
- Java單元測試技巧之PowerMockJavaMock
- 安卓單元測試 (八):Junit Rule 的使用安卓
- Android單元測試(3):JUnit 的使用Android
- JUnit 單元測試斷言推薦 AssertJ
- 用Junit Framework編寫單元測試 (轉)Framework
- Java新一代單元測試框架JUnit5速覽Java框架
- Spring單元測試教程(JUnit5+Mockito)SpringMockito
- SpringBoot與單元測試JUnit的結合Spring Boot
- 搭建持續整合單元測試平臺(Jenkins+Ant+Java+Junit+SVN)JenkinsJava
- 菜鳥學Java(二十一)——如何更好的進行單元測試——JUnitJava
- Go 單元測試之mock介面測試GoMock
- java中的單元測試Java
- 解決JUnit單元測試時出現的Java.lang.Exception: No runnable methods問題JavaException
- 單元測試:單元測試中的mockMock
- Springboot整合JUnit5優雅進行單元測試Spring Boot
- 測試開發之單元測試-禪道結合ZTF驅動單元測試執行
- 使用 Feed4JUnit 進行資料與程式碼分離的 Java 單元測試Java
- Java之--------JUnit軟體測試技術(工具)Annotation1Java