[jboss-cvs] JBossAS SVN: r87297 - projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 14 12:49:48 EDT 2009


Author: kabir.khan at jboss.com
Date: 2009-04-14 12:49:48 -0400 (Tue, 14 Apr 2009)
New Revision: 87297

Added:
   projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java
Removed:
   projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase.java
Log:
[JBAOP-707] Rename class


Copied: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java (from rev 87296, projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase.java)
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java	                        (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTest.java	2009-04-14 16:49:48 UTC (rev 87297)
@@ -0,0 +1,245 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.classpool.jbosscl.weaving.test;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import javassist.ClassPool;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.test.aop.classpool.jbosscl.support.BundleInfoBuilder;
+import org.jboss.test.aop.classpool.jbosscl.test.JBossClClassPoolTest;
+import org.jboss.test.aop.classpool.jbosscl.weaving.support.TestTranslator;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class WeavingTestCase extends JBossClClassPoolTest
+{
+   public final static String DOMAIN = "AOPClasses";
+   
+   public final static URL JAR_TARGET = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-target.jar");
+   public final static URL JAR_ASPECTS = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-aspects.jar");
+   public final static URL JAR_INTERCEPTIONS = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-interceptions.jar");
+
+
+   public static final String PACKAGE_TARGET = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.target";
+   public static final String PACKAGE_ASPECTS = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.aspects";
+   public static final String PACKAGE_INTERCEPTIONS = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.interceptions";
+
+   public final static String CLASS_FOUND_INVOKER = PACKAGE_TARGET + ".FoundInvoker";
+   public final static String CLASS_NOT_FOUND_INVOKER = PACKAGE_TARGET + ".NotFoundInvoker";
+   
+   public final static String AOP_XML = "org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase-aop.xml"; 
+
+   
+   public WeavingTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testImportAllAspects() throws Exception
+   {
+      runTest(
+            CLASS_FOUND_INVOKER, 
+            new ClassLoaderSetup()
+            {
+      
+               public ClassPool setupTargetPool() throws Exception
+               {
+                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, true, JAR_TARGET);
+               }
+            
+               public ClassPool setupAspectsPool() throws Exception
+               {
+                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, true, JAR_ASPECTS);
+               }
+
+               public ClassPool setupInterceptionsPool() throws Exception
+               {
+                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, true, JAR_INTERCEPTIONS);
+               }
+            });
+   }
+   
+   public void testNotImportAllAspectsNotIncluded() throws Exception
+   {
+      runTest(
+            CLASS_NOT_FOUND_INVOKER,
+            new ClassLoaderSetup()
+            {
+            
+               public ClassPool setupTargetPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().createModule("Target").createRequireModule("INTERCEPTIONS");
+                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
+               }
+            
+               public ClassPool setupAspectsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().createModule("Aspects").createRequireModule("INTERCEPTIONS");
+                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
+               }
+
+               public ClassPool setupInterceptionsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("INTERCEPTIONS").
+                     createPackage(PACKAGE_INTERCEPTIONS);
+                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
+               }
+            });
+   }
+   
+   public void testNotImportAllAspectsIncludedByPackage() throws Exception
+   {
+      runTest(
+            CLASS_FOUND_INVOKER, 
+            new ClassLoaderSetup()
+            {
+               public ClassPool setupTargetPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("TARGET").
+                     createRequirePackage(PACKAGE_ASPECTS).
+                     createRequirePackage(PACKAGE_INTERCEPTIONS);
+                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
+               }
+            
+               public ClassPool setupAspectsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("ASPECTS").
+                     createPackage(PACKAGE_ASPECTS).
+                     createRequirePackage(PACKAGE_INTERCEPTIONS);
+                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
+               }
+
+
+               public ClassPool setupInterceptionsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createPackage(PACKAGE_INTERCEPTIONS).
+                     createModule("INTERCEPTIONS").
+                     createPackage(PACKAGE_INTERCEPTIONS);
+                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
+               }
+            });
+   }
+   
+   public void testNotImportAllAspectsIncludedByModule() throws Exception
+   {
+      runTest(
+            CLASS_FOUND_INVOKER, 
+            new ClassLoaderSetup()
+            {
+               public ClassPool setupTargetPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("TARGET").
+                     createRequireModule("ASPECTS").
+                     createRequireModule("INTERCEPTIONS");
+                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
+               }
+            
+               public ClassPool setupAspectsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("ASPECTS").
+                     createPackage(PACKAGE_ASPECTS).
+                     createRequireModule("INTERCEPTIONS");
+                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
+               }
+
+
+               public ClassPool setupInterceptionsPool() throws Exception
+               {
+                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
+                     createModule("INTERCEPTIONS").
+                     createPackage(PACKAGE_INTERCEPTIONS);
+                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
+               }
+            });
+   }
+   
+   private void deployAopXml(ClassLoader cl) throws Exception
+   {
+      URL aopUrl = this.getClass().getClassLoader().getResource(AOP_XML);
+      AspectXmlLoader.deployXML(aopUrl, cl, AspectManager.instance());
+   }
+   
+   private void undeployAopXml() throws Exception
+   {
+      URL aopUrl = this.getClass().getClassLoader().getResource(AOP_XML);
+      AspectXmlLoader.undeployXML(aopUrl, AspectManager.instance());
+   }
+   
+   public void runTest(String invokerName, ClassLoaderSetup setup) throws Exception
+   {
+      getSystem().setTranslator(new TestTranslator());
+      ClassPool interceptionsPool = null;
+      ClassPool targetPool = null;
+      ClassPool aspectsPool = null;
+      try
+      {
+         interceptionsPool = setup.setupInterceptionsPool();
+         aspectsPool = setup.setupAspectsPool();
+         targetPool = setup.setupTargetPool();
+         
+         System.out.println("Target loader: " + targetPool.getClassLoader() + "; Aspect loader: " + aspectsPool.getClassLoader());
+
+         ClassLoader old = Thread.currentThread().getContextClassLoader();
+         deployAopXml(aspectsPool.getClassLoader());
+         try
+         {
+            Thread.currentThread().setContextClassLoader(targetPool.getClassLoader());
+            Class<?> invoker = targetPool.getClassLoader().loadClass(invokerName);
+            Method m = invoker.getMethod("invoke");
+            m.invoke(null);
+         }
+         finally
+         {
+            Thread.currentThread().setContextClassLoader(old);
+            undeployAopXml();
+         }
+      }
+      finally
+      {
+         getSystem().setTranslator(null);
+         unregisterClassPool(targetPool);
+         unregisterClassPool(aspectsPool);
+         unregisterClassPool(interceptionsPool);
+         unregisterDomain(targetPool);
+      }
+   }
+   
+   private interface ClassLoaderSetup
+   {
+      ClassPool setupInterceptionsPool() throws Exception;
+      ClassPool setupTargetPool() throws Exception;
+      ClassPool setupAspectsPool() throws Exception;
+   }
+}

Deleted: projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase.java	2009-04-14 16:32:01 UTC (rev 87296)
+++ projects/aop/trunk/asintegration-mc/src/test/java/org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase.java	2009-04-14 16:49:48 UTC (rev 87297)
@@ -1,245 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.test.aop.classpool.jbosscl.weaving.test;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-
-import javassist.ClassPool;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.AspectXmlLoader;
-import org.jboss.test.aop.classpool.jbosscl.support.BundleInfoBuilder;
-import org.jboss.test.aop.classpool.jbosscl.test.JBossClClassPoolTest;
-import org.jboss.test.aop.classpool.jbosscl.weaving.support.TestTranslator;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class WeavingTestCase extends JBossClClassPoolTest
-{
-   public final static String DOMAIN = "AOPClasses";
-   
-   public final static URL JAR_TARGET = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-target.jar");
-   public final static URL JAR_ASPECTS = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-aspects.jar");
-   public final static URL JAR_INTERCEPTIONS = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-weaving-interceptions.jar");
-
-
-   public static final String PACKAGE_TARGET = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.target";
-   public static final String PACKAGE_ASPECTS = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.aspects";
-   public static final String PACKAGE_INTERCEPTIONS = "org.jboss.test.aop.classpool.jbosscl.weaving.support.excluded.interceptions";
-
-   public final static String CLASS_FOUND_INVOKER = PACKAGE_TARGET + ".FoundInvoker";
-   public final static String CLASS_NOT_FOUND_INVOKER = PACKAGE_TARGET + ".NotFoundInvoker";
-   
-   public final static String AOP_XML = "org/jboss/test/aop/classpool/jbosscl/weaving/test/WeavingTestCase-aop.xml"; 
-
-   
-   public WeavingTestCase(String name)
-   {
-      super(name);
-   }
-   
-   public void testImportAllAspects() throws Exception
-   {
-      runTest(
-            CLASS_FOUND_INVOKER, 
-            new ClassLoaderSetup()
-            {
-      
-               public ClassPool setupTargetPool() throws Exception
-               {
-                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, true, JAR_TARGET);
-               }
-            
-               public ClassPool setupAspectsPool() throws Exception
-               {
-                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, true, JAR_ASPECTS);
-               }
-
-               public ClassPool setupInterceptionsPool() throws Exception
-               {
-                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, true, JAR_INTERCEPTIONS);
-               }
-            });
-   }
-   
-   public void testNotImportAllAspectsNotIncluded() throws Exception
-   {
-      runTest(
-            CLASS_NOT_FOUND_INVOKER,
-            new ClassLoaderSetup()
-            {
-            
-               public ClassPool setupTargetPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().createModule("Target").createRequireModule("INTERCEPTIONS");
-                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
-               }
-            
-               public ClassPool setupAspectsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().createModule("Aspects").createRequireModule("INTERCEPTIONS");
-                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
-               }
-
-               public ClassPool setupInterceptionsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("INTERCEPTIONS").
-                     createPackage(PACKAGE_INTERCEPTIONS);
-                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
-               }
-            });
-   }
-   
-   public void testNotImportAllAspectsIncludedByPackage() throws Exception
-   {
-      runTest(
-            CLASS_FOUND_INVOKER, 
-            new ClassLoaderSetup()
-            {
-               public ClassPool setupTargetPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("TARGET").
-                     createRequirePackage(PACKAGE_ASPECTS).
-                     createRequirePackage(PACKAGE_INTERCEPTIONS);
-                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
-               }
-            
-               public ClassPool setupAspectsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("ASPECTS").
-                     createPackage(PACKAGE_ASPECTS).
-                     createRequirePackage(PACKAGE_INTERCEPTIONS);
-                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
-               }
-
-
-               public ClassPool setupInterceptionsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createPackage(PACKAGE_INTERCEPTIONS).
-                     createModule("INTERCEPTIONS").
-                     createPackage(PACKAGE_INTERCEPTIONS);
-                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
-               }
-            });
-   }
-   
-   public void testNotImportAllAspectsIncludedByModule() throws Exception
-   {
-      runTest(
-            CLASS_FOUND_INVOKER, 
-            new ClassLoaderSetup()
-            {
-               public ClassPool setupTargetPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("TARGET").
-                     createRequireModule("ASPECTS").
-                     createRequireModule("INTERCEPTIONS");
-                  return createChildDomainParentLastClassPool("TARGET", DOMAIN, builder, JAR_TARGET);
-               }
-            
-               public ClassPool setupAspectsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("ASPECTS").
-                     createPackage(PACKAGE_ASPECTS).
-                     createRequireModule("INTERCEPTIONS");
-                  return createChildDomainParentLastClassPool("ASPECTS", DOMAIN, builder, JAR_ASPECTS);
-               }
-
-
-               public ClassPool setupInterceptionsPool() throws Exception
-               {
-                  BundleInfoBuilder builder = BundleInfoBuilder.getBuilder().
-                     createModule("INTERCEPTIONS").
-                     createPackage(PACKAGE_INTERCEPTIONS);
-                  return createChildDomainParentLastClassPool("INTERCEPTIONS", DOMAIN, builder, JAR_INTERCEPTIONS);
-               }
-            });
-   }
-   
-   private void deployAopXml(ClassLoader cl) throws Exception
-   {
-      URL aopUrl = this.getClass().getClassLoader().getResource(AOP_XML);
-      AspectXmlLoader.deployXML(aopUrl, cl, AspectManager.instance());
-   }
-   
-   private void undeployAopXml() throws Exception
-   {
-      URL aopUrl = this.getClass().getClassLoader().getResource(AOP_XML);
-      AspectXmlLoader.undeployXML(aopUrl, AspectManager.instance());
-   }
-   
-   public void runTest(String invokerName, ClassLoaderSetup setup) throws Exception
-   {
-      getSystem().setTranslator(new TestTranslator());
-      ClassPool interceptionsPool = null;
-      ClassPool targetPool = null;
-      ClassPool aspectsPool = null;
-      try
-      {
-         interceptionsPool = setup.setupInterceptionsPool();
-         aspectsPool = setup.setupAspectsPool();
-         targetPool = setup.setupTargetPool();
-         
-         System.out.println("Target loader: " + targetPool.getClassLoader() + "; Aspect loader: " + aspectsPool.getClassLoader());
-
-         ClassLoader old = Thread.currentThread().getContextClassLoader();
-         deployAopXml(aspectsPool.getClassLoader());
-         try
-         {
-            Thread.currentThread().setContextClassLoader(targetPool.getClassLoader());
-            Class<?> invoker = targetPool.getClassLoader().loadClass(invokerName);
-            Method m = invoker.getMethod("invoke");
-            m.invoke(null);
-         }
-         finally
-         {
-            Thread.currentThread().setContextClassLoader(old);
-            undeployAopXml();
-         }
-      }
-      finally
-      {
-         getSystem().setTranslator(null);
-         unregisterClassPool(targetPool);
-         unregisterClassPool(aspectsPool);
-         unregisterClassPool(interceptionsPool);
-         unregisterDomain(targetPool);
-      }
-   }
-   
-   private interface ClassLoaderSetup
-   {
-      ClassPool setupInterceptionsPool() throws Exception;
-      ClassPool setupTargetPool() throws Exception;
-      ClassPool setupAspectsPool() throws Exception;
-   }
-}




More information about the jboss-cvs-commits mailing list