[jboss-cvs] JBossAS SVN: r79100 - in trunk: testsuite/src/main/org/jboss/test/aop/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 3 11:31:15 EDT 2008


Author: kabir.khan at jboss.com
Date: 2008-10-03 11:31:14 -0400 (Fri, 03 Oct 2008)
New Revision: 79100

Modified:
   trunk/aspects/src/main/org/jboss/aspects/library/JBossAspectLibrary.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/AOPTestSetup.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/SecurityUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/TxLockUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/TxUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/VersionedObjectUnitTestCase.java
Log:
[JBAS-5974] Turn off deployment of base-aspects.xml by default

Modified: trunk/aspects/src/main/org/jboss/aspects/library/JBossAspectLibrary.java
===================================================================
--- trunk/aspects/src/main/org/jboss/aspects/library/JBossAspectLibrary.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/aspects/src/main/org/jboss/aspects/library/JBossAspectLibrary.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -21,8 +21,6 @@
 */ 
 package org.jboss.aspects.library;
 
-import java.net.URL;
-
 import org.jboss.aop.deployers.AbstractAspectManager;
 import org.jboss.logging.Logger;
 
@@ -66,4 +64,21 @@
          SecurityActions.setThreadContextClassLoader(tcl);
       }
    }
+   
+   public void stop()
+   {
+      //Use the loader of this class so that we can find base-aspects.xml in the resources
+      //using the new loaders
+      ClassLoader tcl = SecurityActions.getThreadContextClassLoader();
+      try
+      {
+         ClassLoader mycl = SecurityActions.getClassLoader(this.getClass());
+         SecurityActions.setThreadContextClassLoader(mycl);
+         aspectManager.undeployBaseAspects();
+      }
+      finally
+      {
+         SecurityActions.setThreadContextClassLoader(tcl);
+      }
+   }
 }

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/AOPClassLoaderHookTestSetup.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -41,6 +41,7 @@
 
    private String[] jars;
    SetupHook hook;
+   boolean useBaseXml;
    
    // Create an initializer for the test suite
    public AOPClassLoaderHookTestSetup(TestSuite suite) throws Exception
@@ -60,12 +61,25 @@
       this.hook = hook;
    }
    
+   /**
+    * Sets whether to use base-aspects.xml for this test
+    */
+   public void setUseBaseXml(boolean useIt)
+   {
+      this.useBaseXml = useIt;
+   }
+   
    protected void setUp() throws Exception
    {
       super.setUp();
       ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
       Attribute enableTransformer = new Attribute("EnableLoadtimeWeaving", Boolean.TRUE);
       getServer().setAttribute(aspectManager, enableTransformer);
+      if (useBaseXml)
+      {
+         Attribute useBaseXmlAttribute = new Attribute("UseBaseXml", useBaseXml);
+         getServer().setAttribute(new ObjectName("jboss.aop:service=AspectManager"), useBaseXmlAttribute);
+      }
       if (hook != null)
       {
          hook.setup(getServer());
@@ -121,6 +135,11 @@
       ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
       Attribute enableTransformer = new Attribute("EnableLoadtimeWeaving", Boolean.FALSE);
       getServer().setAttribute(aspectManager, enableTransformer);
+      if (useBaseXml)
+      {
+         Attribute useBaseXmlAttribute = new Attribute("UseBaseXml", false);
+         getServer().setAttribute(new ObjectName("jboss.aop:service=AspectManager"), useBaseXmlAttribute);
+      }
       if (hook != null)
       {
          hook.teardown(getServer());

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/AOPTestSetup.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/AOPTestSetup.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/AOPTestSetup.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -38,6 +38,8 @@
    public static String ASPECT_MANAGER_NAME = "jboss.aop:service=AspectManager";
 
    private String jar;
+   
+   private boolean useBaseXml;
 
    // Create an initializer for the test suite
    public AOPTestSetup(TestSuite suite, String jar) throws Exception
@@ -46,15 +48,34 @@
       this.jar = jar;
    }
 
+   public AOPTestSetup(TestSuite suite) throws Exception
+   {
+      super(suite);
+   }
+
+   /**
+    * Sets whether to use base-aspects.xml for this test
+    */
+   public void setUseBaseXml(boolean useIt)
+   {
+      this.useBaseXml = useIt;
+   }
+
    protected void setUp() throws Exception
    {
       super.setUp();
       ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
       Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.TRUE);
       getServer().setAttribute(aspectManager, enableTransformer);
+      if (useBaseXml)
+      {
+         Attribute useBaseXmlAttribute = new Attribute("UseBaseXml", useBaseXml);
+         getServer().setAttribute(new ObjectName("jboss.aop:service=AspectManager"), useBaseXmlAttribute);
+      }
       try
       {
-         redeploy(jar);
+         if (jar != null)
+            redeploy(jar);
       }
       catch(Exception e)
       {
@@ -76,7 +97,8 @@
       Exception undeployException = null;
       try
       {
-         undeploy(jar);
+         if (jar != null)
+            undeploy(jar);
       }
       catch(Exception e)
       {
@@ -85,6 +107,11 @@
       ObjectName aspectManager = new ObjectName(ASPECT_MANAGER_NAME);
       Attribute enableTransformer = new Attribute("EnableTransformer", Boolean.FALSE);
       getServer().setAttribute(aspectManager, enableTransformer);
+      if (useBaseXml)
+      {
+         Attribute useBaseXmlAttribute = new Attribute("UseBaseXml", false);
+         getServer().setAttribute(new ObjectName("jboss.aop:service=AspectManager"), useBaseXmlAttribute);
+      }
       if( undeployException != null )
          throw undeployException;
       super.tearDown();

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedAttachUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -144,6 +144,8 @@
       suite.addTest(new TestSuite(ScopedAttachUnitTestCase.class));
 
       setup = new AOPClassLoaderHookTestSetup(suite, "aop-scopedattachtest1.sar,aop-scopedattachtest2.sar");
+      //Since this test relies on some of the aspects from base-aspects.xml, deploy those for this test
+      setup.setUseBaseXml(true);
       return setup;
    }
 }
\ No newline at end of file

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/ScopedUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -23,7 +23,7 @@
 
 import java.net.URL;
 
-import javax.management.Attribute;
+import javax.management.Attribute; 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 
@@ -199,6 +199,9 @@
       suite.addTest(new TestSuite(ScopedUnitTestCase.class));
 
       setup = new AOPClassLoaderHookTestSetup(suite, new MySetupHook(), "aop-scopedtest1.sar,aop-scopedtest2.sar,aop-scopedear1.ear,aop-scopedear2.ear");
+      //Since this test relies on some of the aspects from base-aspects.xml, deploy those for this test
+      setup.setUseBaseXml(true);
+
       return setup;
    }
 

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/SecurityUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/SecurityUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/SecurityUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -65,7 +65,7 @@
       Object[] params = {};
       String[] sig = {};
       server.invoke(testerName, "testAnnotated", params, sig);
-   }
+   } 
 
    public static Test suite() throws Exception
    {
@@ -73,6 +73,7 @@
       suite.addTest(new TestSuite(SecurityUnitTestCase.class));
 
       AOPTestSetup setup = new AOPTestSetup(suite, "aoptest.sar");
+      setup.setUseBaseXml(true);
       return setup; 
    }
 

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/TxLockUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/TxLockUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/TxLockUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -73,7 +73,8 @@
       suite.addTest(new TestSuite(TxLockUnitTestCase.class));
 
       AOPTestSetup setup = new AOPTestSetup(suite, "aoptest.sar");
+      //Since this test relies on some of the aspects from base-aspects.xml, deploy those for this test
+      setup.setUseBaseXml(true);
       return setup; 
    }
-
 }

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/TxUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/TxUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/TxUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -73,6 +73,8 @@
       suite.addTest(new TestSuite(TxUnitTestCase.class));
 
       AOPTestSetup setup = new AOPTestSetup(suite, "aoptest.sar");
+      //Since this test relies on some of the aspects from base-aspects.xml, deploy those for this test
+      setup.setUseBaseXml(true);
       return setup; 
    }
 

Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/VersionedObjectUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/VersionedObjectUnitTestCase.java	2008-10-03 15:28:56 UTC (rev 79099)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/VersionedObjectUnitTestCase.java	2008-10-03 15:31:14 UTC (rev 79100)
@@ -64,6 +64,7 @@
       suite.addTest(new TestSuite(VersionedObjectUnitTestCase.class));
 
       AOPTestSetup setup = new AOPTestSetup(suite, "aoptest.sar");
+      setup.setUseBaseXml(true);
       return setup; 
    }
 




More information about the jboss-cvs-commits mailing list