jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John.Cot...@ubs.com
Subject Test a Servlet With Authentication
Date Fri, 08 Oct 2004 14:47:29 GMT

I am trying setup testcases with for an application that has a security-constraint on the
front controller (struts ActionServlet), running on Tomcat 4.1.27. We are using FormAuthentication
with a JOB realm.

I am using StrutsTestCase, and I saw the documentation located at http://strutstestcase.sourceforge.net/.
Since we cannot predetermine which testcase will run first, and the documented technique cannot
run in the setup, this means that every testcase is going have to be coded to do the the login
action, prior to doing the testing the action that is the subject of the testcase.

My first solution was to create a mock or stub of the principle and credential objects and
put them into session. However, the setPrincipal method is not exposed in the standard HttpSession
api, and the implemented sessionObject is not visible.

Does anyone have any suggestions?


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

View raw message