如何使用mockrunner设置一个模拟队列来测试xml过滤器? [英] How do I set up a mock queue using mockrunner to test an xml filter?

查看:203
本文介绍了如何使用mockrunner设置一个模拟队列来测试xml过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 http://mockrunner.sourceforge.net/ 中的mockrunner软件包来设置建立一个模拟队列,用于JUnit测试一个以下操作的XML过滤器:

I'm using the mockrunner package from http://mockrunner.sourceforge.net/ to set up a mock queue for JUnit testing an XML filter which operates like this:


  1. 设置ftp服务器识别的属性以放置和获取xml输入以及跟踪作业的jms队列服务器。远程地,等待接收到队列消息时实际解析xml的服务器。

  2. 使用ftp创建远程目录,并使用mqconnectionfactory启动队列连接到队列服务器的给定地址。

  3. 一旦在2)中创建新队列条目,则过滤器等待新的队列消息出现,表示作业已由远程服务器完成。然后,该过滤器从ftp抓取修改的xml文件,并将其传递到下一个过滤器。

我正在开发的JUnit测试只需要通过启动本地ftp和模拟队列服务器来过滤连接来模拟此环境然后等待过滤器连接到队列,并通过本地ftp服务器将新的xml输入文件放在本地目录上,等待队列消息,然后稍微修改xml输入,将修改后的xml放入新目录并发送另一个消息到队列,表示作业已经完成。

The JUnit test I am working on simply needs to emulate this environment by starting a local ftp and mock queue server for the filter to connect to, then waiting for the filter to connect to the queue and put the new xml input file on a local directory via a local ftp server, wait for the queue message and then modify the xml input slightly, put the modified xml in a new directory and post another message to the queue signifying the job has completed.

我在网络上发现的所有教程都使用EJB和JNDI来查找队列服务器。如果可能,我想通过在本地机器上创建一个模拟队列并以最简单的方式连接到它,而不是使用EJB和JNDI来回避该路由。

All of the tutorials I have found on the net have used EJB and JNDI to lookup the queue server once it has been made. If possible, I'd like to sidestep that route by just creating a mock queue on my local machine and connecting to it in the simplest manner possible, not using EJB and JNDI.

提前感谢!

推荐答案

我正在使用 MockEjb ,其中有一些使用模拟队列的示例,因此请查看 info 以及示例
希望它有帮助。

I'm using MockEjb and there are some examples among them one for using mock queues, so take a look to the info and to the example Hopefully it helps.

这篇关于如何使用mockrunner设置一个模拟队列来测试xml过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆