0
我正在做jsfunit的工作,我正在使用WebSphere6.1應用程序服務器,所以任何人都可以給我答案,它與JSFunit兼容,或者我需要在服務器配置中做一些更改?如果可能的話給我舉個例子?我可以使用WebSphere 6.1 for JSFunit嗎?
感謝 維諾德
我正在做jsfunit的工作,我正在使用WebSphere6.1應用程序服務器,所以任何人都可以給我答案,它與JSFunit兼容,或者我需要在服務器配置中做一些更改?如果可能的話給我舉個例子?我可以使用WebSphere 6.1 for 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();
感謝您的幫助,我成功完成了我的測試 – vinod 2010-10-12 13:29:16