[jboss-cvs] JBossAS SVN: r60478 - in projects/microcontainer/trunk/aop-mc-int/src: main/org/jboss/aop/microcontainer/beans/xml and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Feb 10 16:07:41 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-02-10 16:07:41 -0500 (Sat, 10 Feb 2007)
New Revision: 60478

Added:
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCaseNotAutomatic.xml
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/TestAspect.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCase.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.java
Modified:
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/AspectBeanMetaDataFactory.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java
   projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.java
Log:
Should be possible to specify aspect method in <aop:aspect> and <aop:lifecycle>

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/AspectBeanMetaDataFactory.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/AspectBeanMetaDataFactory.java	2007-02-10 20:53:38 UTC (rev 60477)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/AspectBeanMetaDataFactory.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -62,6 +62,8 @@
    /** The property of the aspect manager bean, if any, containing the aspect manager */
    private String managerProperty;
    
+   private String adviceMethod;
+   
    /**
     * Get the pointcut.
     * 
@@ -103,6 +105,16 @@
       this.managerProperty = aspectManagerProperty;
    }   
    
+   public String getAdviceMethod()
+   {
+      return adviceMethod;
+   }
+
+   public void setAdviceMethod(String adviceMethod)
+   {
+      this.adviceMethod = adviceMethod;
+   }
+
    public List<BeanMetaData> getBeans()
    {
       ArrayList<BeanMetaData> result = new ArrayList<BeanMetaData>();
@@ -124,6 +136,10 @@
       aspectBinding.addProperty(new AbstractPropertyMetaData("pointcut", pointcut));
       aspectBinding.addProperty(new AbstractPropertyMetaData("aspect", new AbstractDependencyValueMetaData(aspectName, "definition")));
       aspectBinding.addProperty(getAspectManagerPropertyMetaData("manager"));
+      if (adviceMethod != null)
+      {
+         aspectBinding.addProperty(new AbstractPropertyMetaData("method", adviceMethod));
+      }
       result.add(aspectBinding);
       
       if (hasInjectedBeans())

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java	2007-02-10 20:53:38 UTC (rev 60477)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/xml/AOPBeansSchemaInitializer.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -153,6 +153,10 @@
          {
             factory.setManagerProperty(attr);
          }
+         else if ("method".equals(localName))
+         {
+            factory.setAdviceMethod(attr);
+         }
       }
    }
 

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd	2007-02-10 20:53:38 UTC (rev 60477)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/schema/aop-beans_1_0.xsd	2007-02-10 21:07:41 UTC (rev 60478)
@@ -67,8 +67,12 @@
          </xsd:documentation>
       </xsd:annotation>
       <xsd:complexContent>
-         <xsd:extension base="aspectType">
+         <xsd:extension base="mc:beanfactoryType">
+            <xsd:attribute name="pointcut" type="xsd:string" use="optional"/>
+            <xsd:attribute name="manager-bean" type="xsd:string" use="optional"/>
+            <xsd:attribute name="manager-property" type="xsd:string" use="optional"/>
             <xsd:attribute name="classes" type="xsd:string" use="required"/>
+            <xsd:attribute name="method" type="xsd:string" use="optional"/>
          </xsd:extension>
       </xsd:complexContent>
    </xsd:complexType>

Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCaseNotAutomatic.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCaseNotAutomatic.xml	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCaseNotAutomatic.xml	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+
+   <aop:lifecycle-configure xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="JMXLifecycle"
+               class="org.jboss.test.microcontainer.support.TestAspect"
+               classes="@org.jboss.aop.microcontainer.aspects.jmx.JMX"
+               method="foo"
+               pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+      <property name="shouldInvoke">false</property>
+   </aop:lifecycle-configure>
+
+   <bean name="Bean" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="", exposedInterface=org.jboss.test.microcontainer.support.SimpleBean.class)</annotation>
+   </bean>
+</deployment>

Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.xml	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+   
+   <beanfactory name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.TestAspect"/>
+   
+   <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
+      <property name="advice"><inject bean="InterceptedAdvice"/></property>
+      <property name="manager"><inject bean="AspectManager"/></property>
+   </bean>
+   
+   <bean name="FooBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
+      <property name="pointcut">execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->someMethod(..))</property>
+      <property name="aspect"><inject bean="InterceptedAspect" property="definition"/></property>
+      <property name="manager"><inject bean="AspectManager"/></property>
+      <property name="method">foo</property>
+   </bean>
+            
+   <bean name="BarBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
+      <property name="pointcut">execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->someOtherMethod(..))</property>
+      <property name="aspect"><inject bean="InterceptedAspect" property="definition"/></property>
+      <property name="manager"><inject bean="AspectManager"/></property>
+      <property name="method">bar</property>
+   </bean>
+            
+   <bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl"/>
+   
+</deployment>

Added: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.xml	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="AspectManager" class="org.jboss.aop.AspectManager">
+      <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
+   </bean>
+   
+   <beanfactory name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.TestAspect"/>
+   
+   <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
+      <property name="advice"><inject bean="InterceptedAdvice"/></property>
+      <property name="manager"><inject bean="AspectManager"/></property>
+   </bean>
+
+   <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="FooAdvice"
+               class="org.jboss.test.microcontainer.support.TestAspect"
+               method="foo"
+               pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->someMethod(..))">
+   </aop:aspect>
+   <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="BarAdvice"
+               class="org.jboss.test.microcontainer.support.TestAspect"
+               method="bar"
+               pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->someOtherMethod(..))">
+   </aop:aspect>
+   
+   <bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl"/>
+   
+</deployment>

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/TestAspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/TestAspect.java	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/TestAspect.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,69 @@
+/*
+* 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.support;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestAspect
+{
+   public static boolean fooCalled;
+   public static boolean barCalled;
+   boolean shouldInvoke;
+   
+   public Object foo(Invocation inv) throws Throwable
+   {
+      System.out.println("--- foo");
+      fooCalled = true;
+      if (shouldInvoke)
+      {
+         return inv.invokeNext();
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   public Object bar(Invocation inv) throws Throwable
+   {
+      System.out.println("--- bar");
+      barCalled = true;
+      if (shouldInvoke)
+      {
+         return inv.invokeNext();
+      }
+      else
+      {
+         return null;
+      }
+   }
+   
+   public void setShouldInvoke(boolean shouldInvoke)
+   {
+      this.shouldInvoke = shouldInvoke;
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/LifecycleAspectTestCase.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,81 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.test;
+
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.support.TestAspect;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 43840 $
+ */
+public class LifecycleAspectTestCase extends AOPMicrocontainerTest
+{
+   public static Test suite()
+   {
+      return suite(LifecycleAspectTestCase.class);
+   }
+   
+   public LifecycleAspectTestCase(String name)
+   {
+      super(name);
+   }
+   
+   
+   public void testBean() throws Exception
+   {
+      assertFalse(TestAspect.barCalled);
+      assertFalse(TestAspect.fooCalled);
+      Object bean = null; 
+      try
+      {
+         bean = getBean("Bean");
+      }
+      catch (RuntimeException expected)
+      {
+      }
+      
+      if (bean != null)
+      {
+         fail("Should not be deployed yet");
+      }
+
+      deploy("LifecycleAspectTestCaseNotAutomatic.xml");
+      
+      bean = getBean("Bean");
+      assertNotNull(bean);
+      assertTrue(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+      TestAspect.fooCalled = false;
+      undeploy("LifecycleAspectTestCaseNotAutomatic.xml");
+      assertTrue(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+   }
+}

Modified: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.java	2007-02-10 20:53:38 UTC (rev 60477)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/MultipleLifecycleTestCase.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -30,6 +30,11 @@
 
 import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
 
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 43840 $
+ */
 public class MultipleLifecycleTestCase extends AOPMicrocontainerTest
 {
    public static Test suite()

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectTestCase.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,65 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.support.SimpleBeanImpl;
+import org.jboss.test.microcontainer.support.TestAspect;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 43840 $
+ */
+public class SimpleAspectTestCase extends AOPMicrocontainerTest
+{
+   public static Test suite()
+   {
+      return suite(SimpleAspectTestCase.class);
+   }
+   
+   public SimpleAspectTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testIntercepted()
+   {
+      SimpleBeanImpl bean = (SimpleBeanImpl) getBean("Intercepted");
+      assertFalse(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+
+      bean.someMethod();
+      assertTrue("TestAspect.foo not called", TestAspect.fooCalled);
+      assertFalse("TestAspect.bar was called", TestAspect.barCalled);
+      
+      TestAspect.fooCalled = false;
+      assertFalse(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+
+      bean.someOtherMethod();
+      assertFalse("TestAspect.foo was called", TestAspect.fooCalled);
+      assertTrue("TestAspect.bar was not called", TestAspect.barCalled);
+   }
+}

Added: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/test/SimpleAspectUseCaseXmlTestCase.java	2007-02-10 21:07:41 UTC (rev 60478)
@@ -0,0 +1,65 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.test;
+
+import junit.framework.Test;
+
+import org.jboss.aop.microcontainer.junit.AOPMicrocontainerTest;
+import org.jboss.test.microcontainer.support.SimpleBeanImpl;
+import org.jboss.test.microcontainer.support.TestAspect;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 43840 $
+ */
+public class SimpleAspectUseCaseXmlTestCase extends AOPMicrocontainerTest
+{
+   public static Test suite()
+   {
+      return suite(SimpleAspectUseCaseXmlTestCase.class);
+   }
+   
+   public SimpleAspectUseCaseXmlTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testIntercepted()
+   {
+      SimpleBeanImpl bean = (SimpleBeanImpl) getBean("Intercepted");
+      assertFalse(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+
+      bean.someMethod();
+      assertTrue("TestAspect.foo not called", TestAspect.fooCalled);
+      assertFalse("TestAspect.bar was called", TestAspect.barCalled);
+      
+      TestAspect.fooCalled = false;
+      assertFalse(TestAspect.fooCalled);
+      assertFalse(TestAspect.barCalled);
+
+      bean.someOtherMethod();
+      assertFalse("TestAspect.foo was called", TestAspect.fooCalled);
+      assertTrue("TestAspect.bar was not called", TestAspect.barCalled);
+   }
+}




More information about the jboss-cvs-commits mailing list