On Oct 21, 2010, at 15:17, Jörg von Frantzius wrote:

> Hi,
> 
> when running tests from maven, it seems that 
> info.magnolia.cms.util.ClasspathResourcesUtil.findResources(Filter) won't 
> find resources from any jars. I just saw in the debugger that it treats the 
> classloader as a URLClassLoader, asks it for URLs, gets 
> "[file:/tmp/surefirebooter2965883144735553843.jar]", and tries to find 
> resources only in there.
> 
> I want to run a RepositoryTestCase from within the STK module, which fails 
> because it won't find any module descriptors. I'm not sure how to go about 
> with this problem, maybe fix ClassPathResourcesUtil to test for "surefire" to 
> occur within urls[0].getPath(), like it is done for JBoss 5 already?

Yeah, that's an ugly one.
The workaround you mention checks for "WEB-INF/classes/" which seem a little 
sounder than checking for "surefire" - we can't introduce workarounds for each 
and every build system's temporary files in there.

The way we do this at moment: we fake the module loading. See for instance 
http://svn.magnolia-cms.com/svn/community/modules/forum/trunk/magnolia-module-forum/src/test/java/info/magnolia/module/forum/ForumRepositoryTestCase.java
 

Another approach to this sort of problem would be to refactor 
ClasspathResourcesUtil so that it becomes "pluggable". In tests, you'd work 
with a ClasspathResourcesUtil implementation that knows about the specific 
classpath workarounds it needs to do (and we'd probably have a couple of 
JBoss*ClasspathResourcesUtil, WebSphereClasspathResourcesUtil, etc 
implementations too ...)

hth,

-g

> 
> Regards,
> Jörg
> 
> -- 
> Dipl. inf. Jörg von Frantzius, System Architect
> Email mailto:[email protected]
> Phone +49 30 283921-318
> Fax +49 30 283921-29
> Aperto AG - In der Pianofabrik
> Chausseestraße 5, D-10115 Berlin-Mitte
> Web http://www.aperto.de
> HRB 77049, AG Berlin Charlottenburg
> Vorstand: Dirk Buddensiek
> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to