淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

unitils数据库测试实例3

上一篇 / 下一篇  2009-06-10 22:28:13 / 个人分类:java性能监控与调优

UserDAOTest.java读取的test-common文件内容 : <?xmlversion="1.0"encoding="GB2312"?><beansdefault-autowire="byName"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:tx="http://www.springframework.org/schema/tx"

       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd

          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

 

 <!-- for unitils test, read unitls.properties -->

 <bean id="dataSource"class="org.unitils.database.UnitilsDataSourceFactoryBean"/> 

   <beanid="transactionTemplate"class="org.springframework.transaction.support.TransactionTemplate"/>

 

  

  <beanid="sqlMapClient"

     class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" scope="singleton">

   <propertyname="configLocation"value="classpath:resources/sqlmap-config.xml"/>

   <propertyname="dataSource"ref="dataSource"/>

 </bean>

 

 <beanid="amoebaDao"class="com.ali.amoeba.brmmstest.ibatis.IBatisAmoebaDao">

   <propertyname="sqlMapClient"ref="sqlMapClient"/>

 </bean>

 

 <beanid="transactionManager"

     class="org.springframework.jdbc.datasource.DataSourceTransactionManager" scope="singleton">

   <propertyname="dataSource"ref="dataSource"/>

 </bean>

 

   <beanid="baseSqlMapClientDAO"abstract="true">

       <propertyname="dataSource">

           <reflocal="dataSource"/>

       </property>

       <propertyname="sqlMapClient">

           <reflocal="sqlMapClient"/>

       </property>

   </bean> 

</beans>  

以上变化仅仅是   <bean id="dataSource"class="org.unitils.database.UnitilsDataSourceFactoryBean"/>

 

就是UnitilsDataSourceFactoryBean去读取unitils.properities文件驱动程序及控制项目.其他的和spring testcontext读取的内容完全一样.   

运行后amoeba数据库自动生成dbmaintain_scripts,可以清晰看出执行的脚本版本.

 


TAG: dbunit unitils 自动化

Felicia88的个人空间 引用 删除 Felicia88   /   2009-12-08 20:46:45
 

评分:0

我来说两句

Open Toolbar