[jsfunit-dev] Login form with spring security

Bernd Winterstein bernd.winterstein at googlemail.com
Thu Aug 20 08:48:33 EDT 2009


Hi,
I'm trying to write a test for a JSF application with spring security.
I see in the logfiles that the test successfully passes the login
dialog and the welcome page (secured) is loaded.
Nevertheless the test quits with an exception when creating the
JSFSession instance:
IllegalStateException: getAttribute Session already invalidated at

org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1032)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
at
org.jboss.jsfunit.framework.FacesContextBridge.getCurrentInstance(FacesContextBridge.java:56)
at
org.jboss.jsfunit.jsfsession.JSFServerSession.pageCreated(JSFServerSession.java:213)
at
org.jboss.jsfunit.jsfsession.JSFServerSession.<init>(JSFServerSession.java:56)
at
org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:83) at
JSFUnitTest.testInitialPage(JSFUnitTest.java:43)

regards,

Bernd


My test code is:

    WebClientSpec wcSpec = new WebClientSpec("/pages/summary.faces",
BrowserVersion.FIREFOX_3);
    FormAuthenticationStrategy formAuth = new
FormAuthenticationStrategy("test", "test", "loginButton",
"j_username", "j_password");
    wcSpec.setInitialRequestStrategy(formAuth);

   JSFSession jsfSession = new JSFSession(wcSpec); // <-- CRASHES

    JSFClientSession client = jsfSession.getJSFClientSession();
    RichFacesClient ajaxClient = new RichFacesClient(client);


More information about the jsfunit-dev mailing list