I agree that servlet config properties should be placed in a resource
bundle, preferable residing in a known file location outside of the
webapp deployment unit. There are good architectural reasons to do this,
besides making them available on the cactus client:

o it can be modified without rebuilding the web app

o an admin web page can edit the config entries and save the changes

o separation of concerns: global config params typically pertain to
application semantics, whereas the rest of web.xml pertains to the
servlet mechanism

o separation of roles: developer vs. administrator

o it is easier to generate the web.xml automatically

I find web.xml too complex and critical to touch directly. I prefer to
generate it from javadoc tags on the individual servlet classes using
xdoclet and put volatle config information in a properties file instead.

Fred Loney
Spirited Software, Inc.
www.spiritedsw.com

----- Original Message -----
From: "Vincent Massol" <[EMAIL PROTECTED]>
To: "'Cactus Users List'" <[EMAIL PROTECTED]>
Sent: Monday, March 17, 2003 11:46 PM
Subject: RE: Conventions for "configuring" TestCase classes?


> Hi David,
>
> Why don't you use a ResourceBundle?
>
> public void beginXXX()
> {
>     PropertyResourceBundle bundle =
ResourceBundle.getBundle("myprops");
>     bundle.getString("someproperty");
> [...]
>
> Alternatively, if you're using a script to run the test, you can pass
> the properties as system properties, using the -D switch. For example
> with Ant:
>
>         <junit printsummary="yes" haltonfailure="yes" fork="yes">
>             <jvmarg value="-Dsome.thing=some.value"/>
> [...]
>
> Note that Cactus 1.5 offers a one time initialization mechanism
> (begin()) which you can use to initialize values.
>
> Hope it helps,
> -Vincent
>
> > -----Original Message-----
> > From: David M. Karr [mailto:[EMAIL PROTECTED]
> > Sent: 18 March 2003 03:45
> > To: [EMAIL PROTECTED]
> > Subject: Conventions for "configuring" TestCase classes?
> >
> > I have some configuration parameters I'd like to set for my
TestCases.
> > I'd
> > prefer not to hardcode them in the class.  I can't just use the
> "web.xml"
> > and
> > set servlet init parameters because I need these parameters to be
> readable
> > on
> > the client side of the TestCase.
> >
> > What do people normally do in this situation?
> >
> > --
> > ===================================================================
> > David M. Karr          ; Java/J2EE/XML/Unix/C++
> > [EMAIL PROTECTED]   ; SCJP; SCWCD
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to