You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by "Keith D Gregory (JIRA)" <ca...@jakarta.apache.org> on 2008/04/15 23:12:22 UTC

[jira] Created: (CACTUS-256) ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed

ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed
-------------------------------------------------------------------------------------------------------------------------------

                 Key: CACTUS-256
                 URL: https://issues.apache.org/jira/browse/CACTUS-256
             Project: Cactus
          Issue Type: Improvement
          Components: Framework
    Affects Versions: 1.8, 1.7.2
            Reporter: Keith D Gregory


The first time ServletTestRunner gets invoked, it builds the context URL for the actual test requests, and saves it in the system property "cactus.contextURL" (BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY). All subsequent requests then use that property value, ignoring the actual request URL. This is bad on several levels.

First, because it's impolite to set system-wide properties in a shared execution environment. 

Second, and more important, because it prevents running tests in an environment that uses virtual homes and extracts information from the request URL. If you want to have particular behavior for requests to "foo.example.com", and have already run tests for "bar.example.com", you have to restart your container. Or spend a couple hours with a debugger and the Cactus source code, trying to figure out why your tests are failing (no, I'm not bitter :-)).

And third (just throwing this in for good measure), because it breaks the JUnit premise that tests execute in isolation, and are not dependent on execution order.

Personally, I can't see a reason for caching this value. It's not terribly expensive to create it anew for each run. For those people who do want to have their first test influence all subsequent tests, it could be a request parameter ("rememberThisHost=yes").

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (CACTUS-256) ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed

Posted by "Petar Tahchiev (JIRA)" <ca...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/CACTUS-256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601383#action_12601383 ] 

Petar Tahchiev commented on CACTUS-256:
---------------------------------------

Hi Keith,

First of all thanks for the suggestion, and sorry for my late response. :-(

I am not sure what was the initial reason for Cactus team to implement this cache mechanism. I guess that initially developers intended to use no more than one container, with no virtual homes. However your point is really reasonable and I would be glad to see a patch. I don't promise it will get accepted, but it's worth a try :-). 

> ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CACTUS-256
>                 URL: https://issues.apache.org/jira/browse/CACTUS-256
>             Project: Cactus
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 1.7.2, 1.8
>            Reporter: Keith D Gregory
>
> The first time ServletTestRunner gets invoked, it builds the context URL for the actual test requests, and saves it in the system property "cactus.contextURL" (BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY). All subsequent requests then use that property value, ignoring the actual request URL. This is bad on several levels.
> First, because it's impolite to set system-wide properties in a shared execution environment. 
> Second, and more important, because it prevents running tests in an environment that uses virtual homes and extracts information from the request URL. If you want to have particular behavior for requests to "foo.example.com", and have already run tests for "bar.example.com", you have to restart your container. Or spend a couple hours with a debugger and the Cactus source code, trying to figure out why your tests are failing (no, I'm not bitter :-)).
> And third (just throwing this in for good measure), because it breaks the JUnit premise that tests execute in isolation, and are not dependent on execution order.
> Personally, I can't see a reason for caching this value. It's not terribly expensive to create it anew for each run. For those people who do want to have their first test influence all subsequent tests, it could be a request parameter ("rememberThisHost=yes").

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (CACTUS-256) ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed

Posted by "Keith D Gregory (JIRA)" <ca...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/CACTUS-256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589268#action_12589268 ] 

Keith D Gregory commented on CACTUS-256:
----------------------------------------

Incidentally, I would be happy to produce a patch, if the committers concur that this is poor behavior. Seems like it should be a simple matter of saving the desired URL in the config object.

> ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CACTUS-256
>                 URL: https://issues.apache.org/jira/browse/CACTUS-256
>             Project: Cactus
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 1.7.2, 1.8
>            Reporter: Keith D Gregory
>
> The first time ServletTestRunner gets invoked, it builds the context URL for the actual test requests, and saves it in the system property "cactus.contextURL" (BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY). All subsequent requests then use that property value, ignoring the actual request URL. This is bad on several levels.
> First, because it's impolite to set system-wide properties in a shared execution environment. 
> Second, and more important, because it prevents running tests in an environment that uses virtual homes and extracts information from the request URL. If you want to have particular behavior for requests to "foo.example.com", and have already run tests for "bar.example.com", you have to restart your container. Or spend a couple hours with a debugger and the Cactus source code, trying to figure out why your tests are failing (no, I'm not bitter :-)).
> And third (just throwing this in for good measure), because it breaks the JUnit premise that tests execute in isolation, and are not dependent on execution order.
> Personally, I can't see a reason for caching this value. It's not terribly expensive to create it anew for each run. For those people who do want to have their first test influence all subsequent tests, it could be a request parameter ("rememberThisHost=yes").

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (CACTUS-256) ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed

Posted by "Keith D Gregory (JIRA)" <ca...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/CACTUS-256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12623124#action_12623124 ] 

Keith D Gregory commented on CACTUS-256:
----------------------------------------

Work and Real Life(tm) has kept me from this, but look for something in the September/October timeframe.

> ServletTestRunner should build test redirector URL from incoming request, not use CACTUS_CONTEXT_URL_PROPERTY unless instructed
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CACTUS-256
>                 URL: https://issues.apache.org/jira/browse/CACTUS-256
>             Project: Cactus
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 1.7.2, 1.8
>            Reporter: Keith D Gregory
>
> The first time ServletTestRunner gets invoked, it builds the context URL for the actual test requests, and saves it in the system property "cactus.contextURL" (BaseConfiguration.CACTUS_CONTEXT_URL_PROPERTY). All subsequent requests then use that property value, ignoring the actual request URL. This is bad on several levels.
> First, because it's impolite to set system-wide properties in a shared execution environment. 
> Second, and more important, because it prevents running tests in an environment that uses virtual homes and extracts information from the request URL. If you want to have particular behavior for requests to "foo.example.com", and have already run tests for "bar.example.com", you have to restart your container. Or spend a couple hours with a debugger and the Cactus source code, trying to figure out why your tests are failing (no, I'm not bitter :-)).
> And third (just throwing this in for good measure), because it breaks the JUnit premise that tests execute in isolation, and are not dependent on execution order.
> Personally, I can't see a reason for caching this value. It's not terribly expensive to create it anew for each run. For those people who do want to have their first test influence all subsequent tests, it could be a request parameter ("rememberThisHost=yes").

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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