jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanket Desai" <sde...@firstgenetic.net>
Subject RE: Passing argument to Cactus using servlet
Date Wed, 22 Dec 2004 23:27:17 GMT
Hi Vincent,

Thanks for the reply.

Nice to know that Cactus by itself passes on "real request".

I checked the source code of CactusStrutsTestCase & saw that it initialized a new request
& passes that one to the caller. Little weird but does not help me.

So I wrote a small servlet that extends "ServletTestRunner" & override doGet() method,
get the request parameter (set in the System.setProperty() as they do for some cactus property)
& then call super.doGet().

So my Cactus Test class now calls System.getProperty() to retrieve the parameter passed to
the servlet by Jmeter. I know this is not an elegant solution but hey, it works for me.

Thanks vincent again for the help.

Have a great day.

Sanket Desai

-----Original Message-----
From: Vincent Massol [mailto:vmassol@pivolis.com] 
Sent: Wednesday, December 22, 2004 4:12 PM
To: 'Cactus Users List'
Subject: RE: Passing argument to Cactus using servlet

Hi Sankeet,

> -----Original Message-----
> From: Sanket Desai [mailto:sdesai@firstgenetic.net]
> Sent: mercredi 22 d├ęcembre 2004 21:31
> To: cactus-user@jakarta.apache.org
> Subject: Passing argument to Cactus using servlet
> Hi there,
> I'm calling onto cactus using JMeter.
> Basically calling "ServletTestRunner" servlet while passing
> 1) suite="Fully_Qualified_TestSuiteName"
> 2) myArg=myValue
> I see that the test gets called but I need to access my passed 
> argument
> (myArg) in my test class that I passed from JMeter. Unfortunately that 
> parameter is not available.I guess the "request" parameter that we 
> have using "getRequest()" method of "CactusStrutsTestCase" or "public 
> request variable" of ServletTestCase is actually provided by Cactus itself.

No, that should work fine. The "request" object that you're getting is the real request object.
To my knowledge, we have several tests in the Cactus test suite that pass HTTP parameters
to the server side.

Ah, I can think of only possible reason why it wouldn't work: maybe StrutsTestCase does not
pass the original request? I have never used strutstestcase so I don't know but try without
strutstestcase as a test and it should work fine. You can ask on the strutstestcase mailing
list. Maybe they'll be able to help?

> Does anyone know a way of retrieving the passed request parameter to 
> cactus in the test class?
> I really apreciate any help / pointers in this scenario.
> Thanking you in advance.
> Regards,
> Sanket Desai

To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org

View raw message