tags:

views:

18

answers:

1

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

A: 

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();
Odelya
@Odelya thanks for your help i successfully did my test
vinod