[jboss-dev-forums] [JBoss Microcontainer Development] - Testing Deployers with new Reflect + ClassPool

alesj do-not-reply at jboss.com
Thu Oct 15 04:53:45 EDT 2009


Reporting my findings on the new ClassPoolTestCase:
 - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java

All the simple deployment tests pass,
it was the more hierarchy complex (if you can call .ear complex) that immediately failed for me.

It appeared that the old ClassPool's ClassLoader was used:

  | junit.framework.AssertionFailedError: expected:<BaseClassLoader at 135da43{vfs://top-level.ear/}> but was:<BaseClassLoader at 2cbc86{vfs://simple.jar/}>
  | 	at org.jboss.test.deployers.vfs.classpool.test.ClassPoolTest.assertClassPool(ClassPoolTest.java:83)
  | 	at org.jboss.test.deployers.vfs.classpool.test.ClassPoolTestCase.testBasicEar(ClassPoolTestCase.java:82)

Then I tied the RegisterModuleCallback with ClassLoading to properly track Module creation/destruction.

  |   <bean name="RegisterModuleCallback" class="org.jboss.classpool.plugins.as5.RegisterModuleCallback">
  |      <install method="addModuleRegistry" bean="ClassLoading" whenRequired="Start">
  |        <parameter><this/></parameter>
  |      </install>
  |      <uninstall method="removeModuleRegistry" bean="ClassLoading" whenRequired="Start">
  |        <parameter><this/></parameter>
  |      </uninstall>
  |   </bean>
  | 

This now looks like something simply snatches CL under the ClassPool:

  | junit.framework.AssertionFailedError: expected:<BaseClassLoader at bafdff{vfs://top-level.ear/}> but was:<null>
  | 

Also, the assertClassPool method doesn't look valid for all classes.
e.g. top deployment unit's classloader cannot see war's classes --> AnyServlet.class in testBasicEar


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4260467#4260467

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4260467



More information about the jboss-dev-forums mailing list