[jboss-cvs] JBossAS SVN: r107655 - in projects/microcontainer/branches/Branch_2_0/aop-mc-int/src: test/java/org/jboss/test/microcontainer/beans and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 17 21:45:58 EDT 2010


Author: dstephan
Date: 2010-08-17 21:45:57 -0400 (Tue, 17 Aug 2010)
New Revision: 107655

Added:
   projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/LightweightAspectPOJO.java
   projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.java
   projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectTest.java
   projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.xml
Modified:
   projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/InterceptorEntry.java
Log:
JBPAPP-4077 Port fix from JBKERNEL-117 for next EAP 5 release : 

InterceptorEntry does not take AdviceType into account when creating the AdviceFactory



Modified: projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/InterceptorEntry.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/InterceptorEntry.java	2010-08-17 23:42:02 UTC (rev 107654)
+++ projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/main/java/org/jboss/aop/microcontainer/beans/InterceptorEntry.java	2010-08-18 01:45:57 UTC (rev 107655)
@@ -100,7 +100,7 @@
          throw new IllegalArgumentException("Null aspect");
       }
       interceptorFactory = (aspectMethod == null) ? 
-            new ScopedInterceptorFactory(aspect.getDefinition()) : new AdviceFactory(aspect.getDefinition(), aspectMethod);
+            new ScopedInterceptorFactory(aspect.getDefinition()) : new AdviceFactory(aspect.getDefinition(), aspectMethod, type);
             
       manager.addInterceptorFactory(name, interceptorFactory);
       if (binding != null)
@@ -126,6 +126,8 @@
       entry.binding = binding;
       entry.aspect = aspect;
       entry.aspectMethod = aspectMethod;
+      entry.forStack = forStack;
+      entry.type = type;
       return entry;
    }
 }

Added: projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/LightweightAspectPOJO.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/LightweightAspectPOJO.java	                        (rev 0)
+++ projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/LightweightAspectPOJO.java	2010-08-18 01:45:57 UTC (rev 107655)
@@ -0,0 +1,36 @@
+/*
+* 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.microcontainer.beans;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LightweightAspectPOJO
+{
+   public void method(boolean error)
+   {
+      if (error)
+         throw new RuntimeException();
+   }
+}

Added: projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.java	                        (rev 0)
+++ projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.java	2010-08-18 01:45:57 UTC (rev 107655)
@@ -0,0 +1,36 @@
+/*
+* 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.microcontainer.beans.woven.test;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LightweightAspectAopTestCase extends LightweightAspectTest
+{
+   public LightweightAspectAopTestCase(String name)
+   {
+      super(name);
+   }
+
+}

Added: projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectTest.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectTest.java	                        (rev 0)
+++ projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/java/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectTest.java	2010-08-18 01:45:57 UTC (rev 107655)
@@ -0,0 +1,65 @@
+/*
+* 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.microcontainer.beans.woven.test;
+
+import org.jboss.test.aop.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.beans.Interceptions;
+import org.jboss.test.microcontainer.beans.LightweightAspectPOJO;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LightweightAspectTest extends AOPMicrocontainerTest
+{
+   public LightweightAspectTest(String name)
+   {
+      super(name);
+   }
+
+   public void testLightweightAspect() throws Throwable
+   {
+      LightweightAspectPOJO pojo = new LightweightAspectPOJO();
+      
+      Interceptions.reset();
+      pojo.method(false);
+      assertEquals(3, Interceptions.interceptions().size());
+      assertEquals("BEFORE", Interceptions.interceptions().get(0));
+      assertEquals("AFTER", Interceptions.interceptions().get(1));
+      assertEquals("FINALLY", Interceptions.interceptions().get(2));
+      
+      Interceptions.reset();
+      try
+      {
+         pojo.method(true);
+      }
+      catch (Exception expected)
+      {
+      }
+      assertEquals(3, Interceptions.interceptions().size());
+      assertEquals("BEFORE", Interceptions.interceptions().get(0));
+      assertEquals("THROWING", Interceptions.interceptions().get(1));
+      assertEquals("FINALLY", Interceptions.interceptions().get(2));
+      
+   }
+}

Added: projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.xml	                        (rev 0)
+++ projects/microcontainer/branches/Branch_2_0/aop-mc-int/src/test/resources/org/jboss/test/microcontainer/beans/woven/test/LightweightAspectAopTestCase.xml	2010-08-18 01:45:57 UTC (rev 107655)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<aop xmlns="urn:jboss:aop-beans:1.0">
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+
+   <aspect class="org.jboss.test.microcontainer.beans.LightweightAspect"/>
+
+   <bind pointcut="execution(* org.jboss.test.microcontainer.beans.LightweightAspectPOJO->method(..))">
+      <before aspect="org.jboss.test.microcontainer.beans.LightweightAspect" name="before"/>
+      <after aspect="org.jboss.test.microcontainer.beans.LightweightAspect" name="after"/>
+      <throwing aspect="org.jboss.test.microcontainer.beans.LightweightAspect" name="throwing"/>
+      <finally aspect="org.jboss.test.microcontainer.beans.LightweightAspect" name="finaly"/>
+   </bind>
+</aop>



More information about the jboss-cvs-commits mailing list