MockRoundTrip never destroys filters and dispatcher servlet
-----------------------------------------------------------

                 Key: STS-725
                 URL: http://www.stripesframework.org/jira/browse/STS-725
             Project: Stripes
          Issue Type: Bug
    Affects Versions: Release 1.6
         Environment: Linux Ubuntu 9.10 64bits
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)


            Reporter: Remi VANKEISBELCK
            Assignee: Remi VANKEISBELCK
            Priority: Trivial


MockRoundTrip can't be "closed" or "destroyed". 

Thereby, registered filters and dispatcher servlet are never destroyed either, 
and this causes problems with StripesFilter.getConfiguration().

StripesFilter internally stores refs to configurations as WeakReferences, and 
tries to clean them when you ask for a Configuration (see StripesFilter, line 
150). But as WeakRefs are not really predictable, you can have more than 1 
config in the static "configurations" field, which eventually prevents from 
getting the Configuration using StripesFilter.getConfiguration().

The following test currently fails :

public void testGetStripesConfigTwice() {
    int count = 2;
    for (int i=0; i<count ; i++) {
      Map<String,String> params = new HashMap<String,String>();
      params.put("ActionResolver.Packages", "foo.bar");
      MockServletContext mockServletContext = new 
MockServletContext("FacetedResolverTest");
      mockServletContext.addFilter(StripesFilter.class, "StripesFilter", 
params);
      Configuration config = StripesFilter.getConfiguration();
      assertNotNull(config);
/*
      for (Filter f : mockServletContext.getFilters()) {
        f.destroy();
      }
*/
    }
  }
 
but it passed when you set count to 1, or if you manually destroy all 
registered filters (see commented code).

A "MockServletContext.destroy()" method would be appreciated.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to