3
我正在使用GWT 2.4。我有很多擴展GwtTestCase的測試文件。我的問題是,我如何以及在哪裏放置代碼,以便服務器端在我的測試運行之前初始化一些數據?如何在構建GWT測試用例時獲取服務器端初始化代碼?
我試圖創建一個簡單的servlet ...
public class PopulateCacheServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
try {
PopulateCache.addTestEntriesToCache();
System.out.println("Dummy entries written to cache.");
} catch (Exception e) {
e.printStackTrace();
}
} // init
}
,並把它的定義,我模塊的.gwt.xml文件...
<servlet path="/populatecache" class="com.myco.clearing.web.PopulateCacheServlet" />
,但我注意到,這個初始化方法永遠不會被調用。