[jboss-cvs] JBossAS SVN: r57775 - in projects/aop/trunk/aop: . src/resources/test src/resources/test/methodoverloading src/test/org/jboss/test/aop src/test/org/jboss/test/aop/methodoverloading

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 23 11:31:46 EDT 2006


Author: stalep
Date: 2006-10-23 11:31:42 -0400 (Mon, 23 Oct 2006)
New Revision: 57775

Added:
   projects/aop/trunk/aop/src/resources/test/methodoverloading/
   projects/aop/trunk/aop/src/resources/test/methodoverloading/jboss-aop.xml
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/CallerAspect.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/Driver.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/DriverInterface.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/MethodOverloadingTestCase.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperDriver.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperInterface.java
Modified:
   projects/aop/trunk/aop/base-tests.xml
Log:
[JBAOP-243]
Added initial test to verify the problem

Modified: projects/aop/trunk/aop/base-tests.xml
===================================================================
--- projects/aop/trunk/aop/base-tests.xml	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/base-tests.xml	2006-10-23 15:31:42 UTC (rev 57775)
@@ -70,6 +70,9 @@
       <antcall target="${test-target}" inheritRefs="true">
          <param name="test" value="field"/>
       </antcall>
+      <antcall target="${test-target}" inheritRefs="true">
+         <param name="test" value="methodoverloading"/>
+      </antcall>
 
       <!-- Tests with special requirements for parameters -->
       <antcall target="${test-target}" inheritRefs="true">

Added: projects/aop/trunk/aop/src/resources/test/methodoverloading/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/methodoverloading/jboss-aop.xml	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/resources/test/methodoverloading/jboss-aop.xml	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+  
+   <aspect class="org.jboss.test.aop.methodoverloading.CallerAspect" scope="PER_VM"/>
+  
+   <bind pointcut="call(* $instanceof{org.jboss.test.aop.methodoverloading.DriverInterface}->superMethod())">
+       <advice name="methodAdviceSuper" aspect="org.jboss.test.aop.methodoverloading.CallerAspect"/>
+   </bind>
+
+   <bind pointcut="call(* $instanceof{org.jboss.test.aop.methodoverloading.DriverInterface}->driverMethod())">
+       <advice name="methodAdviceDriver" aspect="org.jboss.test.aop.methodoverloading.CallerAspect"/>
+   </bind>
+ 
+</aop>
\ No newline at end of file

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/CallerAspect.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/CallerAspect.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/CallerAspect.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,48 @@
+/*
+  * 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.aop.methodoverloading;
+
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class CallerAspect
+{
+
+   public Object methodAdviceSuper(MethodInvocation invocation) throws Throwable
+   {
+      System.out.println("Matched Super");
+      Driver.superMethodIntercepted = true;
+      return invocation.invokeNext();
+   }
+
+   public Object methodAdviceDriver(MethodInvocation invocation) throws Throwable
+   {
+      System.out.println("Matched Driver");
+      Driver.driverMethodIntercepted = true;
+      return invocation.invokeNext();
+   }
+
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/Driver.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/Driver.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/Driver.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,52 @@
+/*
+  * 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.aop.methodoverloading;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class Driver extends SuperDriver implements DriverInterface
+{
+   public static boolean superMethodIntercepted = false;
+   public static boolean driverMethodIntercepted = false;
+   
+   public void driverMethod() {
+      System.out.println("--- in driverMethod(); ---");
+   }
+   
+   public static void main(String[] args)
+   {
+      Driver d = new Driver();
+      d.superMethod();
+      d.driverMethod();
+      
+      if (Driver.superMethodIntercepted && Driver.driverMethodIntercepted)
+         System.out.println("Passed!");
+      if (!Driver.superMethodIntercepted)
+         System.out.println("FAILED: superMethod wasn't intercepted");
+      if (!Driver.driverMethodIntercepted)
+         System.out.println("FAILED: driverMethod wasn't intercepted");
+   }
+
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/DriverInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/DriverInterface.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/DriverInterface.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,32 @@
+/*
+  * 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.aop.methodoverloading;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public interface DriverInterface
+{
+   public void driverMethod();
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/MethodOverloadingTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/MethodOverloadingTestCase.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/MethodOverloadingTestCase.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,77 @@
+/*
+  * 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.aop.methodoverloading;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.aop.AOPTestWithSetup;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class MethodOverloadingTestCase extends AOPTestWithSetup
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("MethodOverloadingTestCase");
+      suite.addTestSuite(MethodOverloadingTestCase.class);
+      return suite;
+   }
+
+   public MethodOverloadingTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+   }
+   
+   public void testMethodOverloading()
+   {
+      Driver d = new Driver();
+      d.superMethod();
+      d.driverMethod();
+      
+      if (Driver.superMethodIntercepted && Driver.driverMethodIntercepted)
+         System.out.println("Passed!");
+      if (!Driver.superMethodIntercepted)
+         System.out.println("FAILED: superMethod wasn't intercepted");
+      if (!Driver.driverMethodIntercepted)
+         System.out.println("FAILED: driverMethod wasn't intercepted");
+      
+      assertTrue(false);
+
+   }
+   
+
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperDriver.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperDriver.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperDriver.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,35 @@
+/*
+  * 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.aop.methodoverloading;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class SuperDriver implements SuperInterface
+{
+   public void superMethod() 
+   {
+      System.out.println("--- in superMethod(); ---");
+   }
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperInterface.java	2006-10-23 11:00:58 UTC (rev 57774)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodoverloading/SuperInterface.java	2006-10-23 15:31:42 UTC (rev 57775)
@@ -0,0 +1,32 @@
+/*
+  * 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.aop.methodoverloading;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public interface SuperInterface
+{
+   public void superMethod();
+}




More information about the jboss-cvs-commits mailing list