我正在使用 GWT 2.4。我有许多扩展 GwtTestCase 的测试文件。我的问题是,我如何以及在哪里放置代码,以便服务器端在我的测试运行之前初始化一些数据?
我尝试创建一个简单的 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" />
但我注意到这个 init 方法从未被调用过。