vinod
vinod

Reputation: 1202

Can i use WebSphere 6.1 for JSFunit?

I am doing work on jsfunit, and i am using WebSphere6.1 application server so can anyone give me answer that is it compatible for JSFunit or i need to do some changes in my server configuration? if possible send me the example?

Thanks Vinod

Upvotes: 0

Views: 251

Answers (1)

Dejell
Dejell

Reputation: 14317

Yes,

Read JSFUnitOnWebSphere:

So to use WebSphere with JSFUnit, you will need to create a class that extends one of the InitialRequestStrategy classes. See JSFUnitTestingSecurePages for other examples, but the following should work for non-secure pages

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);
   }
}

Then you will use this code to start your test:

WebClientSpec wcSpec = new WebClientSpec("/index.jsf");
wcSpec.setInitialRequestStrategy(new WebSphereRequestStrategy());
JSFSession jsfSession = new JSFSession(wcSpec);
JSFClientSession client = jsfSession.getJSFClientSession();
JSFServerSession server = jsfSession.getJSFServerSession();

Upvotes: 2

Related Questions