我正在做JSFunit上的工作,我使用的是WebSphere6.1应用服务器,所以谁能回答我,它是否兼容jsfunit,或者我需要对服务器配置做一些更改?如果可能的话,把这个例子发给我?
谢谢维诺德
发布于 2010-10-11 21:13:09
是,
阅读JSFUnitOnWebSphere
因此,要在JSFUnit中使用WebSphere,您需要创建一个扩展其中一个InitialRequestStrategy类的类。有关其他示例,请参阅JSFUnitTestingSecurePages,但以下内容应适用于不安全的页面
public class WebSphereRequestStrategy extends org.jboss.jsfunit.framework.SimpleInitialRequestStrategy {
public Page doInitialRequest(WebClientSpec wcSpec) throws IOException {
String jsessionid = wcSpec.removeCookie("JSESSIONID");
wcSpec.addCookie("JSESSIONID", "0000" + jsessionid); // cache ID is 0000 by default
return super.doInitialRequest(wcSpec);
}
},然后您将使用以下代码开始测试:
WebClientSpec wcSpec = new WebClientSpec("/index.jsf");
wcSpec.setInitialRequestStrategy(new WebSphereRequestStrategy());
JSFSession jsfSession = new JSFSession(wcSpec);
JSFClientSession client = jsfSession.getJSFClientSession();
JSFServerSession server = jsfSession.getJSFServerSession();https://stackoverflow.com/questions/3905150
复制相似问题