You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by "DeHamer, Brian" <br...@hp.com> on 2005/05/07 01:54:10 UTC
Beehive JPF and StrutsTestCase
Anyone had any luck getting StrutsTestCase for JUnit working with
Beehive JPF? I managed to get it mostly working, but have run into one
problem:
My first test always executes fine, but before the second test is
executed StrutsTestCase destroys and re-inits the servlet as it cycles
the test fixutre. When this happens I always get a
ConfigInitializationException with a message that says "Config
initialization already completed; unable to reload the NetUI config
file". I managed to track this down and it seems to be related to a
static variable in the org.apache.beehive.netui.util.config.ConfigUtil
class that gets set upon the servlet initialization, but is never unset
-- even if the servlet is destroyed. Since it's a static member of the
ConfigUtil class the value sticks around even if I use a totally new
instance of the PageFlowActionServlet on subsequent tests.
At this point, my only work-around it to lump all of my tests into a
single testcase so that the PageFlowActionServlet never gets cycled --
obviously this isn't a very attractive solution. I'd definitely be
interested to hear from anyone that has dealt with this problem already
or has an idea for another workaround.
Thanks in advance.
Brian DeHamer
Hewlett-Packard Co.
Re: Beehive JPF and StrutsTestCase
Posted by Richard Feit <ri...@bea.com>.
Brian,
I can't assign the bug back to you
(http://issues.apache.org/jira/browse/BEEHIVE-615 ), but it's fixed
now. Would you let me know if it works for you? I'll be adding a few
StrutsTestCase-based tests to our suite tomorrow.
Thanks,
Rich
Richard Feit wrote:
> Hi Brian,
>
> We need to address JUnit testing of page flows in a serious way for
> 1.1... but we shouldn't be breaking StrutsTestCase in 1.0. Would you
> mind filing a bug on this
> (http://issues.apache.org/jira/secure/CreateIssue!default.jspa )? The
> use of statics may be a larger issue, but at the very least we should
> uninitialize the config object when the Servlet is destroyed.
>
> Glad you're pushing on this issue!
>
> Thanks,
> Rich
>
> DeHamer, Brian wrote:
>
>> Anyone had any luck getting StrutsTestCase for JUnit working with
>> Beehive JPF? I managed to get it mostly working, but have run into one
>> problem:
>>
>> My first test always executes fine, but before the second test is
>> executed StrutsTestCase destroys and re-inits the servlet as it cycles
>> the test fixutre. When this happens I always get a
>> ConfigInitializationException with a message that says "Config
>> initialization already completed; unable to reload the NetUI config
>> file". I managed to track this down and it seems to be related to a
>> static variable in the org.apache.beehive.netui.util.config.ConfigUtil
>> class that gets set upon the servlet initialization, but is never unset
>> -- even if the servlet is destroyed. Since it's a static member of the
>> ConfigUtil class the value sticks around even if I use a totally new
>> instance of the PageFlowActionServlet on subsequent tests.
>>
>> At this point, my only work-around it to lump all of my tests into a
>> single testcase so that the PageFlowActionServlet never gets cycled --
>> obviously this isn't a very attractive solution. I'd definitely be
>> interested to hear from anyone that has dealt with this problem already
>> or has an idea for another workaround.
>>
>> Thanks in advance.
>>
>> Brian DeHamer
>> Hewlett-Packard Co.
>>
>>
>>
>
Re: Beehive JPF and StrutsTestCase
Posted by Richard Feit <ri...@bea.com>.
Hi Brian,
We need to address JUnit testing of page flows in a serious way for
1.1... but we shouldn't be breaking StrutsTestCase in 1.0. Would you
mind filing a bug on this
(http://issues.apache.org/jira/secure/CreateIssue!default.jspa )? The
use of statics may be a larger issue, but at the very least we should
uninitialize the config object when the Servlet is destroyed.
Glad you're pushing on this issue!
Thanks,
Rich
DeHamer, Brian wrote:
>Anyone had any luck getting StrutsTestCase for JUnit working with
>Beehive JPF? I managed to get it mostly working, but have run into one
>problem:
>
>My first test always executes fine, but before the second test is
>executed StrutsTestCase destroys and re-inits the servlet as it cycles
>the test fixutre. When this happens I always get a
>ConfigInitializationException with a message that says "Config
>initialization already completed; unable to reload the NetUI config
>file". I managed to track this down and it seems to be related to a
>static variable in the org.apache.beehive.netui.util.config.ConfigUtil
>class that gets set upon the servlet initialization, but is never unset
>-- even if the servlet is destroyed. Since it's a static member of the
>ConfigUtil class the value sticks around even if I use a totally new
>instance of the PageFlowActionServlet on subsequent tests.
>
>At this point, my only work-around it to lump all of my tests into a
>single testcase so that the PageFlowActionServlet never gets cycled --
>obviously this isn't a very attractive solution. I'd definitely be
>interested to hear from anyone that has dealt with this problem already
>or has an idea for another workaround.
>
>Thanks in advance.
>
>Brian DeHamer
>Hewlett-Packard Co.
>
>
>