zeus代码测试正紧张进行中,但由于工作比较忙,但速度比较慢.现在已经完成读写分离单元测试了,现在把几种情况单元测试的例子发出来,希望有人能进出意见,让它走下去.
本文是zeus的dao单元测试:
1.单元测试直接上代码
package com.dengliang.zeus.webdemo.test; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.dengliang.zeus.webdemo.dao.Dajc01DAO; import com.dengliang.zeus.webdemo.vo.Dajc01VO; /** * zeus持久层基本连接测试 */ public class ZeusSimpledbTest { private static ApplicationContext context; /** * 获取bean * * @param id * @return */ public static Object getBean(String id) { if (context == null) { synchronized (id) { context = new ClassPathXmlApplicationContext( "applicationContext-simpledb.xml", "applicationContext-dao.xml", "applicationContext-service.xml"); } } return context.getBean(id); } @Test public void testDataSourceInterceptor() { // 只读测试 Dajc01DAO service = (Dajc01DAO) ZeusSimpledbTest.getBean("dajc01DAO"); try { Dajc01VO davo=service.findByPK("e09bb3c4d53c4663b86b427a2b83874a"); System.out.println("aaaaaaaaaaaaaaaafdfdas"+davo.getCreateEmp()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
2,几个配置文件
applicationContext-simpledb.xml
<?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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "> <context:property-placeholder location="classpath:*.properties" /> <bean id="parentDataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <!-- 配置初始化大小、最小、最大 --> <property name="initialSize" value="20" /> <property name="minIdle" value="20" /> <property name="maxIdle" value="30" /> <property name="maxActive" value="50" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="0" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="60000" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="300000" /> <property name="validationQuery" value="SELECT 'x'" /> <property name="testWhileIdle" value="true" /> <property name="testOnBorrow" value="false" /> <property name="testOnReturn" value="false" /> <property name="removeAbandoned" value="false" /> <!-- 打开PSCache,并且指定每个连接上PSCache的大小 --> <property name="poolPreparedStatements" value="true" /> <property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> <property name="filters" value ="stat,wall"></property> </bean> <bean id="jlerp_db" parent="parentDataSource" destroy-method="close"> <property name="url" value="jdbc:oracle:thin:@10.68.2.23:1521/erpdb" /> <property name="username" value="jlerp_db" /> <property name="password" value="jlerp_db" /> </bean> <!--daoSupport--> <bean id="zeusdaoSupport" class="com.dengliang.zeus.framework.dao.ZeusDaoSupport"> <property name="dataSource" ref="jlerp_db"/> </bean> </beans>
applicationContext-dao.xml
<?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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd "> <!-- DAO --> <bean id="dajc01DAO" class="com.dengliang.zeus.webdemo.dao.Dajc01DAO" parent="zeusdaoSupport"/> </beans>
applicationContext-service.xml
<?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:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd "> <!-- BIZ --> <bean id="dajc01Service" class="com.dengliang.zeus.webdemo.services.impl.Dajc01Service"> <property name="dajc01DAO" ref="dajc01DAO" /> </bean> </beans>
zeus代码方式轻量级持久层架构,开发,调试简单,希望他能方便一些人
相关推荐
"The source code to the infamous Zeus crimeware kit, which has been sold on underground forums for years, has been leaked and is now available for anyone to see if they know where to look. Security ...
zbot,赛门铁克评价的bot之王。经过测试,可编译,可利用。解压密码:zeus
zbot,赛门铁克评价的bot之王。经过测试,可编译,可利用。
ZeuS 2.0.8.9.rar 完整版源码
Zeus:是恶意程序工具包,是臭名昭著但名声卓著的黑客工具包。
吾爱破解专版,插件也比较齐全,添加了Zeus大神的脱VMP脚本
专杀工具Zbot或Zeus专杀.zip
大牛的脱VMP壳的插件,一般的VMP壳都能脱掉
过去横扫全球的 ZeuS 恶意程序,可说是安全威胁领域最热门的恶意程序工具套件。Zeus病毒的作者 Monstr/Slavik 将 Zeus 的原代码移交给 SpyEye 的作者 Harderman/Gribodemon 之前,Zeus 的最后一个版本为 2.0.8.9。 ...
提供了一整套阿里大数据任务调度框架zeus的安装部署手册及源代码
zeus - 一个非常简单和快速的HTTP路由器
ZEUS:这是一个现代化的构建系统,具有交互式shell,Tab自动完成和支持快捷键绑定
基于Zeus平台的Agent技术在电子商务中的应用(论文)
python库。 资源全名:flask-zeus-0.2.1.tar.gz
ZEUS
zeus源码,你懂得的,这是正宗的源码。
Zeus是AWS EC2 / S3 / CloudTrail / CloudWatch / KMS最佳加固实践的强大工具。 它根据用户创建的配置文件检查安全设置,并根据用户请求的CIS AWS Benchmark源将其更改为推荐的设置。
Zeus 是一种高级Google搜索工具,能够绕过搜索引擎的API调用
全新版本,V4.0.0 1.持续修复GSSI数据处理后的增益问题; 2.记录全局当前路径; 3.增加杂波去除及层界面去除两个功能。 zeus_gpr@163.com,雷建伟博士……
这次为大家上传的东东是Zeus.Traffic.Manager.v7.4.Virtual.Appliance.x64安装程序与破解文件(1/3),功能非常强大,用过的人都说好啊,希望大家喜欢!更新日期:2011.09.18