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 Roger Kitain <Ro...@Sun.COM> on 2004/08/05 22:35:48 UTC

Changing web.xml conext init param...

i,

I'm using cactus 1.6.   How can I dynamically change the a context init 
param
(that was loaded from my web.xml file) from within a test case?
Here's what I have:

in web.xml:
.
.
   <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
   </context-param>


In my test case I was doing the following:

public class TestRenderResponsePhase extends JspFacesTestCase    {
.
.
.
    public void setUp() {
                                                                                             

        ServletContextWrapper sc = new 
ServletContextWrapper(config.getServletContext());
        sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
            "client");
.
.
.
Not sure the new context param is set.....

Any help would be greatly appreciated....

Thanks, Roger.



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


RE: Changing web.xml conext init param...

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

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: mardi 10 août 2004 14:57
> To: Cactus Developers List
> Cc: Vincent Massol
> Subject: Re: Changing web.xml conext init param...
> 
> I guess I should clarify that with - How can we still use Cactus to do
> that
> piece of functionality?  We do use Cactus heavily for our unit tests and
> for
> the most part it works great.  But what we need to do is also run our
> unit tests
> with this ServletContext init param set one way  - and then the other.
> The only other thing I can think of is having our ant script (that kicks
> off
> the unit tests), manipulate the web.xml file before the tests are run.
> 

Using setInitParameter() is much easier than manipulating the web.xml file.

-Vincent

> Thanks, Roger.
> 
> Roger Kitain wrote:
> 
> > Hi Vincent -
> >
> > The code that needs to be tested (not the cactus test itself) examines
> > the
> > ServletContext context init param (the original one -
> > javax.servlet.ServletContext).
> > How can we still use Cactus?
> > Thanks, Roger.
> >
> > Vincent Massol wrote:
> >
> >> Hi Roger,
> >>
> >> Don't be afraid! There should be no problem whatsoever for the
> >> working code
> >> as it will use the context provided by Cactus. I don't understand your
> >> problem and I don't think there's any.
> >>
> >> The only case I can think of where it would be a problem is if your
> code
> >> does something like this:
> >>
> >> if (context.getClass().getName().equals("javax.servlet.[...]"))
> >>
> >> But then that would really not be a best practice...
> >>
> >> -Vincent
> >>
> >>
> >>
> >>> -----Original Message-----
> >>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>> Sent: mardi 10 août 2004 13:49
> >>> To: Cactus Developers List
> >>> Cc: Vincent Massol
> >>> Subject: Re: Changing web.xml conext init param...
> >>>
> >>> Hi Vincent -
> >>>
> >>> That's what I was afraid of...  Some of our code that needs to be
> >>> tested,
> >>> actually executes differently depending on the actual web.xml
> >>> context init param value.  Ideally, we need a mechanism that will
> allow
> >>> us to manipulate the underlying "real" value.  We'll have to explore
> >>> other
> >>> opportunities.
> >>>
> >>> Thanks, Roger.
> >>>
> >>> Vincent Massol wrote:
> >>>
> >>>
> >>>
> >>>> Hi Roger,
> >>>>
> >>>> It's normal it's not working. When you write:
> >>>>
> >>>> assertTrue(
> >>>>   context.getOriginalContext().getInitParameter("param").equals(
> >>>>   "testoverrideparam"));
> >>>>
> >>>> You have to understand that by calling getOriginalContext() you're
> >>>> asking
> >>>> for ... well... the original context and not the one you're working
> >>>> on!
> >>>>
> >>>> It should be:
> >>>>
> >>>> assertTrue(
> >>>>   context.getInitParameter("param").equals("testoverrideparam"));
> >>>>
> >>>> -Vincent
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>> Sent: mardi 10 août 2004 00:07
> >>>>> To: Vincent Massol
> >>>>> Cc: 'Cactus Developers List'
> >>>>> Subject: Re: Changing web.xml conext init param...
> >>>>>
> >>>>> Hi Vincent -
> >>>>>
> >>>>> Thanks for the test module.  I also found it under the cactus
> samples
> >>>>> dir...
> >>>>> I've tested the sample and it works as is.  However, I tweaked it
> >>>>> slightly:
> >>>>>
> >>>>>   public void testSetContextInitParameterOverrideWebXmlParameter()
> >>>>>   {
> >>>>>       // Note: "param" is a parameter that must be already defined
> in
> >>>>>       // web.xml (in the context-param element), with a value
> >>>>>
> >>>>
> >>> different
> >>>
> >>>
> >>>>>       // than "testoverrideparam1".
> >>>>>       assertTrue("'param' context-param should been defined in
> >>>>>
> >>>>
> >>> web.xml",
> >>>
> >>>
> >>>>>           context.getOriginalContext().getInitParameter("param") !=
> >>>>> null);
> >>>>>       assertTrue(
> >>>>>
> >>>>> !context.getOriginalContext().getInitParameter("param").equals(
> >>>>>           "testoverrideparam"));
> >>>>>
> >>>>>
> >>>>>       context.setInitParameter("param", "testoverrideparam");
> >>>>>
> >>>>> // Added this assertion which fails.....
> >>>>>
> >>>>>
> >>>>>       assertTrue(
> >>>>>
> >>>>>
> >>>>
> >>> context.getOriginalContext().getInitParameter("param").equals(
> >>>
> >>>
> >>>>>           "testoverrideparam"));
> >>>>>
> >>>>>
> >>>>> Should the "setInitParameter" call have affected (or changed in this
> >>>>>
> >>>>
> >>> case)
> >>>
> >>>
> >>>>> the underlying ServletContext init parameter?
> >>>>>
> >>>>> The reason why I ask, is that ideally, that is what we want for
> >>>>> our test
> >>>>> cases.
> >>>>> We have code that checks the actual init param and does something
> >>>>>
> >>>>
> >>> slightly
> >>>
> >>>
> >>>>> different depending on the value of the param.  We want to test this
> >>>>>
> >>>>
> >>> code
> >>>
> >>>
> >>>>> with Cactus.
> >>>>>
> >>>>> Thanks, in advance, Roger.
> >>>>>
> >>>>>
> >>>>>
> >>>>> Vincent Massol wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Roger,
> >>>>>>
> >>>>>> That attachment may have been stripped by the mailing list
> >>>>>> manager. I'm
> >>>>>> ccing your private email address to ensure you receive it this
> time.
> >>>>>>
> >>>>>> Thanks
> >>>>>> -Vincent
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> -----Original Message-----
> >>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>> Sent: lundi 9 août 2004 17:06
> >>>>>>> To: Cactus Developers List; vmassol@pivolis.com
> >>>>>>> Subject: Re: Changing web.xml conext init param...
> >>>>>>>
> >>>>>>> Hi Vincent,
> >>>>>>>
> >>>>>>> I did not receive an example in your last email.  Can you resend?
> >>>>>>>
> >>>>>>> Thanks, in advance, Roger.
> >>>>>>>
> >>>>>>> Vincent Massol wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> Hi Riger,
> >>>>>>>>
> >>>>>>>> I don't know what's wrong. Maybe the fact that you're using a
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>> JspTestCase
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>> and not a ServletTestCase?
> >>>>>>>>
> >>>>>>>> Could you try running the example I've included in my previous
> >>>>>>>> email
> >>>>>>>>
> >>>>>>>
> >>> to
> >>>
> >>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>> you
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> to see if it works on your machine? If it works, you can work
> from
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>> there
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>> and
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>> slowly modify the sample to your target test.
> >>>>>>>>
> >>>>>>>> Thanks
> >>>>>>>> -Vincent
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> -----Original Message-----
> >>>>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>>>> Sent: lundi 9 août 2004 14:55
> >>>>>>>>> To: cactus-dev@jakarta.apache.org
> >>>>>>>>> Cc: vmassol@pivolis.com
> >>>>>>>>> Subject: Re: Changing web.xml conext init param...
> >>>>>>>>>
> >>>>>>>>> Hi,
> >>>>>>>>>
> >>>>>>>>> I've changed the code accordingly with no success:
> >>>>>>>>>
> >>>>>>>>> public class TestRenderResponsePhase extends JspFacesTestCase {
> >>>>>>>>> .
> >>>>>>>>> .
> >>>>>>>>>
> >>>>>>>>>   public void setUp() {
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> ((ServletContextWrapper)config.getServletContext()).setInitParameter
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>> (
> >>>
> >>>
> >>>>>>>>>         "javax.faces.STATE_SAVING_METHOD", "client");
> >>>>>>>>>     System.out.println("GET INIT PARAM"+
> >>>>>>>>>         Config.getServletContext().getInitParameter(
> >>>>>>>>>         "javax.faces.STATE_SAVING_METHOD"));
> >>>>>>>>> .
> >>>>>>>>> .
> >>>>>>>>> .
> >>>>>>>>>
> >>>>>>>>> It appears the init parameter still has the default "server"
> >>>>>>>>> value.
> >>>>>>>>>
> >>>>>>>>> Shouldn't this have worked?  What am I missing?
> >>>>>>>>>
> >>>>>>>>> Thanks in advance, Roger
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Vincent Massol wrote:
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> Hi Roger,
> >>>>>>>>>>
> >>>>>>>>>> Your code is invalid. You should write:
> >>>>>>>>>>
> >>>>>>>>>> ((ServletContextWrapper)
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> Config.getServletContext()).setInitParameter(...);
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> As shown in the sample application, part of the Cactus
> >>>>>>>>>> distribution
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>> (I'm
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>>> attaching one of its class for your reference).
> >>>>>>>>>>
> >>>>>>>>>> -Vincent
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>> -----Original Message-----
> >>>>>>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>>>>>> Sent: jeudi 5 août 2004 22:36
> >>>>>>>>>>> To: cactus-dev@jakarta.apache.org
> >>>>>>>>>>> Subject: Changing web.xml conext init param...
> >>>>>>>>>>>
> >>>>>>>>>>> i,
> >>>>>>>>>>>
> >>>>>>>>>>> I'm using cactus 1.6.   How can I dynamically change the a
> >>>>>>>>>>> context
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>> init
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>>>> param
> >>>>>>>>>>> (that was loaded from my web.xml file) from within a test
> case?
> >>>>>>>>>>> Here's what I have:
> >>>>>>>>>>>
> >>>>>>>>>>> in web.xml:
> >>>>>>>>>>> .
> >>>>>>>>>>> .
> >>>>>>>>>>> <context-param>
> >>>>>>>>>>>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>>>>>>>>>>   <param-value>server</param-value>
> >>>>>>>>>>> </context-param>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> In my test case I was doing the following:
> >>>>>>>>>>>
> >>>>>>>>>>> public class TestRenderResponsePhase extends
> >>>>>>>>>>> JspFacesTestCase    {
> >>>>>>>>>>> .
> >>>>>>>>>>> .
> >>>>>>>>>>> .
> >>>>>>>>>>> public void setUp() {
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>    ServletContextWrapper sc = new
> >>>>>>>>>>> ServletContextWrapper(config.getServletContext());
> >>>>>>>>>>>    sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>>>>>>>>>>        "client");
> >>>>>>>>>>> .
> >>>>>>>>>>> .
> >>>>>>>>>>> .
> >>>>>>>>>>> Not sure the new context param is set.....
> >>>>>>>>>>>
> >>>>>>>>>>> Any help would be greatly appreciated....
> >>>>>>>>>>>
> >>>>>>>>>>> Thanks, Roger.
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> --------------------------------------------------------------
> ----
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>> --
> >>>
> >>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>> -
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>>>> To unsubscribe, e-mail:
> >>>>>>>>>>> cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>>>>> For additional commands, e-mail: cactus-dev-
> >>>>>>>>>>>
> >>>>>>>>>>
> >>> help@jakarta.apache.org
> >>>
> >>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> ---------------------------------------------------------------
> ----
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>> --
> >>>
> >>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>> --
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>> -
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>>> ---------------------------------------------------------------
> ----
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>> --
> >>>
> >>>
> >>>>>>>>>> To unsubscribe, e-mail:
> >>>>>>>>>> cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>>>> For additional commands, e-mail:
> >>>>>>>>>> cactus-dev-help@jakarta.apache.org
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>> -----------------------------------------------------------------
> ----
> >>>>>>>>
> >>>>>>>> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>> For additional commands, e-mail:
> >>>>>>>> cactus-dev-help@jakarta.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>
> >>
> >>
> >
> >
> 



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
I guess I should clarify that with - How can we still use Cactus to do that
piece of functionality?  We do use Cactus heavily for our unit tests and 
for
the most part it works great.  But what we need to do is also run our 
unit tests
with this ServletContext init param set one way  - and then the other.
The only other thing I can think of is having our ant script (that kicks off
the unit tests), manipulate the web.xml file before the tests are run.

Thanks, Roger.

Roger Kitain wrote:

> Hi Vincent -
>
> The code that needs to be tested (not the cactus test itself) examines 
> the
> ServletContext context init param (the original one - 
> javax.servlet.ServletContext).
> How can we still use Cactus?
> Thanks, Roger.
>
> Vincent Massol wrote:
>
>> Hi Roger,
>>
>> Don't be afraid! There should be no problem whatsoever for the 
>> working code
>> as it will use the context provided by Cactus. I don't understand your
>> problem and I don't think there's any.
>>
>> The only case I can think of where it would be a problem is if your code
>> does something like this:
>>
>> if (context.getClass().getName().equals("javax.servlet.[...]"))
>>
>> But then that would really not be a best practice...
>>
>> -Vincent
>>
>>  
>>
>>> -----Original Message-----
>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>> Sent: mardi 10 août 2004 13:49
>>> To: Cactus Developers List
>>> Cc: Vincent Massol
>>> Subject: Re: Changing web.xml conext init param...
>>>
>>> Hi Vincent -
>>>
>>> That's what I was afraid of...  Some of our code that needs to be 
>>> tested,
>>> actually executes differently depending on the actual web.xml
>>> context init param value.  Ideally, we need a mechanism that will allow
>>> us to manipulate the underlying "real" value.  We'll have to explore 
>>> other
>>> opportunities.
>>>
>>> Thanks, Roger.
>>>
>>> Vincent Massol wrote:
>>>
>>>   
>>>
>>>> Hi Roger,
>>>>
>>>> It's normal it's not working. When you write:
>>>>
>>>> assertTrue(
>>>>   context.getOriginalContext().getInitParameter("param").equals(
>>>>   "testoverrideparam"));
>>>>
>>>> You have to understand that by calling getOriginalContext() you're 
>>>> asking
>>>> for ... well... the original context and not the one you're working 
>>>> on!
>>>>
>>>> It should be:
>>>>
>>>> assertTrue(
>>>>   context.getInitParameter("param").equals("testoverrideparam"));
>>>>
>>>> -Vincent
>>>>
>>>>
>>>>
>>>>     
>>>>
>>>>> -----Original Message-----
>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>> Sent: mardi 10 août 2004 00:07
>>>>> To: Vincent Massol
>>>>> Cc: 'Cactus Developers List'
>>>>> Subject: Re: Changing web.xml conext init param...
>>>>>
>>>>> Hi Vincent -
>>>>>
>>>>> Thanks for the test module.  I also found it under the cactus samples
>>>>> dir...
>>>>> I've tested the sample and it works as is.  However, I tweaked it
>>>>> slightly:
>>>>>
>>>>>   public void testSetContextInitParameterOverrideWebXmlParameter()
>>>>>   {
>>>>>       // Note: "param" is a parameter that must be already defined in
>>>>>       // web.xml (in the context-param element), with a value
>>>>>       
>>>>
>>> different
>>>   
>>>
>>>>>       // than "testoverrideparam1".
>>>>>       assertTrue("'param' context-param should been defined in
>>>>>       
>>>>
>>> web.xml",
>>>   
>>>
>>>>>           context.getOriginalContext().getInitParameter("param") !=
>>>>> null);
>>>>>       assertTrue(
>>>>>
>>>>> !context.getOriginalContext().getInitParameter("param").equals(
>>>>>           "testoverrideparam"));
>>>>>
>>>>>
>>>>>       context.setInitParameter("param", "testoverrideparam");
>>>>>
>>>>> // Added this assertion which fails.....
>>>>>
>>>>>
>>>>>       assertTrue(
>>>>>
>>>>>       
>>>>
>>> context.getOriginalContext().getInitParameter("param").equals(
>>>   
>>>
>>>>>           "testoverrideparam"));
>>>>>
>>>>>
>>>>> Should the "setInitParameter" call have affected (or changed in this
>>>>>       
>>>>
>>> case)
>>>   
>>>
>>>>> the underlying ServletContext init parameter?
>>>>>
>>>>> The reason why I ask, is that ideally, that is what we want for 
>>>>> our test
>>>>> cases.
>>>>> We have code that checks the actual init param and does something
>>>>>       
>>>>
>>> slightly
>>>   
>>>
>>>>> different depending on the value of the param.  We want to test this
>>>>>       
>>>>
>>> code
>>>   
>>>
>>>>> with Cactus.
>>>>>
>>>>> Thanks, in advance, Roger.
>>>>>
>>>>>
>>>>>
>>>>> Vincent Massol wrote:
>>>>>
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>> Roger,
>>>>>>
>>>>>> That attachment may have been stripped by the mailing list 
>>>>>> manager. I'm
>>>>>> ccing your private email address to ensure you receive it this time.
>>>>>>
>>>>>> Thanks
>>>>>> -Vincent
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>         
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>> Sent: lundi 9 août 2004 17:06
>>>>>>> To: Cactus Developers List; vmassol@pivolis.com
>>>>>>> Subject: Re: Changing web.xml conext init param...
>>>>>>>
>>>>>>> Hi Vincent,
>>>>>>>
>>>>>>> I did not receive an example in your last email.  Can you resend?
>>>>>>>
>>>>>>> Thanks, in advance, Roger.
>>>>>>>
>>>>>>> Vincent Massol wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>> Hi Riger,
>>>>>>>>
>>>>>>>> I don't know what's wrong. Maybe the fact that you're using a
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>
>>>>> JspTestCase
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>>>> and not a ServletTestCase?
>>>>>>>>
>>>>>>>> Could you try running the example I've included in my previous 
>>>>>>>> email
>>>>>>>>             
>>>>>>>
>>> to
>>>   
>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>
>>>>>>> you
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>> to see if it works on your machine? If it works, you can work from
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>
>>>>> there
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>>>>             
>>>>>>>
>>>>>>> and
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>> slowly modify the sample to your target test.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> -Vincent
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>>
>>>>>>>>> -----Original Message-----
>>>>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>> Sent: lundi 9 août 2004 14:55
>>>>>>>>> To: cactus-dev@jakarta.apache.org
>>>>>>>>> Cc: vmassol@pivolis.com
>>>>>>>>> Subject: Re: Changing web.xml conext init param...
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I've changed the code accordingly with no success:
>>>>>>>>>
>>>>>>>>> public class TestRenderResponsePhase extends JspFacesTestCase {
>>>>>>>>> .
>>>>>>>>> .
>>>>>>>>>
>>>>>>>>>   public void setUp() {
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ((ServletContextWrapper)config.getServletContext()).setInitParameter 
>>>>>>>>>
>>>>>>>>>               
>>>>>>>>
>>> (
>>>   
>>>
>>>>>>>>>         "javax.faces.STATE_SAVING_METHOD", "client");
>>>>>>>>>     System.out.println("GET INIT PARAM"+
>>>>>>>>>         Config.getServletContext().getInitParameter(
>>>>>>>>>         "javax.faces.STATE_SAVING_METHOD"));
>>>>>>>>> .
>>>>>>>>> .
>>>>>>>>> .
>>>>>>>>>
>>>>>>>>> It appears the init parameter still has the default "server"  
>>>>>>>>> value.
>>>>>>>>>
>>>>>>>>> Shouldn't this have worked?  What am I missing?
>>>>>>>>>
>>>>>>>>> Thanks in advance, Roger
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Vincent Massol wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>               
>>>>>>>>>
>>>>>>>>>> Hi Roger,
>>>>>>>>>>
>>>>>>>>>> Your code is invalid. You should write:
>>>>>>>>>>
>>>>>>>>>> ((ServletContextWrapper)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>>>>>>>> Config.getServletContext()).setInitParameter(...);
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>               
>>>>>>>>>
>>>>>>>>>> As shown in the sample application, part of the Cactus 
>>>>>>>>>> distribution
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>>>>>> (I'm
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>>>> attaching one of its class for your reference).
>>>>>>>>>>
>>>>>>>>>> -Vincent
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>>
>>>>>>>>>>> -----Original Message-----
>>>>>>>>>>> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>>>> Sent: jeudi 5 août 2004 22:36
>>>>>>>>>>> To: cactus-dev@jakarta.apache.org
>>>>>>>>>>> Subject: Changing web.xml conext init param...
>>>>>>>>>>>
>>>>>>>>>>> i,
>>>>>>>>>>>
>>>>>>>>>>> I'm using cactus 1.6.   How can I dynamically change the a 
>>>>>>>>>>> context
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                   
>>>>>>>>>>
>>>>>>> init
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>>>>> param
>>>>>>>>>>> (that was loaded from my web.xml file) from within a test case?
>>>>>>>>>>> Here's what I have:
>>>>>>>>>>>
>>>>>>>>>>> in web.xml:
>>>>>>>>>>> .
>>>>>>>>>>> .
>>>>>>>>>>> <context-param>
>>>>>>>>>>>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>>>>>>>>   <param-value>server</param-value>
>>>>>>>>>>> </context-param>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> In my test case I was doing the following:
>>>>>>>>>>>
>>>>>>>>>>> public class TestRenderResponsePhase extends 
>>>>>>>>>>> JspFacesTestCase    {
>>>>>>>>>>> .
>>>>>>>>>>> .
>>>>>>>>>>> .
>>>>>>>>>>> public void setUp() {
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>    ServletContextWrapper sc = new
>>>>>>>>>>> ServletContextWrapper(config.getServletContext());
>>>>>>>>>>>    sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>>>>>>>>        "client");
>>>>>>>>>>> .
>>>>>>>>>>> .
>>>>>>>>>>> .
>>>>>>>>>>> Not sure the new context param is set.....
>>>>>>>>>>>
>>>>>>>>>>> Any help would be greatly appreciated....
>>>>>>>>>>>
>>>>>>>>>>> Thanks, Roger.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ------------------------------------------------------------------ 
>>>>>>>>>>>
>>>>>>>>>>>                   
>>>>>>>>>>
>>> -- 
>>>   
>>>
>>>>>>>>>>>                   
>>>>>>>>>>
>>>>> -
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>> cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>>> For additional commands, e-mail: cactus-dev-
>>>>>>>>>>>                   
>>>>>>>>>>
>>> help@jakarta.apache.org
>>>   
>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                   
>>>>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>> -- 
>>>   
>>>
>>>>>>>>>>                 
>>>>>>>>>
>>>>> -- 
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>>>>>> -
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>>>
>>>>>>>>>> ------------------------------------------------------------------- 
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>> -- 
>>>   
>>>
>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>> cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>> cactus-dev-help@jakarta.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                 
>>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>> For additional commands, e-mail: 
>>>>>>>> cactus-dev-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>             
>>>>>>>
>>>>>>
>>>>>>
>>>>>>         
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>     
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>
>>  
>>
>
>



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Ok.  That will work.  We can seed our Cactus testing framework with the
ServletContextWrapper.  Thanks for your help.

Thanks, Roger.

Vincent Massol wrote:

>The context that is passed by Cactus to your code under test implements
>javax.servlet.ServletContext so it makes no difference at all from your
>code's point of view.
>
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: mardi 10 août 2004 14:20
>>To: Cactus Developers List; Vincent Massol
>>Subject: Re: Changing web.xml conext init param...
>>
>>Hi Vincent -
>>
>>The code that needs to be tested (not the cactus test itself) examines the
>>ServletContext context init param (the original one -
>>javax.servlet.ServletContext).
>>How can we still use Cactus?
>>
>>Thanks, Roger.
>>
>>Vincent Massol wrote:
>>
>>    
>>
>>>Hi Roger,
>>>
>>>Don't be afraid! There should be no problem whatsoever for the working
>>>      
>>>
>>code
>>    
>>
>>>as it will use the context provided by Cactus. I don't understand your
>>>problem and I don't think there's any.
>>>
>>>The only case I can think of where it would be a problem is if your code
>>>does something like this:
>>>
>>>if (context.getClass().getName().equals("javax.servlet.[...]"))
>>>
>>>But then that would really not be a best practice...
>>>
>>>-Vincent
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>Sent: mardi 10 août 2004 13:49
>>>>To: Cactus Developers List
>>>>Cc: Vincent Massol
>>>>Subject: Re: Changing web.xml conext init param...
>>>>
>>>>Hi Vincent -
>>>>
>>>>That's what I was afraid of...  Some of our code that needs to be
>>>>        
>>>>
>>tested,
>>    
>>
>>>>actually executes differently depending on the actual web.xml
>>>>context init param value.  Ideally, we need a mechanism that will allow
>>>>us to manipulate the underlying "real" value.  We'll have to explore
>>>>        
>>>>
>>other
>>    
>>
>>>>opportunities.
>>>>
>>>>Thanks, Roger.
>>>>
>>>>Vincent Massol wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi Roger,
>>>>>
>>>>>It's normal it's not working. When you write:
>>>>>
>>>>>assertTrue(
>>>>>  context.getOriginalContext().getInitParameter("param").equals(
>>>>>  "testoverrideparam"));
>>>>>
>>>>>You have to understand that by calling getOriginalContext() you're
>>>>>          
>>>>>
>>asking
>>    
>>
>>>>>for ... well... the original context and not the one you're working on!
>>>>>
>>>>>It should be:
>>>>>
>>>>>assertTrue(
>>>>>  context.getInitParameter("param").equals("testoverrideparam"));
>>>>>
>>>>>-Vincent
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>Sent: mardi 10 août 2004 00:07
>>>>>>To: Vincent Massol
>>>>>>Cc: 'Cactus Developers List'
>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>
>>>>>>Hi Vincent -
>>>>>>
>>>>>>Thanks for the test module.  I also found it under the cactus samples
>>>>>>dir...
>>>>>>I've tested the sample and it works as is.  However, I tweaked it
>>>>>>slightly:
>>>>>>
>>>>>>  public void testSetContextInitParameterOverrideWebXmlParameter()
>>>>>>  {
>>>>>>      // Note: "param" is a parameter that must be already defined in
>>>>>>      // web.xml (in the context-param element), with a value
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>different
>>>>
>>>>
>>>>        
>>>>
>>>>>>      // than "testoverrideparam1".
>>>>>>      assertTrue("'param' context-param should been defined in
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>web.xml",
>>>>
>>>>
>>>>        
>>>>
>>>>>>          context.getOriginalContext().getInitParameter("param") !=
>>>>>>null);
>>>>>>      assertTrue(
>>>>>>
>>>>>>!context.getOriginalContext().getInitParameter("param").equals(
>>>>>>          "testoverrideparam"));
>>>>>>
>>>>>>
>>>>>>      context.setInitParameter("param", "testoverrideparam");
>>>>>>
>>>>>>// Added this assertion which fails.....
>>>>>>
>>>>>>
>>>>>>      assertTrue(
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>context.getOriginalContext().getInitParameter("param").equals(
>>>>
>>>>
>>>>        
>>>>
>>>>>>          "testoverrideparam"));
>>>>>>
>>>>>>
>>>>>>Should the "setInitParameter" call have affected (or changed in this
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>case)
>>>>
>>>>
>>>>        
>>>>
>>>>>>the underlying ServletContext init parameter?
>>>>>>
>>>>>>The reason why I ask, is that ideally, that is what we want for our
>>>>>>            
>>>>>>
>>test
>>    
>>
>>>>>>cases.
>>>>>>We have code that checks the actual init param and does something
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>slightly
>>>>
>>>>
>>>>        
>>>>
>>>>>>different depending on the value of the param.  We want to test this
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>code
>>>>
>>>>
>>>>        
>>>>
>>>>>>with Cactus.
>>>>>>
>>>>>>Thanks, in advance, Roger.
>>>>>>
>>>>>>
>>>>>>
>>>>>>Vincent Massol wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Roger,
>>>>>>>
>>>>>>>That attachment may have been stripped by the mailing list manager.
>>>>>>>              
>>>>>>>
>>I'm
>>    
>>
>>>>>>>ccing your private email address to ensure you receive it this time.
>>>>>>>
>>>>>>>Thanks
>>>>>>>-Vincent
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>-----Original Message-----
>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>Sent: lundi 9 août 2004 17:06
>>>>>>>>To: Cactus Developers List; vmassol@pivolis.com
>>>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>>>
>>>>>>>>Hi Vincent,
>>>>>>>>
>>>>>>>>I did not receive an example in your last email.  Can you resend?
>>>>>>>>
>>>>>>>>Thanks, in advance, Roger.
>>>>>>>>
>>>>>>>>Vincent Massol wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>Hi Riger,
>>>>>>>>>
>>>>>>>>>I don't know what's wrong. Maybe the fact that you're using a
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>JspTestCase
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>and not a ServletTestCase?
>>>>>>>>>
>>>>>>>>>Could you try running the example I've included in my previous
>>>>>>>>>                  
>>>>>>>>>
>>email
>>    
>>
>>>>>>>>>                  
>>>>>>>>>
>>>>to
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>you
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>to see if it works on your machine? If it works, you can work from
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>there
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>and
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>slowly modify the sample to your target test.
>>>>>>>>>
>>>>>>>>>Thanks
>>>>>>>>>-Vincent
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>>>-----Original Message-----
>>>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>>>Sent: lundi 9 août 2004 14:55
>>>>>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>>>>>Cc: vmassol@pivolis.com
>>>>>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>>>>>
>>>>>>>>>>Hi,
>>>>>>>>>>
>>>>>>>>>>I've changed the code accordingly with no success:
>>>>>>>>>>
>>>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>
>>>>>>>>>>  public void setUp() {
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>((ServletContextWrapper)config.getServletContext()).setInitParamet
>>>>>>>>>>                    
>>>>>>>>>>
>>er
>>    
>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>(
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>        "javax.faces.STATE_SAVING_METHOD", "client");
>>>>>>>>>>    System.out.println("GET INIT PARAM"+
>>>>>>>>>>        Config.getServletContext().getInitParameter(
>>>>>>>>>>        "javax.faces.STATE_SAVING_METHOD"));
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>
>>>>>>>>>>It appears the init parameter still has the default "server"
>>>>>>>>>>                    
>>>>>>>>>>
>>value.
>>    
>>
>>>>>>>>>>Shouldn't this have worked?  What am I missing?
>>>>>>>>>>
>>>>>>>>>>Thanks in advance, Roger
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>Vincent Massol wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>>>>>>Hi Roger,
>>>>>>>>>>>
>>>>>>>>>>>Your code is invalid. You should write:
>>>>>>>>>>>
>>>>>>>>>>>((ServletContextWrapper)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>>>Config.getServletContext()).setInitParameter(...);
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>>>>>>As shown in the sample application, part of the Cactus
>>>>>>>>>>>                      
>>>>>>>>>>>
>>distribution
>>    
>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>(I'm
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>>>attaching one of its class for your reference).
>>>>>>>>>>>
>>>>>>>>>>>-Vincent
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>>>>>-----Original Message-----
>>>>>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>>>>>Sent: jeudi 5 août 2004 22:36
>>>>>>>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>>>>>>>Subject: Changing web.xml conext init param...
>>>>>>>>>>>>
>>>>>>>>>>>>i,
>>>>>>>>>>>>
>>>>>>>>>>>>I'm using cactus 1.6.   How can I dynamically change the a
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>context
>>    
>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>>>>>>>init
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>>>>param
>>>>>>>>>>>>(that was loaded from my web.xml file) from within a test case?
>>>>>>>>>>>>Here's what I have:
>>>>>>>>>>>>
>>>>>>>>>>>>in web.xml:
>>>>>>>>>>>>.
>>>>>>>>>>>>.
>>>>>>>>>>>><context-param>
>>>>>>>>>>>>  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>>>>>>>>>  <param-value>server</param-value>
>>>>>>>>>>>></context-param>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>In my test case I was doing the following:
>>>>>>>>>>>>
>>>>>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>{
>>    
>>
>>>>>>>>>>>>.
>>>>>>>>>>>>.
>>>>>>>>>>>>.
>>>>>>>>>>>>public void setUp() {
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   ServletContextWrapper sc = new
>>>>>>>>>>>>ServletContextWrapper(config.getServletContext());
>>>>>>>>>>>>   sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>>>>>>>>>       "client");
>>>>>>>>>>>>.
>>>>>>>>>>>>.
>>>>>>>>>>>>.
>>>>>>>>>>>>Not sure the new context param is set.....
>>>>>>>>>>>>
>>>>>>>>>>>>Any help would be greatly appreciated....
>>>>>>>>>>>>
>>>>>>>>>>>>Thanks, Roger.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>----------------------------------------------------------------
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>>>--
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>>>>>-
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>>>>To unsubscribe, e-mail: cactus-dev-
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>unsubscribe@jakarta.apache.org
>>    
>>
>>>>>>>>>>>>For additional commands, e-mail: cactus-dev-
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>>>help@jakarta.apache.org
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                        
>>>>>>>>>>>>
>>>>>>>>>>>-----------------------------------------------------------------
>>>>>>>>>>>                      
>>>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>--
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>--
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>-
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>>>-----------------------------------------------------------------
>>>>>>>>>>>                      
>>>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>--
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>>>For additional commands, e-mail: cactus-dev-
>>>>>>>>>>>                      
>>>>>>>>>>>
>>help@jakarta.apache.org
>>    
>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>>-------------------------------------------------------------------
>>>>>>>>>                  
>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>      
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>
>  
>


RE: Changing web.xml conext init param...

Posted by Vincent Massol <vm...@pivolis.com>.
The context that is passed by Cactus to your code under test implements
javax.servlet.ServletContext so it makes no difference at all from your
code's point of view.

-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: mardi 10 août 2004 14:20
> To: Cactus Developers List; Vincent Massol
> Subject: Re: Changing web.xml conext init param...
> 
> Hi Vincent -
> 
> The code that needs to be tested (not the cactus test itself) examines the
> ServletContext context init param (the original one -
> javax.servlet.ServletContext).
> How can we still use Cactus?
> 
> Thanks, Roger.
> 
> Vincent Massol wrote:
> 
> >Hi Roger,
> >
> >Don't be afraid! There should be no problem whatsoever for the working
> code
> >as it will use the context provided by Cactus. I don't understand your
> >problem and I don't think there's any.
> >
> >The only case I can think of where it would be a problem is if your code
> >does something like this:
> >
> >if (context.getClass().getName().equals("javax.servlet.[...]"))
> >
> >But then that would really not be a best practice...
> >
> >-Vincent
> >
> >
> >
> >>-----Original Message-----
> >>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>Sent: mardi 10 août 2004 13:49
> >>To: Cactus Developers List
> >>Cc: Vincent Massol
> >>Subject: Re: Changing web.xml conext init param...
> >>
> >>Hi Vincent -
> >>
> >>That's what I was afraid of...  Some of our code that needs to be
> tested,
> >>actually executes differently depending on the actual web.xml
> >>context init param value.  Ideally, we need a mechanism that will allow
> >>us to manipulate the underlying "real" value.  We'll have to explore
> other
> >>opportunities.
> >>
> >>Thanks, Roger.
> >>
> >>Vincent Massol wrote:
> >>
> >>
> >>
> >>>Hi Roger,
> >>>
> >>>It's normal it's not working. When you write:
> >>>
> >>>assertTrue(
> >>>   context.getOriginalContext().getInitParameter("param").equals(
> >>>   "testoverrideparam"));
> >>>
> >>>You have to understand that by calling getOriginalContext() you're
> asking
> >>>for ... well... the original context and not the one you're working on!
> >>>
> >>>It should be:
> >>>
> >>>assertTrue(
> >>>   context.getInitParameter("param").equals("testoverrideparam"));
> >>>
> >>>-Vincent
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>Sent: mardi 10 août 2004 00:07
> >>>>To: Vincent Massol
> >>>>Cc: 'Cactus Developers List'
> >>>>Subject: Re: Changing web.xml conext init param...
> >>>>
> >>>>Hi Vincent -
> >>>>
> >>>>Thanks for the test module.  I also found it under the cactus samples
> >>>>dir...
> >>>>I've tested the sample and it works as is.  However, I tweaked it
> >>>>slightly:
> >>>>
> >>>>   public void testSetContextInitParameterOverrideWebXmlParameter()
> >>>>   {
> >>>>       // Note: "param" is a parameter that must be already defined in
> >>>>       // web.xml (in the context-param element), with a value
> >>>>
> >>>>
> >>different
> >>
> >>
> >>>>       // than "testoverrideparam1".
> >>>>       assertTrue("'param' context-param should been defined in
> >>>>
> >>>>
> >>web.xml",
> >>
> >>
> >>>>           context.getOriginalContext().getInitParameter("param") !=
> >>>>null);
> >>>>       assertTrue(
> >>>>
> >>>>!context.getOriginalContext().getInitParameter("param").equals(
> >>>>           "testoverrideparam"));
> >>>>
> >>>>
> >>>>       context.setInitParameter("param", "testoverrideparam");
> >>>>
> >>>>// Added this assertion which fails.....
> >>>>
> >>>>
> >>>>       assertTrue(
> >>>>
> >>>>
> >>>>
> >>context.getOriginalContext().getInitParameter("param").equals(
> >>
> >>
> >>>>           "testoverrideparam"));
> >>>>
> >>>>
> >>>>Should the "setInitParameter" call have affected (or changed in this
> >>>>
> >>>>
> >>case)
> >>
> >>
> >>>>the underlying ServletContext init parameter?
> >>>>
> >>>>The reason why I ask, is that ideally, that is what we want for our
> test
> >>>>cases.
> >>>>We have code that checks the actual init param and does something
> >>>>
> >>>>
> >>slightly
> >>
> >>
> >>>>different depending on the value of the param.  We want to test this
> >>>>
> >>>>
> >>code
> >>
> >>
> >>>>with Cactus.
> >>>>
> >>>>Thanks, in advance, Roger.
> >>>>
> >>>>
> >>>>
> >>>>Vincent Massol wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Roger,
> >>>>>
> >>>>>That attachment may have been stripped by the mailing list manager.
> I'm
> >>>>>ccing your private email address to ensure you receive it this time.
> >>>>>
> >>>>>Thanks
> >>>>>-Vincent
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>-----Original Message-----
> >>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>Sent: lundi 9 août 2004 17:06
> >>>>>>To: Cactus Developers List; vmassol@pivolis.com
> >>>>>>Subject: Re: Changing web.xml conext init param...
> >>>>>>
> >>>>>>Hi Vincent,
> >>>>>>
> >>>>>>I did not receive an example in your last email.  Can you resend?
> >>>>>>
> >>>>>>Thanks, in advance, Roger.
> >>>>>>
> >>>>>>Vincent Massol wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Hi Riger,
> >>>>>>>
> >>>>>>>I don't know what's wrong. Maybe the fact that you're using a
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>JspTestCase
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>and not a ServletTestCase?
> >>>>>>>
> >>>>>>>Could you try running the example I've included in my previous
> email
> >>>>>>>
> >>>>>>>
> >>to
> >>
> >>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>you
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>to see if it works on your machine? If it works, you can work from
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>there
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>
> >>>>>>>
> >>>>>>and
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>slowly modify the sample to your target test.
> >>>>>>>
> >>>>>>>Thanks
> >>>>>>>-Vincent
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>-----Original Message-----
> >>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>>>Sent: lundi 9 août 2004 14:55
> >>>>>>>>To: cactus-dev@jakarta.apache.org
> >>>>>>>>Cc: vmassol@pivolis.com
> >>>>>>>>Subject: Re: Changing web.xml conext init param...
> >>>>>>>>
> >>>>>>>>Hi,
> >>>>>>>>
> >>>>>>>>I've changed the code accordingly with no success:
> >>>>>>>>
> >>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
> >>>>>>>> .
> >>>>>>>> .
> >>>>>>>>
> >>>>>>>>   public void setUp() {
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>((ServletContextWrapper)config.getServletContext()).setInitParamet
> er
> >>>>>>>>
> >>>>>>>>
> >>(
> >>
> >>
> >>>>>>>>         "javax.faces.STATE_SAVING_METHOD", "client");
> >>>>>>>>     System.out.println("GET INIT PARAM"+
> >>>>>>>>         Config.getServletContext().getInitParameter(
> >>>>>>>>         "javax.faces.STATE_SAVING_METHOD"));
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>>
> >>>>>>>>It appears the init parameter still has the default "server"
> value.
> >>>>>>>>
> >>>>>>>>Shouldn't this have worked?  What am I missing?
> >>>>>>>>
> >>>>>>>>Thanks in advance, Roger
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>Vincent Massol wrote:
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>Hi Roger,
> >>>>>>>>>
> >>>>>>>>>Your code is invalid. You should write:
> >>>>>>>>>
> >>>>>>>>>((ServletContextWrapper)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>Config.getServletContext()).setInitParameter(...);
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>As shown in the sample application, part of the Cactus
> distribution
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>(I'm
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>>attaching one of its class for your reference).
> >>>>>>>>>
> >>>>>>>>>-Vincent
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>>-----Original Message-----
> >>>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>>>>>Sent: jeudi 5 août 2004 22:36
> >>>>>>>>>>To: cactus-dev@jakarta.apache.org
> >>>>>>>>>>Subject: Changing web.xml conext init param...
> >>>>>>>>>>
> >>>>>>>>>>i,
> >>>>>>>>>>
> >>>>>>>>>>I'm using cactus 1.6.   How can I dynamically change the a
> context
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>init
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>>>param
> >>>>>>>>>>(that was loaded from my web.xml file) from within a test case?
> >>>>>>>>>>Here's what I have:
> >>>>>>>>>>
> >>>>>>>>>>in web.xml:
> >>>>>>>>>>.
> >>>>>>>>>>.
> >>>>>>>>>><context-param>
> >>>>>>>>>>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>>>>>>>>>   <param-value>server</param-value>
> >>>>>>>>>></context-param>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>In my test case I was doing the following:
> >>>>>>>>>>
> >>>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase
> {
> >>>>>>>>>>.
> >>>>>>>>>>.
> >>>>>>>>>>.
> >>>>>>>>>>public void setUp() {
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>    ServletContextWrapper sc = new
> >>>>>>>>>>ServletContextWrapper(config.getServletContext());
> >>>>>>>>>>    sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>>>>>>>>>        "client");
> >>>>>>>>>>.
> >>>>>>>>>>.
> >>>>>>>>>>.
> >>>>>>>>>>Not sure the new context param is set.....
> >>>>>>>>>>
> >>>>>>>>>>Any help would be greatly appreciated....
> >>>>>>>>>>
> >>>>>>>>>>Thanks, Roger.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>----------------------------------------------------------------
> --
> >>>>>>>>>>
> >>>>>>>>>>
> >>--
> >>
> >>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>-
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>>>>To unsubscribe, e-mail: cactus-dev-
> unsubscribe@jakarta.apache.org
> >>>>>>>>>>For additional commands, e-mail: cactus-dev-
> >>>>>>>>>>
> >>>>>>>>>>
> >>help@jakarta.apache.org
> >>
> >>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>-----------------------------------------------------------------
> --
> >>>>>>>>>
> >>>>>>>>>
> >>--
> >>
> >>
> >>>>>>>>>
> >>>>>>>>>
> >>>>--
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>-
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>>-----------------------------------------------------------------
> --
> >>>>>>>>>
> >>>>>>>>>
> >>--
> >>
> >>
> >>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>>>For additional commands, e-mail: cactus-dev-
> help@jakarta.apache.org
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>-------------------------------------------------------------------
> --
> >>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >
> >
> >



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Hi Vincent -

The code that needs to be tested (not the cactus test itself) examines the
ServletContext context init param (the original one - 
javax.servlet.ServletContext).
How can we still use Cactus? 

Thanks, Roger.

Vincent Massol wrote:

>Hi Roger,
>
>Don't be afraid! There should be no problem whatsoever for the working code
>as it will use the context provided by Cactus. I don't understand your
>problem and I don't think there's any.
>
>The only case I can think of where it would be a problem is if your code
>does something like this:
>
>if (context.getClass().getName().equals("javax.servlet.[...]"))
>
>But then that would really not be a best practice...
>
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: mardi 10 août 2004 13:49
>>To: Cactus Developers List
>>Cc: Vincent Massol
>>Subject: Re: Changing web.xml conext init param...
>>
>>Hi Vincent -
>>
>>That's what I was afraid of...  Some of our code that needs to be tested,
>>actually executes differently depending on the actual web.xml
>>context init param value.  Ideally, we need a mechanism that will allow
>>us to manipulate the underlying "real" value.  We'll have to explore other
>>opportunities.
>>
>>Thanks, Roger.
>>
>>Vincent Massol wrote:
>>
>>    
>>
>>>Hi Roger,
>>>
>>>It's normal it's not working. When you write:
>>>
>>>assertTrue(
>>>   context.getOriginalContext().getInitParameter("param").equals(
>>>   "testoverrideparam"));
>>>
>>>You have to understand that by calling getOriginalContext() you're asking
>>>for ... well... the original context and not the one you're working on!
>>>
>>>It should be:
>>>
>>>assertTrue(
>>>   context.getInitParameter("param").equals("testoverrideparam"));
>>>
>>>-Vincent
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>Sent: mardi 10 août 2004 00:07
>>>>To: Vincent Massol
>>>>Cc: 'Cactus Developers List'
>>>>Subject: Re: Changing web.xml conext init param...
>>>>
>>>>Hi Vincent -
>>>>
>>>>Thanks for the test module.  I also found it under the cactus samples
>>>>dir...
>>>>I've tested the sample and it works as is.  However, I tweaked it
>>>>slightly:
>>>>
>>>>   public void testSetContextInitParameterOverrideWebXmlParameter()
>>>>   {
>>>>       // Note: "param" is a parameter that must be already defined in
>>>>       // web.xml (in the context-param element), with a value
>>>>        
>>>>
>>different
>>    
>>
>>>>       // than "testoverrideparam1".
>>>>       assertTrue("'param' context-param should been defined in
>>>>        
>>>>
>>web.xml",
>>    
>>
>>>>           context.getOriginalContext().getInitParameter("param") !=
>>>>null);
>>>>       assertTrue(
>>>>
>>>>!context.getOriginalContext().getInitParameter("param").equals(
>>>>           "testoverrideparam"));
>>>>
>>>>
>>>>       context.setInitParameter("param", "testoverrideparam");
>>>>
>>>>// Added this assertion which fails.....
>>>>
>>>>
>>>>       assertTrue(
>>>>
>>>>        
>>>>
>>context.getOriginalContext().getInitParameter("param").equals(
>>    
>>
>>>>           "testoverrideparam"));
>>>>
>>>>
>>>>Should the "setInitParameter" call have affected (or changed in this
>>>>        
>>>>
>>case)
>>    
>>
>>>>the underlying ServletContext init parameter?
>>>>
>>>>The reason why I ask, is that ideally, that is what we want for our test
>>>>cases.
>>>>We have code that checks the actual init param and does something
>>>>        
>>>>
>>slightly
>>    
>>
>>>>different depending on the value of the param.  We want to test this
>>>>        
>>>>
>>code
>>    
>>
>>>>with Cactus.
>>>>
>>>>Thanks, in advance, Roger.
>>>>
>>>>
>>>>
>>>>Vincent Massol wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Roger,
>>>>>
>>>>>That attachment may have been stripped by the mailing list manager. I'm
>>>>>ccing your private email address to ensure you receive it this time.
>>>>>
>>>>>Thanks
>>>>>-Vincent
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>Sent: lundi 9 août 2004 17:06
>>>>>>To: Cactus Developers List; vmassol@pivolis.com
>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>
>>>>>>Hi Vincent,
>>>>>>
>>>>>>I did not receive an example in your last email.  Can you resend?
>>>>>>
>>>>>>Thanks, in advance, Roger.
>>>>>>
>>>>>>Vincent Massol wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Hi Riger,
>>>>>>>
>>>>>>>I don't know what's wrong. Maybe the fact that you're using a
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>JspTestCase
>>>>
>>>>
>>>>        
>>>>
>>>>>>>and not a ServletTestCase?
>>>>>>>
>>>>>>>Could you try running the example I've included in my previous email
>>>>>>>              
>>>>>>>
>>to
>>    
>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>you
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>to see if it works on your machine? If it works, you can work from
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>there
>>>>
>>>>
>>>>        
>>>>
>>>>>>>              
>>>>>>>
>>>>>>and
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>slowly modify the sample to your target test.
>>>>>>>
>>>>>>>Thanks
>>>>>>>-Vincent
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>-----Original Message-----
>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>Sent: lundi 9 août 2004 14:55
>>>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>>>Cc: vmassol@pivolis.com
>>>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>>>
>>>>>>>>Hi,
>>>>>>>>
>>>>>>>>I've changed the code accordingly with no success:
>>>>>>>>
>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
>>>>>>>> .
>>>>>>>> .
>>>>>>>>
>>>>>>>>   public void setUp() {
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>((ServletContextWrapper)config.getServletContext()).setInitParameter
>>>>>>>>                
>>>>>>>>
>>(
>>    
>>
>>>>>>>>         "javax.faces.STATE_SAVING_METHOD", "client");
>>>>>>>>     System.out.println("GET INIT PARAM"+
>>>>>>>>         Config.getServletContext().getInitParameter(
>>>>>>>>         "javax.faces.STATE_SAVING_METHOD"));
>>>>>>>>.
>>>>>>>>.
>>>>>>>>.
>>>>>>>>
>>>>>>>>It appears the init parameter still has the default "server"  value.
>>>>>>>>
>>>>>>>>Shouldn't this have worked?  What am I missing?
>>>>>>>>
>>>>>>>>Thanks in advance, Roger
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>Vincent Massol wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>Hi Roger,
>>>>>>>>>
>>>>>>>>>Your code is invalid. You should write:
>>>>>>>>>
>>>>>>>>>((ServletContextWrapper)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>Config.getServletContext()).setInitParameter(...);
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>>>As shown in the sample application, part of the Cactus distribution
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>(I'm
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>attaching one of its class for your reference).
>>>>>>>>>
>>>>>>>>>-Vincent
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>>>-----Original Message-----
>>>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>>>Sent: jeudi 5 août 2004 22:36
>>>>>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>>>>>Subject: Changing web.xml conext init param...
>>>>>>>>>>
>>>>>>>>>>i,
>>>>>>>>>>
>>>>>>>>>>I'm using cactus 1.6.   How can I dynamically change the a context
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>init
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>>param
>>>>>>>>>>(that was loaded from my web.xml file) from within a test case?
>>>>>>>>>>Here's what I have:
>>>>>>>>>>
>>>>>>>>>>in web.xml:
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>><context-param>
>>>>>>>>>>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>>>>>>>   <param-value>server</param-value>
>>>>>>>>>></context-param>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>In my test case I was doing the following:
>>>>>>>>>>
>>>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>public void setUp() {
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    ServletContextWrapper sc = new
>>>>>>>>>>ServletContextWrapper(config.getServletContext());
>>>>>>>>>>    sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>>>>>>>        "client");
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>.
>>>>>>>>>>Not sure the new context param is set.....
>>>>>>>>>>
>>>>>>>>>>Any help would be greatly appreciated....
>>>>>>>>>>
>>>>>>>>>>Thanks, Roger.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>------------------------------------------------------------------
>>>>>>>>>>                    
>>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>-
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>>For additional commands, e-mail: cactus-dev-
>>>>>>>>>>                    
>>>>>>>>>>
>>help@jakarta.apache.org
>>    
>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>>>>-------------------------------------------------------------------
>>>>>>>>>                  
>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>                  
>>>>>>>>>
>>>>--
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>-
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>>>-------------------------------------------------------------------
>>>>>>>>>                  
>>>>>>>>>
>>--
>>    
>>
>>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>      
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>
>  
>


RE: Changing web.xml conext init param...

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

Don't be afraid! There should be no problem whatsoever for the working code
as it will use the context provided by Cactus. I don't understand your
problem and I don't think there's any.

The only case I can think of where it would be a problem is if your code
does something like this:

if (context.getClass().getName().equals("javax.servlet.[...]"))

But then that would really not be a best practice...

-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: mardi 10 août 2004 13:49
> To: Cactus Developers List
> Cc: Vincent Massol
> Subject: Re: Changing web.xml conext init param...
> 
> Hi Vincent -
> 
> That's what I was afraid of...  Some of our code that needs to be tested,
> actually executes differently depending on the actual web.xml
> context init param value.  Ideally, we need a mechanism that will allow
> us to manipulate the underlying "real" value.  We'll have to explore other
> opportunities.
> 
> Thanks, Roger.
> 
> Vincent Massol wrote:
> 
> >Hi Roger,
> >
> >It's normal it's not working. When you write:
> >
> >assertTrue(
> >    context.getOriginalContext().getInitParameter("param").equals(
> >    "testoverrideparam"));
> >
> >You have to understand that by calling getOriginalContext() you're asking
> >for ... well... the original context and not the one you're working on!
> >
> >It should be:
> >
> >assertTrue(
> >    context.getInitParameter("param").equals("testoverrideparam"));
> >
> >-Vincent
> >
> >
> >
> >>-----Original Message-----
> >>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>Sent: mardi 10 août 2004 00:07
> >>To: Vincent Massol
> >>Cc: 'Cactus Developers List'
> >>Subject: Re: Changing web.xml conext init param...
> >>
> >>Hi Vincent -
> >>
> >>Thanks for the test module.  I also found it under the cactus samples
> >>dir...
> >>I've tested the sample and it works as is.  However, I tweaked it
> >>slightly:
> >>
> >>    public void testSetContextInitParameterOverrideWebXmlParameter()
> >>    {
> >>        // Note: "param" is a parameter that must be already defined in
> >>        // web.xml (in the context-param element), with a value
> different
> >>        // than "testoverrideparam1".
> >>        assertTrue("'param' context-param should been defined in
> web.xml",
> >>            context.getOriginalContext().getInitParameter("param") !=
> >>null);
> >>        assertTrue(
> >>
> >>!context.getOriginalContext().getInitParameter("param").equals(
> >>            "testoverrideparam"));
> >>
> >>
> >>        context.setInitParameter("param", "testoverrideparam");
> >>
> >>// Added this assertion which fails.....
> >>
> >>
> >>        assertTrue(
> >>
> context.getOriginalContext().getInitParameter("param").equals(
> >>            "testoverrideparam"));
> >>
> >>
> >>Should the "setInitParameter" call have affected (or changed in this
> case)
> >>the underlying ServletContext init parameter?
> >>
> >>The reason why I ask, is that ideally, that is what we want for our test
> >>cases.
> >>We have code that checks the actual init param and does something
> slightly
> >>different depending on the value of the param.  We want to test this
> code
> >>with Cactus.
> >>
> >>Thanks, in advance, Roger.
> >>
> >>
> >>
> >>Vincent Massol wrote:
> >>
> >>
> >>
> >>>Roger,
> >>>
> >>>That attachment may have been stripped by the mailing list manager. I'm
> >>>ccing your private email address to ensure you receive it this time.
> >>>
> >>>Thanks
> >>>-Vincent
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>Sent: lundi 9 août 2004 17:06
> >>>>To: Cactus Developers List; vmassol@pivolis.com
> >>>>Subject: Re: Changing web.xml conext init param...
> >>>>
> >>>>Hi Vincent,
> >>>>
> >>>>I did not receive an example in your last email.  Can you resend?
> >>>>
> >>>>Thanks, in advance, Roger.
> >>>>
> >>>>Vincent Massol wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi Riger,
> >>>>>
> >>>>>I don't know what's wrong. Maybe the fact that you're using a
> >>>>>
> >>>>>
> >>JspTestCase
> >>
> >>
> >>>>>and not a ServletTestCase?
> >>>>>
> >>>>>Could you try running the example I've included in my previous email
> to
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>you
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>to see if it works on your machine? If it works, you can work from
> >>>>>
> >>>>>
> >>there
> >>
> >>
> >>>>>
> >>>>>
> >>>>and
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>slowly modify the sample to your target test.
> >>>>>
> >>>>>Thanks
> >>>>>-Vincent
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>-----Original Message-----
> >>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>Sent: lundi 9 août 2004 14:55
> >>>>>>To: cactus-dev@jakarta.apache.org
> >>>>>>Cc: vmassol@pivolis.com
> >>>>>>Subject: Re: Changing web.xml conext init param...
> >>>>>>
> >>>>>>Hi,
> >>>>>>
> >>>>>>I've changed the code accordingly with no success:
> >>>>>>
> >>>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
> >>>>>>  .
> >>>>>>  .
> >>>>>>
> >>>>>>    public void setUp() {
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>((ServletContextWrapper)config.getServletContext()).setInitParameter
> (
> >>>>>>          "javax.faces.STATE_SAVING_METHOD", "client");
> >>>>>>      System.out.println("GET INIT PARAM"+
> >>>>>>          Config.getServletContext().getInitParameter(
> >>>>>>          "javax.faces.STATE_SAVING_METHOD"));
> >>>>>>.
> >>>>>>.
> >>>>>>.
> >>>>>>
> >>>>>>It appears the init parameter still has the default "server"  value.
> >>>>>>
> >>>>>>Shouldn't this have worked?  What am I missing?
> >>>>>>
> >>>>>>Thanks in advance, Roger
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>Vincent Massol wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Hi Roger,
> >>>>>>>
> >>>>>>>Your code is invalid. You should write:
> >>>>>>>
> >>>>>>>((ServletContextWrapper)
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>Config.getServletContext()).setInitParameter(...);
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>As shown in the sample application, part of the Cactus distribution
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>(I'm
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>attaching one of its class for your reference).
> >>>>>>>
> >>>>>>>-Vincent
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>-----Original Message-----
> >>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>>>Sent: jeudi 5 août 2004 22:36
> >>>>>>>>To: cactus-dev@jakarta.apache.org
> >>>>>>>>Subject: Changing web.xml conext init param...
> >>>>>>>>
> >>>>>>>>i,
> >>>>>>>>
> >>>>>>>>I'm using cactus 1.6.   How can I dynamically change the a context
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>init
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>>param
> >>>>>>>>(that was loaded from my web.xml file) from within a test case?
> >>>>>>>>Here's what I have:
> >>>>>>>>
> >>>>>>>>in web.xml:
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>><context-param>
> >>>>>>>>    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>>>>>>>    <param-value>server</param-value>
> >>>>>>>></context-param>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>In my test case I was doing the following:
> >>>>>>>>
> >>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>> public void setUp() {
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>     ServletContextWrapper sc = new
> >>>>>>>>ServletContextWrapper(config.getServletContext());
> >>>>>>>>     sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>>>>>>>         "client");
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>>.
> >>>>>>>>Not sure the new context param is set.....
> >>>>>>>>
> >>>>>>>>Any help would be greatly appreciated....
> >>>>>>>>
> >>>>>>>>Thanks, Roger.
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>------------------------------------------------------------------
> --
> >>>>>>>>
> >>>>>>>>
> >>-
> >>
> >>
> >>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>>For additional commands, e-mail: cactus-dev-
> help@jakarta.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>-------------------------------------------------------------------
> --
> >>>>>>>
> >>>>>>>
> >>--
> >>
> >>
> >>>>>>>
> >>>>>>>
> >>>>-
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>>-------------------------------------------------------------------
> --
> >>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >
> >
> >



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Hi Vincent -

That's what I was afraid of...  Some of our code that needs to be tested,
actually executes differently depending on the actual web.xml
context init param value.  Ideally, we need a mechanism that will allow
us to manipulate the underlying "real" value.  We'll have to explore other
opportunities.

Thanks, Roger.

Vincent Massol wrote:

>Hi Roger,
>
>It's normal it's not working. When you write:
>
>assertTrue(
>    context.getOriginalContext().getInitParameter("param").equals(
>    "testoverrideparam"));
>
>You have to understand that by calling getOriginalContext() you're asking
>for ... well... the original context and not the one you're working on!
>
>It should be:
>
>assertTrue(
>    context.getInitParameter("param").equals("testoverrideparam"));
>
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: mardi 10 août 2004 00:07
>>To: Vincent Massol
>>Cc: 'Cactus Developers List'
>>Subject: Re: Changing web.xml conext init param...
>>
>>Hi Vincent -
>>
>>Thanks for the test module.  I also found it under the cactus samples
>>dir...
>>I've tested the sample and it works as is.  However, I tweaked it
>>slightly:
>>
>>    public void testSetContextInitParameterOverrideWebXmlParameter()
>>    {
>>        // Note: "param" is a parameter that must be already defined in
>>        // web.xml (in the context-param element), with a value different
>>        // than "testoverrideparam1".
>>        assertTrue("'param' context-param should been defined in web.xml",
>>            context.getOriginalContext().getInitParameter("param") !=
>>null);
>>        assertTrue(
>>
>>!context.getOriginalContext().getInitParameter("param").equals(
>>            "testoverrideparam"));
>>
>>
>>        context.setInitParameter("param", "testoverrideparam");
>>
>>// Added this assertion which fails.....
>>
>>
>>        assertTrue(
>>            context.getOriginalContext().getInitParameter("param").equals(
>>            "testoverrideparam"));
>>
>>
>>Should the "setInitParameter" call have affected (or changed in this case)
>>the underlying ServletContext init parameter?
>>
>>The reason why I ask, is that ideally, that is what we want for our test
>>cases.
>>We have code that checks the actual init param and does something slightly
>>different depending on the value of the param.  We want to test this code
>>with Cactus.
>>
>>Thanks, in advance, Roger.
>>
>>
>>
>>Vincent Massol wrote:
>>
>>    
>>
>>>Roger,
>>>
>>>That attachment may have been stripped by the mailing list manager. I'm
>>>ccing your private email address to ensure you receive it this time.
>>>
>>>Thanks
>>>-Vincent
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>Sent: lundi 9 août 2004 17:06
>>>>To: Cactus Developers List; vmassol@pivolis.com
>>>>Subject: Re: Changing web.xml conext init param...
>>>>
>>>>Hi Vincent,
>>>>
>>>>I did not receive an example in your last email.  Can you resend?
>>>>
>>>>Thanks, in advance, Roger.
>>>>
>>>>Vincent Massol wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi Riger,
>>>>>
>>>>>I don't know what's wrong. Maybe the fact that you're using a
>>>>>          
>>>>>
>>JspTestCase
>>    
>>
>>>>>and not a ServletTestCase?
>>>>>
>>>>>Could you try running the example I've included in my previous email to
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>you
>>>>
>>>>
>>>>        
>>>>
>>>>>to see if it works on your machine? If it works, you can work from
>>>>>          
>>>>>
>>there
>>    
>>
>>>>>          
>>>>>
>>>>and
>>>>
>>>>
>>>>        
>>>>
>>>>>slowly modify the sample to your target test.
>>>>>
>>>>>Thanks
>>>>>-Vincent
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>Sent: lundi 9 août 2004 14:55
>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>Cc: vmassol@pivolis.com
>>>>>>Subject: Re: Changing web.xml conext init param...
>>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>I've changed the code accordingly with no success:
>>>>>>
>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
>>>>>>  .
>>>>>>  .
>>>>>>
>>>>>>    public void setUp() {
>>>>>>
>>>>>>
>>>>>>
>>>>>>((ServletContextWrapper)config.getServletContext()).setInitParameter(
>>>>>>          "javax.faces.STATE_SAVING_METHOD", "client");
>>>>>>      System.out.println("GET INIT PARAM"+
>>>>>>          Config.getServletContext().getInitParameter(
>>>>>>          "javax.faces.STATE_SAVING_METHOD"));
>>>>>>.
>>>>>>.
>>>>>>.
>>>>>>
>>>>>>It appears the init parameter still has the default "server"  value.
>>>>>>
>>>>>>Shouldn't this have worked?  What am I missing?
>>>>>>
>>>>>>Thanks in advance, Roger
>>>>>>
>>>>>>
>>>>>>
>>>>>>Vincent Massol wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Hi Roger,
>>>>>>>
>>>>>>>Your code is invalid. You should write:
>>>>>>>
>>>>>>>((ServletContextWrapper)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>Config.getServletContext()).setInitParameter(...);
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>As shown in the sample application, part of the Cactus distribution
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>(I'm
>>>>
>>>>
>>>>        
>>>>
>>>>>>>attaching one of its class for your reference).
>>>>>>>
>>>>>>>-Vincent
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>>>-----Original Message-----
>>>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>>>Sent: jeudi 5 août 2004 22:36
>>>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>>>Subject: Changing web.xml conext init param...
>>>>>>>>
>>>>>>>>i,
>>>>>>>>
>>>>>>>>I'm using cactus 1.6.   How can I dynamically change the a context
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>init
>>>>
>>>>
>>>>        
>>>>
>>>>>>>>param
>>>>>>>>(that was loaded from my web.xml file) from within a test case?
>>>>>>>>Here's what I have:
>>>>>>>>
>>>>>>>>in web.xml:
>>>>>>>>.
>>>>>>>>.
>>>>>>>><context-param>
>>>>>>>>    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>>>>>    <param-value>server</param-value>
>>>>>>>></context-param>
>>>>>>>>
>>>>>>>>
>>>>>>>>In my test case I was doing the following:
>>>>>>>>
>>>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
>>>>>>>>.
>>>>>>>>.
>>>>>>>>.
>>>>>>>> public void setUp() {
>>>>>>>>
>>>>>>>>
>>>>>>>>     ServletContextWrapper sc = new
>>>>>>>>ServletContextWrapper(config.getServletContext());
>>>>>>>>     sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>>>>>         "client");
>>>>>>>>.
>>>>>>>>.
>>>>>>>>.
>>>>>>>>Not sure the new context param is set.....
>>>>>>>>
>>>>>>>>Any help would be greatly appreciated....
>>>>>>>>
>>>>>>>>Thanks, Roger.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>--------------------------------------------------------------------
>>>>>>>>                
>>>>>>>>
>>-
>>    
>>
>>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                
>>>>>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>              
>>>>>>>
>>--
>>    
>>
>>>>>>>              
>>>>>>>
>>>>-
>>>>
>>>>
>>>>        
>>>>
>>>>>>>---------------------------------------------------------------------
>>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>
>>>      
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>
>  
>


RE: Changing web.xml conext init param...

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

It's normal it's not working. When you write:

assertTrue(
    context.getOriginalContext().getInitParameter("param").equals(
    "testoverrideparam"));

You have to understand that by calling getOriginalContext() you're asking
for ... well... the original context and not the one you're working on!

It should be:

assertTrue(
    context.getInitParameter("param").equals("testoverrideparam"));

-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: mardi 10 août 2004 00:07
> To: Vincent Massol
> Cc: 'Cactus Developers List'
> Subject: Re: Changing web.xml conext init param...
> 
> Hi Vincent -
> 
> Thanks for the test module.  I also found it under the cactus samples
> dir...
> I've tested the sample and it works as is.  However, I tweaked it
> slightly:
> 
>     public void testSetContextInitParameterOverrideWebXmlParameter()
>     {
>         // Note: "param" is a parameter that must be already defined in
>         // web.xml (in the context-param element), with a value different
>         // than "testoverrideparam1".
>         assertTrue("'param' context-param should been defined in web.xml",
>             context.getOriginalContext().getInitParameter("param") !=
> null);
>         assertTrue(
> 
> !context.getOriginalContext().getInitParameter("param").equals(
>             "testoverrideparam"));
> 
> 
>         context.setInitParameter("param", "testoverrideparam");
> 
> // Added this assertion which fails.....
> 
> 
>         assertTrue(
>             context.getOriginalContext().getInitParameter("param").equals(
>             "testoverrideparam"));
> 
> 
> Should the "setInitParameter" call have affected (or changed in this case)
> the underlying ServletContext init parameter?
> 
> The reason why I ask, is that ideally, that is what we want for our test
> cases.
> We have code that checks the actual init param and does something slightly
> different depending on the value of the param.  We want to test this code
> with Cactus.
> 
> Thanks, in advance, Roger.
> 
> 
> 
> Vincent Massol wrote:
> 
> >Roger,
> >
> >That attachment may have been stripped by the mailing list manager. I'm
> >ccing your private email address to ensure you receive it this time.
> >
> >Thanks
> >-Vincent
> >
> >
> >
> >>-----Original Message-----
> >>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>Sent: lundi 9 août 2004 17:06
> >>To: Cactus Developers List; vmassol@pivolis.com
> >>Subject: Re: Changing web.xml conext init param...
> >>
> >>Hi Vincent,
> >>
> >>I did not receive an example in your last email.  Can you resend?
> >>
> >>Thanks, in advance, Roger.
> >>
> >>Vincent Massol wrote:
> >>
> >>
> >>
> >>>Hi Riger,
> >>>
> >>>I don't know what's wrong. Maybe the fact that you're using a
> JspTestCase
> >>>and not a ServletTestCase?
> >>>
> >>>Could you try running the example I've included in my previous email to
> >>>
> >>>
> >>you
> >>
> >>
> >>>to see if it works on your machine? If it works, you can work from
> there
> >>>
> >>>
> >>and
> >>
> >>
> >>>slowly modify the sample to your target test.
> >>>
> >>>Thanks
> >>>-Vincent
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>Sent: lundi 9 août 2004 14:55
> >>>>To: cactus-dev@jakarta.apache.org
> >>>>Cc: vmassol@pivolis.com
> >>>>Subject: Re: Changing web.xml conext init param...
> >>>>
> >>>>Hi,
> >>>>
> >>>>I've changed the code accordingly with no success:
> >>>>
> >>>>public class TestRenderResponsePhase extends JspFacesTestCase {
> >>>>   .
> >>>>   .
> >>>>
> >>>>     public void setUp() {
> >>>>
> >>>>
> >>>>
> >>>>((ServletContextWrapper)config.getServletContext()).setInitParameter(
> >>>>           "javax.faces.STATE_SAVING_METHOD", "client");
> >>>>       System.out.println("GET INIT PARAM"+
> >>>>           Config.getServletContext().getInitParameter(
> >>>>           "javax.faces.STATE_SAVING_METHOD"));
> >>>>.
> >>>>.
> >>>>.
> >>>>
> >>>>It appears the init parameter still has the default "server"  value.
> >>>>
> >>>>Shouldn't this have worked?  What am I missing?
> >>>>
> >>>>Thanks in advance, Roger
> >>>>
> >>>>
> >>>>
> >>>>Vincent Massol wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi Roger,
> >>>>>
> >>>>>Your code is invalid. You should write:
> >>>>>
> >>>>>((ServletContextWrapper)
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>Config.getServletContext()).setInitParameter(...);
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>As shown in the sample application, part of the Cactus distribution
> >>>>>
> >>>>>
> >>(I'm
> >>
> >>
> >>>>>attaching one of its class for your reference).
> >>>>>
> >>>>>-Vincent
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>-----Original Message-----
> >>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>>>Sent: jeudi 5 août 2004 22:36
> >>>>>>To: cactus-dev@jakarta.apache.org
> >>>>>>Subject: Changing web.xml conext init param...
> >>>>>>
> >>>>>>i,
> >>>>>>
> >>>>>>I'm using cactus 1.6.   How can I dynamically change the a context
> >>>>>>
> >>>>>>
> >>init
> >>
> >>
> >>>>>>param
> >>>>>>(that was loaded from my web.xml file) from within a test case?
> >>>>>>Here's what I have:
> >>>>>>
> >>>>>>in web.xml:
> >>>>>>.
> >>>>>>.
> >>>>>> <context-param>
> >>>>>>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>>>>>     <param-value>server</param-value>
> >>>>>> </context-param>
> >>>>>>
> >>>>>>
> >>>>>>In my test case I was doing the following:
> >>>>>>
> >>>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
> >>>>>>.
> >>>>>>.
> >>>>>>.
> >>>>>>  public void setUp() {
> >>>>>>
> >>>>>>
> >>>>>>      ServletContextWrapper sc = new
> >>>>>>ServletContextWrapper(config.getServletContext());
> >>>>>>      sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>>>>>          "client");
> >>>>>>.
> >>>>>>.
> >>>>>>.
> >>>>>>Not sure the new context param is set.....
> >>>>>>
> >>>>>>Any help would be greatly appreciated....
> >>>>>>
> >>>>>>Thanks, Roger.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>--------------------------------------------------------------------
> -
> >>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>---------------------------------------------------------------------
> --
> >>>>>
> >>>>>
> >>-
> >>
> >>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> >
> >
> >



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Hi Vincent -

Thanks for the test module.  I also found it under the cactus samples dir...
I've tested the sample and it works as is.  However, I tweaked it slightly:

    public void testSetContextInitParameterOverrideWebXmlParameter()
    {
        // Note: "param" is a parameter that must be already defined in
        // web.xml (in the context-param element), with a value different
        // than "testoverrideparam1".
        assertTrue("'param' context-param should been defined in web.xml",
            context.getOriginalContext().getInitParameter("param") != null);
        assertTrue(
            !context.getOriginalContext().getInitParameter("param").equals(
            "testoverrideparam"));
                                                                                        

        context.setInitParameter("param", "testoverrideparam");

// Added this assertion which fails.....
                                                                                       

        assertTrue(
            context.getOriginalContext().getInitParameter("param").equals(
            "testoverrideparam"));


Should the "setInitParameter" call have affected (or changed in this case)
the underlying ServletContext init parameter?

The reason why I ask, is that ideally, that is what we want for our test 
cases.
We have code that checks the actual init param and does something slightly
different depending on the value of the param.  We want to test this code
with Cactus.

Thanks, in advance, Roger.



Vincent Massol wrote:

>Roger,
>
>That attachment may have been stripped by the mailing list manager. I'm
>ccing your private email address to ensure you receive it this time.
>
>Thanks
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: lundi 9 août 2004 17:06
>>To: Cactus Developers List; vmassol@pivolis.com
>>Subject: Re: Changing web.xml conext init param...
>>
>>Hi Vincent,
>>
>>I did not receive an example in your last email.  Can you resend?
>>
>>Thanks, in advance, Roger.
>>
>>Vincent Massol wrote:
>>
>>    
>>
>>>Hi Riger,
>>>
>>>I don't know what's wrong. Maybe the fact that you're using a JspTestCase
>>>and not a ServletTestCase?
>>>
>>>Could you try running the example I've included in my previous email to
>>>      
>>>
>>you
>>    
>>
>>>to see if it works on your machine? If it works, you can work from there
>>>      
>>>
>>and
>>    
>>
>>>slowly modify the sample to your target test.
>>>
>>>Thanks
>>>-Vincent
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>Sent: lundi 9 août 2004 14:55
>>>>To: cactus-dev@jakarta.apache.org
>>>>Cc: vmassol@pivolis.com
>>>>Subject: Re: Changing web.xml conext init param...
>>>>
>>>>Hi,
>>>>
>>>>I've changed the code accordingly with no success:
>>>>
>>>>public class TestRenderResponsePhase extends JspFacesTestCase {
>>>>   .
>>>>   .
>>>>
>>>>     public void setUp() {
>>>>
>>>>
>>>>
>>>>((ServletContextWrapper)config.getServletContext()).setInitParameter(
>>>>           "javax.faces.STATE_SAVING_METHOD", "client");
>>>>       System.out.println("GET INIT PARAM"+
>>>>           Config.getServletContext().getInitParameter(
>>>>           "javax.faces.STATE_SAVING_METHOD"));
>>>>.
>>>>.
>>>>.
>>>>
>>>>It appears the init parameter still has the default "server"  value.
>>>>
>>>>Shouldn't this have worked?  What am I missing?
>>>>
>>>>Thanks in advance, Roger
>>>>
>>>>
>>>>
>>>>Vincent Massol wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi Roger,
>>>>>
>>>>>Your code is invalid. You should write:
>>>>>
>>>>>((ServletContextWrapper)
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>Config.getServletContext()).setInitParameter(...);
>>>>
>>>>
>>>>        
>>>>
>>>>>As shown in the sample application, part of the Cactus distribution
>>>>>          
>>>>>
>>(I'm
>>    
>>
>>>>>attaching one of its class for your reference).
>>>>>
>>>>>-Vincent
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>>>Sent: jeudi 5 août 2004 22:36
>>>>>>To: cactus-dev@jakarta.apache.org
>>>>>>Subject: Changing web.xml conext init param...
>>>>>>
>>>>>>i,
>>>>>>
>>>>>>I'm using cactus 1.6.   How can I dynamically change the a context
>>>>>>            
>>>>>>
>>init
>>    
>>
>>>>>>param
>>>>>>(that was loaded from my web.xml file) from within a test case?
>>>>>>Here's what I have:
>>>>>>
>>>>>>in web.xml:
>>>>>>.
>>>>>>.
>>>>>> <context-param>
>>>>>>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>>>     <param-value>server</param-value>
>>>>>> </context-param>
>>>>>>
>>>>>>
>>>>>>In my test case I was doing the following:
>>>>>>
>>>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
>>>>>>.
>>>>>>.
>>>>>>.
>>>>>>  public void setUp() {
>>>>>>
>>>>>>
>>>>>>      ServletContextWrapper sc = new
>>>>>>ServletContextWrapper(config.getServletContext());
>>>>>>      sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>>>          "client");
>>>>>>.
>>>>>>.
>>>>>>.
>>>>>>Not sure the new context param is set.....
>>>>>>
>>>>>>Any help would be greatly appreciated....
>>>>>>
>>>>>>Thanks, Roger.
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>-----------------------------------------------------------------------
>>>>>          
>>>>>
>>-
>>    
>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>
>>>
>>>      
>>>
>>>
>>
>
>
>  
>


RE: Changing web.xml conext init param...

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

That attachment may have been stripped by the mailing list manager. I'm
ccing your private email address to ensure you receive it this time.

Thanks
-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: lundi 9 ao�t 2004 17:06
> To: Cactus Developers List; vmassol@pivolis.com
> Subject: Re: Changing web.xml conext init param...
> 
> Hi Vincent,
> 
> I did not receive an example in your last email.  Can you resend?
> 
> Thanks, in advance, Roger.
> 
> Vincent Massol wrote:
> 
> >Hi Riger,
> >
> >I don't know what's wrong. Maybe the fact that you're using a JspTestCase
> >and not a ServletTestCase?
> >
> >Could you try running the example I've included in my previous email to
> you
> >to see if it works on your machine? If it works, you can work from there
> and
> >slowly modify the sample to your target test.
> >
> >Thanks
> >-Vincent
> >
> >
> >
> >>-----Original Message-----
> >>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>Sent: lundi 9 ao�t 2004 14:55
> >>To: cactus-dev@jakarta.apache.org
> >>Cc: vmassol@pivolis.com
> >>Subject: Re: Changing web.xml conext init param...
> >>
> >>Hi,
> >>
> >>I've changed the code accordingly with no success:
> >>
> >>public class TestRenderResponsePhase extends JspFacesTestCase {
> >>    .
> >>    .
> >>
> >>      public void setUp() {
> >>
> >>
> >>
> >>((ServletContextWrapper)config.getServletContext()).setInitParameter(
> >>            "javax.faces.STATE_SAVING_METHOD", "client");
> >>        System.out.println("GET INIT PARAM"+
> >>            Config.getServletContext().getInitParameter(
> >>            "javax.faces.STATE_SAVING_METHOD"));
> >>.
> >>.
> >>.
> >>
> >>It appears the init parameter still has the default "server"  value.
> >>
> >>Shouldn't this have worked?  What am I missing?
> >>
> >>Thanks in advance, Roger
> >>
> >>
> >>
> >>Vincent Massol wrote:
> >>
> >>
> >>
> >>>Hi Roger,
> >>>
> >>>Your code is invalid. You should write:
> >>>
> >>>((ServletContextWrapper)
> >>>
> >>>
> >>Config.getServletContext()).setInitParameter(...);
> >>
> >>
> >>>As shown in the sample application, part of the Cactus distribution
> (I'm
> >>>attaching one of its class for your reference).
> >>>
> >>>-Vincent
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>>>Sent: jeudi 5 ao�t 2004 22:36
> >>>>To: cactus-dev@jakarta.apache.org
> >>>>Subject: Changing web.xml conext init param...
> >>>>
> >>>>i,
> >>>>
> >>>>I'm using cactus 1.6.   How can I dynamically change the a context
> init
> >>>>param
> >>>>(that was loaded from my web.xml file) from within a test case?
> >>>>Here's what I have:
> >>>>
> >>>>in web.xml:
> >>>>.
> >>>>.
> >>>>  <context-param>
> >>>>      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>>>      <param-value>server</param-value>
> >>>>  </context-param>
> >>>>
> >>>>
> >>>>In my test case I was doing the following:
> >>>>
> >>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
> >>>>.
> >>>>.
> >>>>.
> >>>>   public void setUp() {
> >>>>
> >>>>
> >>>>       ServletContextWrapper sc = new
> >>>>ServletContextWrapper(config.getServletContext());
> >>>>       sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>>>           "client");
> >>>>.
> >>>>.
> >>>>.
> >>>>Not sure the new context param is set.....
> >>>>
> >>>>Any help would be greatly appreciated....
> >>>>
> >>>>Thanks, Roger.
> >>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>-----------------------------------------------------------------------
> -
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >
> >
> >



Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Hi Vincent,

I did not receive an example in your last email.  Can you resend?

Thanks, in advance, Roger.

Vincent Massol wrote:

>Hi Riger,
>
>I don't know what's wrong. Maybe the fact that you're using a JspTestCase
>and not a ServletTestCase?
>
>Could you try running the example I've included in my previous email to you
>to see if it works on your machine? If it works, you can work from there and
>slowly modify the sample to your target test.
>
>Thanks
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: lundi 9 août 2004 14:55
>>To: cactus-dev@jakarta.apache.org
>>Cc: vmassol@pivolis.com
>>Subject: Re: Changing web.xml conext init param...
>>
>>Hi,
>>
>>I've changed the code accordingly with no success:
>>
>>public class TestRenderResponsePhase extends JspFacesTestCase {
>>    .
>>    .
>>
>>      public void setUp() {
>>
>>
>>
>>((ServletContextWrapper)config.getServletContext()).setInitParameter(
>>            "javax.faces.STATE_SAVING_METHOD", "client");
>>        System.out.println("GET INIT PARAM"+
>>            Config.getServletContext().getInitParameter(
>>            "javax.faces.STATE_SAVING_METHOD"));
>>.
>>.
>>.
>>
>>It appears the init parameter still has the default "server"  value.
>>
>>Shouldn't this have worked?  What am I missing?
>>
>>Thanks in advance, Roger
>>
>>
>>
>>Vincent Massol wrote:
>>
>>    
>>
>>>Hi Roger,
>>>
>>>Your code is invalid. You should write:
>>>
>>>((ServletContextWrapper)
>>>      
>>>
>>Config.getServletContext()).setInitParameter(...);
>>    
>>
>>>As shown in the sample application, part of the Cactus distribution (I'm
>>>attaching one of its class for your reference).
>>>
>>>-Vincent
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>>>Sent: jeudi 5 août 2004 22:36
>>>>To: cactus-dev@jakarta.apache.org
>>>>Subject: Changing web.xml conext init param...
>>>>
>>>>i,
>>>>
>>>>I'm using cactus 1.6.   How can I dynamically change the a context init
>>>>param
>>>>(that was loaded from my web.xml file) from within a test case?
>>>>Here's what I have:
>>>>
>>>>in web.xml:
>>>>.
>>>>.
>>>>  <context-param>
>>>>      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>>>      <param-value>server</param-value>
>>>>  </context-param>
>>>>
>>>>
>>>>In my test case I was doing the following:
>>>>
>>>>public class TestRenderResponsePhase extends JspFacesTestCase    {
>>>>.
>>>>.
>>>>.
>>>>   public void setUp() {
>>>>
>>>>
>>>>       ServletContextWrapper sc = new
>>>>ServletContextWrapper(config.getServletContext());
>>>>       sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>>>           "client");
>>>>.
>>>>.
>>>>.
>>>>Not sure the new context param is set.....
>>>>
>>>>Any help would be greatly appreciated....
>>>>
>>>>Thanks, Roger.
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>        
>>>>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>>
>>>
>>>      
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>
>  
>


RE: Changing web.xml conext init param...

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

I don't know what's wrong. Maybe the fact that you're using a JspTestCase
and not a ServletTestCase?

Could you try running the example I've included in my previous email to you
to see if it works on your machine? If it works, you can work from there and
slowly modify the sample to your target test.

Thanks
-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: lundi 9 août 2004 14:55
> To: cactus-dev@jakarta.apache.org
> Cc: vmassol@pivolis.com
> Subject: Re: Changing web.xml conext init param...
> 
> Hi,
> 
> I've changed the code accordingly with no success:
> 
> public class TestRenderResponsePhase extends JspFacesTestCase {
>     .
>     .
> 
>       public void setUp() {
> 
> 
> 
> ((ServletContextWrapper)config.getServletContext()).setInitParameter(
>             "javax.faces.STATE_SAVING_METHOD", "client");
>         System.out.println("GET INIT PARAM"+
>             Config.getServletContext().getInitParameter(
>             "javax.faces.STATE_SAVING_METHOD"));
> .
> .
> .
> 
> It appears the init parameter still has the default "server"  value.
> 
> Shouldn't this have worked?  What am I missing?
> 
> Thanks in advance, Roger
> 
> 
> 
> Vincent Massol wrote:
> 
> >Hi Roger,
> >
> >Your code is invalid. You should write:
> >
> >((ServletContextWrapper)
> Config.getServletContext()).setInitParameter(...);
> >
> >As shown in the sample application, part of the Cactus distribution (I'm
> >attaching one of its class for your reference).
> >
> >-Vincent
> >
> >
> >
> >>-----Original Message-----
> >>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> >>Sent: jeudi 5 août 2004 22:36
> >>To: cactus-dev@jakarta.apache.org
> >>Subject: Changing web.xml conext init param...
> >>
> >>i,
> >>
> >>I'm using cactus 1.6.   How can I dynamically change the a context init
> >>param
> >>(that was loaded from my web.xml file) from within a test case?
> >>Here's what I have:
> >>
> >>in web.xml:
> >>.
> >>.
> >>   <context-param>
> >>       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> >>       <param-value>server</param-value>
> >>   </context-param>
> >>
> >>
> >>In my test case I was doing the following:
> >>
> >>public class TestRenderResponsePhase extends JspFacesTestCase    {
> >>.
> >>.
> >>.
> >>    public void setUp() {
> >>
> >>
> >>        ServletContextWrapper sc = new
> >>ServletContextWrapper(config.getServletContext());
> >>        sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
> >>            "client");
> >>.
> >>.
> >>.
> >>Not sure the new context param is set.....
> >>
> >>Any help would be greatly appreciated....
> >>
> >>Thanks, Roger.
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >>
> >>
> >
> >
> >
> >
> >------------------------------------------------------------------------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
> >
> >



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


Re: Changing web.xml conext init param...

Posted by Roger Kitain <Ro...@Sun.COM>.
Hi,

I've changed the code accordingly with no success:

public class TestRenderResponsePhase extends JspFacesTestCase {
    .
    . 
                                                                                                                                                       
      public void setUp() {
                                                                                        

        
((ServletContextWrapper)config.getServletContext()).setInitParameter(
            "javax.faces.STATE_SAVING_METHOD", "client");
        System.out.println("GET INIT PARAM"+
            Config.getServletContext().getInitParameter(
            "javax.faces.STATE_SAVING_METHOD"));
.
.
.

It appears the init parameter still has the default "server"  value.

Shouldn't this have worked?  What am I missing?

Thanks in advance, Roger



Vincent Massol wrote:

>Hi Roger,
>
>Your code is invalid. You should write:
>
>((ServletContextWrapper) Config.getServletContext()).setInitParameter(...);
>
>As shown in the sample application, part of the Cactus distribution (I'm
>attaching one of its class for your reference).
>
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
>>Sent: jeudi 5 août 2004 22:36
>>To: cactus-dev@jakarta.apache.org
>>Subject: Changing web.xml conext init param...
>>
>>i,
>>
>>I'm using cactus 1.6.   How can I dynamically change the a context init
>>param
>>(that was loaded from my web.xml file) from within a test case?
>>Here's what I have:
>>
>>in web.xml:
>>.
>>.
>>   <context-param>
>>       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>       <param-value>server</param-value>
>>   </context-param>
>>
>>
>>In my test case I was doing the following:
>>
>>public class TestRenderResponsePhase extends JspFacesTestCase    {
>>.
>>.
>>.
>>    public void setUp() {
>>
>>
>>        ServletContextWrapper sc = new
>>ServletContextWrapper(config.getServletContext());
>>        sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>>            "client");
>>.
>>.
>>.
>>Not sure the new context param is set.....
>>
>>Any help would be greatly appreciated....
>>
>>Thanks, Roger.
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>>    
>>
>
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-dev-help@jakarta.apache.org
>  
>


RE: Changing web.xml conext init param...

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

Your code is invalid. You should write:

((ServletContextWrapper) Config.getServletContext()).setInitParameter(...);

As shown in the sample application, part of the Cactus distribution (I'm
attaching one of its class for your reference).

-Vincent

> -----Original Message-----
> From: Roger Kitain [mailto:Roger.Kitain@Sun.COM]
> Sent: jeudi 5 ao�t 2004 22:36
> To: cactus-dev@jakarta.apache.org
> Subject: Changing web.xml conext init param...
> 
> i,
> 
> I'm using cactus 1.6.   How can I dynamically change the a context init
> param
> (that was loaded from my web.xml file) from within a test case?
> Here's what I have:
> 
> in web.xml:
> .
> .
>    <context-param>
>        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>        <param-value>server</param-value>
>    </context-param>
> 
> 
> In my test case I was doing the following:
> 
> public class TestRenderResponsePhase extends JspFacesTestCase    {
> .
> .
> .
>     public void setUp() {
> 
> 
>         ServletContextWrapper sc = new
> ServletContextWrapper(config.getServletContext());
>         sc.setInitParameter("javax.faces.STATE_SAVING_METHOD",
>             "client");
> .
> .
> .
> Not sure the new context param is set.....
> 
> Any help would be greatly appreciated....
> 
> Thanks, Roger.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-dev-help@jakarta.apache.org