1 Reply Latest reply on Mar 11, 2010 6:56 AM by alesj

    Updating ClassPool version at JBoss Deployers project

    flavia.rainone

      I'm updating the version of classpool to 2.0.0.Alpha4 in jboss-deployers:

      https://jira.jboss.org/jira/browse/JBDEPLOY-250

       

      As I told Ales in a private e-mail, updating the classpool version raised new requirements for the classpool tests to work (in the jboss-deployers project).

       

      First of all, I need to set a FilteredClassPool as the SystemClassPool so that the excluded classes can be filtered out. This should be set up by a test deleagte, but, to create a delegate, I needed to break a few of the design conventions in the tests:

       

      - my test delegate must be a subclass of BootstrapDeployersTestDelegate, but it ended up containing duplicate code:

      ClassFilter classFilter = new ClassFilter()
      {
       // duplicate code
      };
      defaultClassPool = new FilteredClassPool(AbstractClassPoolFactory.getDefaultClassPool(), classFilter);
      

      I need to use the same classFilter that is used by BootstrapDeployersTestDelegate. However, the way the code is right now, I can't have that, so I ended up duplicating this code

       

      - my test delegate needs to be defined for only ClassPoolTestCase and JavassistTypeInfoTestCase, but not for IntrospectionTypeInfoTestCase.
      Hence, I cannot apply it by implementing a getDelegate() method at ReflectTest, which would be the right place if all subclasses needed the delegate. So, I ended up adding it to ClassPoolTest and to JavassistTypeInfoTestCase. But JavassistTITC is not abstract, and, for what I can tell, it is a design convention in the project that this method should be added always to an abstract test class. On the other hand, I'm not sure if I should add a JavassistTypeInfoTest class just for that.

       

      - following the conventions, my TestDelegate should be named after the Test class. So, if I was applying it to ReflectTest, it would be called ReflectTestDelegate. But as I'm applying it to two test classes, I don't know what to name it? I temporarily named it JavassistTestDelegate.

       

      FYI, another change that I'm commiting is that, with VFS3 new URL format (using file://), I will also need a FilteredIsLocalResourcePlugin, so that the classes in the excluded packages can be filtered out before the URL reaches the ClassLoader level.

       

      I'll be committing these changes for Ales to take a look and decide what is the best way of working around these design issues.