【发布时间】:2010-10-11 09:57:12
【问题描述】:
我在 jsfunit 上工作,并且我正在使用 WebSphere6.1 应用程序服务器,所以任何人都可以回答我是否与 JSFunit 兼容,或者我需要对我的服务器配置进行一些更改?如果可能的话,把例子发给我?
谢谢 维诺德
【问题讨论】:
我在 jsfunit 上工作,并且我正在使用 WebSphere6.1 应用程序服务器,所以任何人都可以回答我是否与 JSFunit 兼容,或者我需要对我的服务器配置进行一些更改?如果可能的话,把例子发给我?
谢谢 维诺德
【问题讨论】:
是的,
所以要将 WebSphere 与 JSFUnit 一起使用,您需要 将需要创建一个类 扩展其中之一 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();
【讨论】: