简体   繁体   English

不同的Jersey测试容器之间有什么区别?

[英]What's the difference between the different Jersey test containers?

According to http://jersey.java.net/nonav/apidocs/latest/jersey/jersey-test-framework/jersey-test-framework-core/com/sun/jersey/test/framework/JerseyTest.html users may choose between two kinds of test containers: 根据http://jersey.java.net/nonav/apidocs/latest/jersey/jersey-test-framework/jersey-test-framework-core/com/sun/jersey/test/framework/JerseyTest.html,用户可以选择在两种测试容器之间:

  1. Low-level container that does not support servlets 不支持servlet的低级容器
  2. Web-based container that does support servlets 不支持Servlet的基于Web的容器

I have the following questions: 我有以下问题:

  1. What's the advantage/disadvantage of each kind of container? 每种容器的优点/缺点是什么? For example, I assume low-level containers are faster but are missing some sort of functionality. 例如,我假设低级容器速度更快,但是缺少某种功能。
  2. What is meant by the fact that low-level containers do not support servlets? 低级容器不支持servlet的事实意味着什么? I thought that JAX-RS is based on top of Servlets. 我认为JAX-RS是基于Servlet的。 What aren't low-level containers able to do? 低层容器不能做什么?

UPDATE : 更新

Upon further research I discovered that low-level containers are faster but they really run without servlets. 经过进一步的研究,我发现低级容器速度更快,但实际上它们没有Servlet即可运行。 When clients make requests,a the appropriate Resources are constructed and the response is passed back to the client, all in-memory. 当客户端发出请求时,将构建适当的资源,并将响应全部传递回客户端。 This is similar to running an embedded database versus a conventional network-based JDBC connection. 这类似于运行嵌入式数据库,而不是运行基于常规网络的JDBC连接。

There is no mechanism to supply a ServletContextListener, register servlets or filters. 没有提供ServletContextListener,注册Servlet或过滤器的机制。 I'm guessing the request scope isn't supported either. 我猜测请求范围也不被支持。

My question is, can you really test anything meaningful under these restrictions? 我的问题是,在这些限制下,您真的可以测试任何有意义的东西吗?

"... can you really test anything meaningful under these restrictions..." “ ...您真的可以在这些限制下测试任何有意义的东西吗?”

You can test your business logic, and do it quicker. 您可以测试您的业务逻辑,并更快地进行。

(Would like to see this fixed though: JERSEY-622 . The in-memory test container doesn't support Jackson, ie the POJO-mapping feature of Jersey.) (不过,我们希望看到此修复程序: JERSEY-622 。内存中的测试容器不支持Jackson,即Jersey的POJO映射功能。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 关键字“ test”和“ it”有什么区别 - What's the difference between keywords 'test' and 'it' 测试容器中StartupCheckStrategy和WaitStrategy之间的区别 - Difference between StartupCheckStrategy and WaitStrategy in test containers 测试套件和测试组之间有什么区别? - What's the difference between test suite and test group? ScalaTest和Scala Specs单元测试框架之间有什么区别? - What’s the difference between ScalaTest and Scala Specs unit test frameworks? 使用“Run As”运行 JUnit 测试和 Maven 的测试有什么区别? - What is the difference between running JUnit tests with "Run As" and Maven's test? UI 测试和 E2E 测试有什么区别? 以及每个的好处是什么? - What's the difference between a UI test and an E2E Test? And What's the benefits of each? Jest 中的“it”和“test”有什么区别? - What is the difference between 'it' and 'test' in Jest? Rust 中的#[test] 和#[cfg(test)] 有什么区别? - What is the difference between #[test] and #[cfg(test)] in Rust? db:test:clone,db:test:clone_structure,db:test:load和db:test:prepare有什么区别? - What's the difference between db:test:clone, db:test:clone_structure, db:test:load, and db:test:prepare? 这两个单元测试断言有什么区别? - What is the difference between these two Unit Test Assertions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM