[jboss-cvs] JBossAS SVN: r72924 - in projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 1 07:42:49 EDT 2008


Author: alesj
Date: 2008-05-01 07:42:49 -0400 (Thu, 01 May 2008)
New Revision: 72924

Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/support/InterceptionClassLoaderSystemDeployer.java
   projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java
   projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
Log:
ICL per unit.

Modified: projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/support/InterceptionClassLoaderSystemDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/support/InterceptionClassLoaderSystemDeployer.java	2008-05-01 11:41:58 UTC (rev 72923)
+++ projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/support/InterceptionClassLoaderSystemDeployer.java	2008-05-01 11:42:49 UTC (rev 72924)
@@ -34,13 +34,10 @@
  */
 public class InterceptionClassLoaderSystemDeployer extends AbstractLevelClassLoaderSystemDeployer
 {
-   private InterceptionClassLoader classLoader;
-
    public ClassLoader createClassLoader(DeploymentUnit unit) throws Exception
    {
       ClassLoader loader = super.createClassLoader(unit);
-      classLoader = new InterceptionClassLoader(loader);
-      return classLoader;
+      return new InterceptionClassLoader(loader);
    }
 
    @Override
@@ -82,9 +79,4 @@
          module.reset();
       }
    }
-
-   public InterceptionClassLoader getClassLoader()
-   {
-      return classLoader;
-   }
 }
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java	2008-05-01 11:41:58 UTC (rev 72923)
+++ projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationEnvTestCase.java	2008-05-01 11:42:49 UTC (rev 72924)
@@ -75,9 +75,9 @@
          ClassLoader cl = unit.getClassLoader();
          Class<TestAnnotation> taClass = (Class<TestAnnotation>)cl.loadClass("org.jboss.test.deployers.annotations.support.TestAnnotation");
 
-         assertNotLoaded("org.jboss.test.deployers.annotations.support.AnnotationsHolder");
+         assertNotLoaded(unit, "org.jboss.test.deployers.annotations.support.AnnotationsHolder");
          // annotations are loaded, OK?
-         assertLoaded("org.jboss.test.deployers.annotations.support.TestAnnotation");
+         assertLoaded(unit, "org.jboss.test.deployers.annotations.support.TestAnnotation");
 
          AnnotationEnvironment env = getAnnotationEnvironment(unit);
          Set<Class<?>> classes = env.classIsAnnotatedWith(taClass);
@@ -85,7 +85,7 @@
          assertEquals(1, classes.size());
          assertEquals(AnnotationsHolder.class.getName(), classes.iterator().next().getName());
 
-         assertLoaded("org.jboss.test.deployers.annotations.support.AnnotationsHolder");
+         assertLoaded(unit, "org.jboss.test.deployers.annotations.support.AnnotationsHolder");
 
          Element<TestAnnotation, Constructor> ec = getSingleton(env.classHasConstructorAnnotatedWith(taClass));
          Annotation ta = ec.getAnnotation();

Modified: projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationsTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2008-05-01 11:41:58 UTC (rev 72923)
+++ projects/jboss-deployers/trunk/deployers-impl/src/tests/org/jboss/test/deployers/annotations/test/AnnotationsTest.java	2008-05-01 11:42:49 UTC (rev 72924)
@@ -44,9 +44,10 @@
 import org.jboss.deployers.spi.attachments.MutableAttachments;
 import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
 import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.test.deployers.AbstractDeployerTest;
+import org.jboss.test.deployers.annotations.support.InterceptionClassLoader;
 import org.jboss.test.deployers.annotations.support.InterceptionClassLoaderSystemDeployer;
-import org.jboss.test.deployers.annotations.support.InterceptionClassLoader;
 import org.jboss.test.deployers.classloading.support.MockClassLoaderDescribeDeployer;
 
 /**
@@ -134,19 +135,23 @@
       return clazz.getMethod("value").invoke(annotation);
    }
 
-   protected void assertNotLoaded(String className)
+   protected void assertNotLoaded(DeploymentUnit unit, String className)
    {
-      assertCheckLoaded(className, false);
+      assertCheckLoaded(unit, className, false);
    }
 
-   protected void assertLoaded(String className)
+   protected void assertLoaded(DeploymentUnit unit, String className)
    {
-      assertCheckLoaded(className, true);      
+      assertCheckLoaded(unit, className, true);      
    }
 
-   private void assertCheckLoaded(String className, boolean checkFlag)
+   private void assertCheckLoaded(DeploymentUnit unit, String className, boolean checkFlag)
    {
-      InterceptionClassLoader icl = deployer2.getClassLoader();
+      ClassLoader cl = unit.getClassLoader();
+      if (cl instanceof InterceptionClassLoader == false)
+         throw new IllegalArgumentException("Expecting intercepted classlaoder: " + cl);
+
+      InterceptionClassLoader icl = (InterceptionClassLoader)cl;
       Set<String> loaded = icl.getLoaded();
       assertNotNull(loaded);
       assertEquals(loaded.contains(className), checkFlag);




More information about the jboss-cvs-commits mailing list