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.


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.
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?
----
Kazuhito SUGURI
mailto:[EMAIL PROTECTED]

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

Reply via email to