jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petar Tahchiev" <paranoia...@gmail.com>
Subject Re: How to set user principal in setUp()
Date Wed, 07 Jan 2009 09:15:27 GMT
Hi Nicole,

I think you misunderstand the purpose of Cactus.
Your test will always be executed in the server side.
This means that the testXXX methods are executed on the
server side. You can, however, execute two methods - beginXXX and endXXX
on the client side. This means the execution flow would be this:

beginXXX()  - >client side

startUp() -> serverside
testXXX() -> serverside
tearDown() ->serverside

endXXX() -> client side.


If you see the documentation of the WebRequest (the one you use in
beginXXX methods) there is no set-up for a caller principal. You can,
however
setup an Authentication object.

HTH, Petar.


2009/1/7, Nicole Luneburg <Nicole.Luneburg@lisasoft.com>:
>
> Hi all again ...
>
> I have a test class that extends org.apache.cactus.ServletTestCase.
> I'm running my tests server-side so using the setUp() and tearDown()
> methods.
>
> My question is ...
> How do I set a user in my request so that when I do a SessionContext
> getCallerPrincipal(), it is set?
>
> Right now I can only see that I can do the following in my setUp() method:
>
> super.request.setRemoteUser("testuser");
>
> but I can only obtain this value again via:
>
> super.request.getRemoteUser();
>
> I really need to know how to set caller principal ...
> Anyone any ideas?
> Will I be forced to run my tests from the client side to do this?
> Ie use the WebRequest parameter from the beginXXX() method instead?
>
> Any help really appreciated!
>
> Cheers,
> nic
>
> ________________________________
> The contents of this email are confidential and may be subject to legal or
> professional privilege and copyright. No representation is made that this
> email is free of viruses or other defects. If you have received this
> communication in error, you may not copy or distribute any part of it or
> otherwise disclose its contents to anyone. Please advise the sender of your
> incorrect receipt of this correspondence.
>



-- 
Regards, Petar!
Karlovo, Bulgaria.
- - - - - - - -
| Author @ Manning Publications.
| Senior Solution Architect @ Unic
| BGJUG-Bulgarian Java User Group Leader.
| Apache Jakarta PMC member.
| Jakarta Cactus Lead Developer.
| Blogger: http://weblogs.java.net/blog/paranoiabla/
- - - - - - - -
Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message