【问题标题】:Unit testing of GWT RequestFactory services without GWTTestCase没有 GWTTestCase 的 GWT RequestFactory 服务的单元测试
【发布时间】:2011-01-31 16:17:25
【问题描述】:

在某个地方,我不记得我在哪里发现了从 GWT 2.1.1 开始可以在没有 GWTTestCase 的情况下测试 ReqeustFactory 服务的信息。如果这是真的,请告诉我怎么做。

【问题讨论】:

    标签: java gwt junit


    【解决方案1】:

    RequestFactorySource 类型可用于在非 GWT 运行时中实例化 RequestFactory 实例。 GWT 自己的RequestFactoryJreSuite 测试使用前面提到的 InProcessRequestTransport 来避免启动整个 GWT 运行时环境的需要。

    RequestFactorySource 类型不仅限于测试。如果您实现自己的 RequestTransport(可能基于 java.net.HttpUrlConnection 或 Apache HttpClient 库),则可以使用生产 RequestFactory 端点编写控制台应用程序、批量查询应用程序或运行状况探测器。这是对 GWT 旧 RPC 系统的巨大改进,后者仅支持基于 GWT 的客户端。

    【讨论】:

    • 从 svn 版本 r9946 开始,RequestFactoryMagic 类型已重命名为 RequestFactorySource。
    【解决方案2】:

    我在浏览 GWT 的源代码时发现了它。答案隐藏在InProcessRequestTransportjavadoc:

    https://gwt.googlesource.com/gwt/+/master/user/src/com/google/web/bindery/requestfactory/server/testing/InProcessRequestTransport.java

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多