【问题标题】:Can i use WebSphere 6.1 for JSFunit?我可以将 WebSphere 6.1 用于 JSFunit 吗?
【发布时间】:2010-10-11 09:57:12
【问题描述】:

我在 jsfunit 上工作,并且我正在使用 WebSphere6.1 应用程序服务器,所以任何人都可以回答我是否与 JSFunit 兼容,或者我需要对我的服务器配置进行一些更改?如果可能的话,把例子发给我?

谢谢 维诺德

【问题讨论】:

    标签: jsf jsfunit


    【解决方案1】:

    是的,

    阅读JSFUnitOnWebSphere

    所以要将 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();
    

    【讨论】:

      猜你喜欢
      • 2021-02-25
      • 2012-04-04
      • 2018-04-12
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      • 1970-01-01
      • 2011-03-28
      • 1970-01-01
      相关资源
      最近更新 更多