Jonathan Scher <scher.jonat...@...> writes:

> 
> After a few hours, I got my solution. I putted it on the wiki page, but plz
> check for improvement and english mistakes...
> 
> Regards,
> Jonathan Scher
> 
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

The day before yesterday I wrote a little blog about this:
http://blog.xebia.com/2008/12/16/unit-testing-a-stripes-actionbean-wired-with-spring-beans/

I should've waited a few days ;-)

My solution however is compatible with Maven 2. The Spring configuration files
are located in src/main/resources and are not available in the WEB-INF when
running the unit tests.

Wasn't the ActionResolver.PackageFilters parameter deprecated and shouldn't
ActionResolver.Packages be used?

The method below is how I did it:

@Before
public void setUpMockServletContext() {
        context = new MockServletContext("hibernate-test");

        // Add the Stripes Filter
        Map<String, String> filterParams = new HashMap<String, String>();
        filterParams.put("Interceptor.Classes",                         
"net.sourceforge.stripes.integration.spring.SpringInterceptor," + 
"net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor");
        filterParams.put("ActionResolver.Packages", "com.xebia.htest.web");
        context.addFilter(StripesFilter.class, "StripesFilter", filterParams);

        // Add the Stripes Dispatcher
        context.setServlet(DispatcherServlet.class, "StripesDispatcher", null);

        context.addInitParameter("contextConfigLocation",
                
"classpath:dataSourceContext.xml\nclasspath:daoContext.xml"+
"\nclasspath:applicationContext.xml");

        ContextLoaderListener springContextLoader = new ContextLoaderListener();
        springContextLoader.contextInitialized(new 
ServletContextEvent(context));
}

Kind regards,

Jeroen van Wilgenburg



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to