2011-08-16 139 views
0

我想使用gwt-test-utils庫(http://code.google.com/p/gwt-test-utils/)來測試我的gwt客戶端。雖然標準實現已經提供了處理/映射的GwtCreateHandler(用於模擬GWT.create),但它不處理Guice servlet擴展(GuiceFilter/GuiceServletContextListener)。如何在Guice/Inject/GuiceFilter servlet環境中獲取servlet實例?

基本上我需要找到該servlet,或處理一個特定的URL servlet類,我知道:

String url = ... // I know this. 
// I know everything else (Injector, GuiceServletContextListener, etc). 
Class<?> servletClazz = ... // How to get this? 

這甚至可能嗎? 當然,運行GWTTestCase會的工作,但:

  1. 實在是太慢了
  2. gwt-test-utils是純Java的,所以我不明白爲什麼它不可能

謝謝, 亞歷克斯D.

回答

0

結帳Tadedon

  • 在Guice模塊中綁定應用程序配置。

  • 支持@PostConstruct和@PreDestroy註釋(JSR 250) Guice應用程序。投入slf4j記錄器。

  • 用@Transactional註釋來註釋您的方法。

  • 在您的web應用程序中支持guice階段。

  • test your guice managed servlets and filters不需要真實
    servlet容器。

  • 使用吉斯匹配器匹配超類,接口和類型
    文字註釋

+0

這是偉大的,但該項目缺乏一個jar下載/ Ant構建...我必須做手動:)。再次感謝 –

相關問題