You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by qz...@uiuc.edu on 2003/09/14 22:40:38 UTC

TestSampleServletConfig question

Hey,  I got a question on TestSampleServletConfig.  

I ran TestJettyAll in Eclipse and the arguments I used are:
-Dcactus.contextURL=http://localhost:8080/test -Dcactus.jetty.config=C:\Downloads\software\jakarta-cactus-1.5-beta1-src\samples\jetty\src\conf\jetty.xml -Dcactus.jetty.resourceDir=C:\Downloads\software\jakarta-cactus-1.5-beta1-src\samples\jetty\src\webapp

The tests ran successfully.  However, when I check the TestSampleServletConfig class, it occurs to me that its config object is set with the InitialParameters in jetty.xml, which are the initial parameters of ServletTestRedirector.  Is that the case? 

I added the following setUp() to the class:

public void setUp(){
    config.setInitParameter("param1", "HAHA");  
}

so that it will read the parameter of its own instead of that of the ServletRedirector.  I am just wondering if this should be a less confusing way to test ServletConfig.  Please correct me if I am wrong. Thanks.

Qing

RE: TestSampleServletConfig question

Posted by Vincent Massol <vm...@pivolis.com>.
Hi,

There are 2 ways to set init params using Cactus:

1/ in the redirector as init parameter
2/ using setInitParameter()

2/ is certainly easier (and I would recommend it) but 1/ performs better
real-life verification (as it's closer to what you'll have in
production).

Thanks
-Vincent

> -----Original Message-----
> From: qzhao2@uiuc.edu [mailto:qzhao2@uiuc.edu]
> Sent: 14 September 2003 22:41
> To: cactus-user@jakarta.apache.org
> Subject: TestSampleServletConfig question
> 
> Hey,  I got a question on TestSampleServletConfig.
> 
> I ran TestJettyAll in Eclipse and the arguments I used are:
> -Dcactus.contextURL=http://localhost:8080/test -
> Dcactus.jetty.config=C:\Downloads\software\jakarta-cactus-1.5-beta1-
> src\samples\jetty\src\conf\jetty.xml -
>
Dcactus.jetty.resourceDir=C:\Downloads\software\jakarta-cactus-1.5-beta1
-
> src\samples\jetty\src\webapp
> 
> 
> The tests ran successfully.  However, when I check the
> TestSampleServletConfig class, it occurs to me that its config object
is
> set with the InitialParameters in jetty.xml, which are the initial
> parameters of ServletTestRedirector.  Is that the case?
> 
> I added the following setUp() to the class:
> 
> public void setUp(){
>     config.setInitParameter("param1", "HAHA");
> }
> 
> so that it will read the parameter of its own instead of that of the
> ServletRedirector.  I am just wondering if this should be a less
confusing
> way to test ServletConfig.  Please correct me if I am wrong. Thanks.
> 
> Qing
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org