> -----Original Message-----
> From: Kazuhito SUGURI [mailto:[EMAIL PROTECTED]
> Sent: 19 June 2004 19:52
> To: [EMAIL PROTECTED]
> Subject: Re: ServletTestRunner and multiple Web Applications
>
> Hi Vincent,
>
> In article <[EMAIL PROTECTED]>,
> Sat, 19 Jun 2004 15:46:16 +0200,
> "Vincent Massol" <[EMAIL PROTECTED]> wrote:
> vmassol> This means that it was pure luck that Cactus was working for
you
> vmassol> before... ;-)
>
> indeed...
>
>
> vmassol> Also, the call to setSystemProperties() happen in the doGet()
> method,
> vmassol> i.e. for each call to the Servlet Test Runner. Thus, if the
> contextURL
> vmassol> property changes, it should work fine, no? It means that you
> would need
> vmassol> to change this property between your 2 webapp tests, which
seems
> normal
> vmassol> to me. What am I missing?
>
> The following is extracted from
ServeltTestRunner#setSystemProperties()
> of Cactus-1.6.1:
> String contextURL = System.getProperty(
> BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY);
>
> if (contextURL == null)
> {
> System.setProperty(
> BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY,
> "http://" + theRequest.getServerName() + ":"
> + theRequest.getServerPort()
> + theRequest.getContextPath());
> }
> The lifetime of the System object may be the point.
> I think, but not sure, once the contextURL property is set
> for the first test, the same property value may be used for other
tests
> if the server is not re-started.
I don't think so as calling System.setProperty() overwrites the previous
value.
>
>
> One more thing. One may try to set the contextURL System property
> for each app by using WEB-INF/classes/cactus.properties.
> However, ConfigurationInitializer#initialize() will not update
> the System property if it already exists.
Yes, that's more likely the problem here.
> So, I think, once a ServletTestRunner of app1 set the cntextURL
property,
> no other apps can change that.
>
>
> A way to solve this is to change
ServeltTestRunner#setSystemProperties()
> method as like as follows (shows core logic only):
> ResourceBundle config =
PropertyResourceBundle.getBundle("cactus");
> String contextURL =
> config.getString(BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY);
> if (contextURL == null)
> {
> contextURL = "http://" + theRequest.getServerName() + ":"
> + theRequest.getServerPort()
> + theRequest.getContextPath();
>
> }
>
System.setProperty(BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY,
> contextURL);
>
> What do you think?
I think that we could change the current behavior but before doing so we
must decide whether we want to accept Mark's use case as a valid Cactus
use case. ATM, this is not the case and Cactus is not meant to support
this. And before we take this call, I'd like more information from Mark.
Hence the questions I've asked in my answer.
Also, the code you mention will only solve the problem for the Servlet
Test Runner but NOT for the other integrations (Ant, Maven, etc).
So I'd rather:
1/ Mark use Cactus as it is meant
2/ or Mark can convince us that he has a valid use case, in which case
we need to modify Cactus in several places to support this.
Thanks
-Vincent
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]