第一套方案:

1、初始化application:使用@ContextConfigurationr的classpath属性,如

@ContextConfiguration(locations =
{ "/META-INF/spring/applicationContext-mutiDs.xml", "/META-INF/spring/applicationContext-timer.xml" })

@RunWith(SpringJUnit4ClassRunner.class)

@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class})

@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)

@Transactional

public class A

或者

在@Before

public void prepareInit() {

ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/*.xml");

context.start();

}

第二套方案:

1、使用自己的application.xml和自己的数据

@ContextConfiguration(locations = {"file:src/test/resources/applicationContext.xml",
"file:src/test/resources/dubbo-mdb-provider.xml"})

2、然后把相关的数据库配置放在test目录下面。

3、搞定,两套方案完成。

spring junit 部署两套测试方案的更多相关文章

  1. Centos7下部署两套python版本并存

    Centos7下部署两套python版本并存   需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的 ...

  2. Centos7下部署两套python版本并存环境的操作记录

    需求说明:centos7.2系统的开发机器上已经自带了python2.7版本,但是开发的项目中用的是python3.5版本,为了保证Centos系统的正常运行,以及节省机器资源(不想因此再申请另外一台 ...

  3. 独立两套DJANGO+CELERY配置(生产+测试)时要注意的一些细节

    1,生产的NGINX环境,要指定自己的目录,而不是PROJ默认的. upstream ism_host { server ; } server { listen ; server_name local ...

  4. Spring+Junit+Mock测试web项目,即Controller

    准备:Maven依赖 <!-- Spring和MVC的包这里不列出来了,webmvc,aspects,orm,其他maven会自动导 --> <dependency> < ...

  5. spring + junit 测试

    spring + junit 测试 需要一个工具类 package com.meizu.fastdfsweb; import org.junit.runner.RunWith; import org. ...

  6. Openfire 集群部署和负载均衡方案

    Openfire 集群部署和负载均衡方案 一.   概述 Openfire是在即时通讯中广泛使用的XMPP协议通讯服务器,本方案采用Openfire的Hazelcast插件进行集群部署,采用Hapro ...

  7. spring junit

    转载自 http://blog.csdn.net/funi16/article/details/8691575 在写单元测试的时候,一般是对数据库进行增删改查的操作,这个时候,如果之前删除了某条记录, ...

  8. 移动端测试方案--sptt

    sptt sptt是移动端UI自动化测试的一种解决方案,全称为special tool of test.sptt提供了一套测试解决方案,并使用命令行完成相关操作,最终可集成在各种后续的流程中. spt ...

  9. Android MediaCodec硬编兼容性测试方案

    作者:阿宝 更新:2016-08-15 来源:彩色世界(https://blog.hz601.org/2016/08/15/android-mediacodec-hardcode-compatibil ...

随机推荐

  1. [转]SSIS高级转换任务—行计数

    本文转自:http://www.cnblogs.com/tylerdonet/archive/2011/06/19/2084780.html 在SSIS中的Row Count转换可以在数据流中计算数据 ...

  2. 【好】strong-password-checker,我自己做出来的:)

    我自己做出来的,分了几种情况来考虑.(再后面有加了注释的版本) https://leetcode.com/problems/strong-password-checker/ // 加油! public ...

  3. SQL注入深入剖析

    SQL注入是一门很深的学问,也是一门很有技巧性的学问 1.  运算符的优先级介绍 2.  SQL语句执行函数介绍 mysql_query() 仅对 SELECT,SHOW,EXPLAIN 或 DESC ...

  4. http://wsj356428476.iteye.com/blog/1655032

    http://wsj356428476.iteye.com/blog/1655032 http://jingyan.baidu.com/article/19192ad83ce167e53e570705 ...

  5. asp.net 大文上传配置

    配置iis的文件上传大小控制: 今天先说一个问题,在window server2008 下配置上传文件的大小,除了工程自身的config外还需要配置一下服务器上的applicationhost.con ...

  6. 解决 java.lang.ClassNotFoundException配置文件出错的问题

    出现的原因: 1.jar包没有导入 2.jar包有冲突 3.jar包没有同步发布到自己项目的lib目录中 解决方案: maven构建工程的方式:项目点击右键 点击 Properties 选择Deplo ...

  7. http_load压力测试使用

    介绍:http_load以并行复用的方式运行,用以测试web服务器的吞吐量与负载.但是它不同于大多数压力测试工具,它可以以一个单一的进程运行,一般不会把客户机搞死.还可以测试HTTPS类的网站请求. ...

  8. [LeetCode][Java] Substring with Concatenation of All Words

    题目: You are given a string, s, and a list of words, words, that are all of the same length. Find all ...

  9. JMS与Spring之二(用message listener container异步收发消息)

    转自:http://blog.csdn.net/moonsheep_liu/article/details/6684948

  10. Hibernate关系映射(三) 多对一和一对多

    一.多对一 学生Student和班级Grade实现多对一,多个学生对应一个班级. Student.java实体类,映射了班级的属性. package com.lxit.entity; import j ...