struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Support for Convention-Plugin through the Junit-Plugin
Date Sun, 17 Mar 2013 12:50:52 GMT
2013/3/17 Christian Grobmeier <grobmeier@gmail.com>:
> It says, it would be good to have the convention plugin supported by
> the junit plugin. I thought this should be the case already and did
> some testing on my local box:
>
> - added the convention plugin to my pom
> - created content/hello-world.jsp in resources
> - create a mini test case which just does:
> String output = executeAction("/hello-world");
>
> I have expected that all my other test cases will fail, since my guess
> was all the urls have changed with the addition of the convention
> plugin. Actually this was not the case and everything worked well,
> except of course the convention-testcase.

No they should not, as urls should remains as is, did you try to use
"/hello-world.action" instead? No extension has nothing to do with the
Convention plugin - you can have the same with xml based configuration
just define struts.action.extension.

> Now I suspect there is more work to be done, and something in this class:
> http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsJUnit4TestCase.java?view=markup
>
> should be changed to make it work, esp in the initDispatcherParams or
> initDispatcher method. Unfortunately a brief look into the Convention
> plugin didn't teach me how it actually works.
>
> Does anybody have a pointer for me where to start?

The Convention plugin is responsible for a configuration, so basically
what it does is to scan a classpath to look for actions based on
defined constants. It's addition to normal xml based configuration,
where the Convention plugin will just add configuration of discovered
actions.

I have no idea where to start, but you can check
PackageBasedActionConfigBuilderTest. Basically
ClasspathConfigurationProvider and ClasspathPackageProvider have to be
included in configuration building process.


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message