Although it isn't session timeout specifically, couldn't you just invalidate (invalidate() method on session object) the session by going to a specific url - eg servlet
Would that emulate the behaviour you are trying to achieve? Craig R. McClanahan wrote: >On Thu, 15 Aug 2002 [EMAIL PROTECTED] wrote: > > > >>Date: Thu, 15 Aug 2002 14:07:13 -0500 >>From: [EMAIL PROTECTED] >>Reply-To: Tomcat Users List <[EMAIL PROTECTED]> >>To: Tomcat Users List <[EMAIL PROTECTED]> >>Subject: Testing session time-out behaviour >> >> >>Hi, >> >>I have a web app with some specific requirements for session timeout. I >>would like to write automated acceptance tests to verify these >>requirements, and am faced with some options: >> >>- set web.xml to time-out in 1 minute, have my tests wait for just over a >>minute to force time-out >>- talk to my server (tomcat during testing) from the test client code >>(junit tests using httpunit) to somehow request it to time out >>- execute the shutdown / startup commands from the client code (session >>information for tomcat 4.0 goes away when i do this). I have a small app, >>so startup shutdown are both relatively quick (seconds). >> >> > >Waiting "just over a minute" is not guaranteed to work the way you think. >The reason for this is that session timeouts are performed in a background >thread that only runs periodically (typically every 15 seconds). > > > >>Waiting a minute is a pain, because I have to change web.xml and reset it, >>also because I have a lot of screens and behaviours to test (hence the >>desire to automate), so even setting down to a minute I expect it would >>take my automated test suite from what is now about 5 minutes to run to >>about 30 minutes. >> >> >> > >One thing to consider is that you can call >session.setMaxInactiveInterval() on a session instance itself, at a >granularity of seconds. You still need to deal with the 15 second time >though (unless you want to just simulate a timeout by forcibly >invalidating a session) -- you could add a special URL to your webapp to >do this in a test environment. > > > >>As far as communicating with tomcat goes, I tried doing a get on the >>manager urls to reload the app, also to stop followed by start - but this >>does not appear to cause it to lose the session information. >> >> >> > >That's true ... Tomcat saves and reloads sessions across a restart. > > > >>As far as executing startup / shutdown batch files, the rub is waiting on >>the shutdown and startup to complete before proceeding with the test. It >>is proving to be extremely tricky to do. >> >> >> > >You can forcibly eliminate any sessions saved by the previous shutdown by >deleting the "SESSIONS.ser" file in the work directory for your webapp. > > > >>So, from a java test client, is there a supported and relatively easy way >>for me to get tomcat to drop a session in the middle of a test? >>Suggestions? >> >>j >> >> > >Craig > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
