2
Simulator
Calvin Xiao edited this page 2014-01-18 19:33:08 -08:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Overview

开发、测试时,总需要很多模拟器,可以解耦对第三方服务的依赖,使得可以本地运行开发与测试,而且性能不受第三方依赖的影响。

嵌入式的版本

  • 数据库: H2
  • Redis/MongoDB: NoSQLUnit ,见springside-extension中的RestTemplate的测试。
  • Memcached:JMemcached, 见springside-extension中的MemcachedSimulator。
  • JMS:ActiveMQ自带嵌入式版本,见Showcase中JMS的配置
  • Mail Server:GreenMail 见springside-extension中的MailServerSimulator

远端服务的模拟

  • Node.js ,node.js编写的模拟器方便动态修改,支持tcp与http, 而且支持高并发,适合性能测试时使用。
  • 另一个选择是DreamHead同学拿了Java Duke大奖,登上时代广场大屏幕的Moco,支持http,类似spring mvc那样可以配置各种请求的返回值,可以用一段JSON控制模拟器的返回,也可以在测试代码里进行动态设定。