[jboss-cvs] JBossAS SVN: r57770 - in projects/aop/trunk/aop/src: resources/test resources/test/bridgemethod test/org/jboss/test/aop/bridgemethod
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Oct 22 12:49:39 EDT 2006
Author: stalep
Date: 2006-10-22 12:49:26 -0400 (Sun, 22 Oct 2006)
New Revision: 57770
Added:
projects/aop/trunk/aop/src/resources/test/bridgemethod/
projects/aop/trunk/aop/src/resources/test/bridgemethod/jboss-aop.xml
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodWeavingTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SimpleMethodInterceptor.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJO2.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJO2.java
Removed:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java
Log:
[JBAOP-255]
Added weavingtest
Added: projects/aop/trunk/aop/src/resources/test/bridgemethod/jboss-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/bridgemethod/jboss-aop.xml 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/resources/test/bridgemethod/jboss-aop.xml 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+ <bind pointcut="execution(* org.jboss.test.aop.bridgemethod.POJO->getFoo())">
+ <interceptor class="org.jboss.test.aop.bridgemethod.SimpleMethodInterceptor"/>
+ </bind>
+ <bind pointcut="execution(* org.jboss.test.aop.bridgemethod.SubPOJO->setFoo(..))">
+ <interceptor class="org.jboss.test.aop.bridgemethod.SimpleMethodInterceptor"/>
+ </bind>
+ <bind pointcut="execution(* org.jboss.test.aop.bridgemethod.SubPOJO2->setFoo(..))">
+ <interceptor class="org.jboss.test.aop.bridgemethod.SimpleMethodInterceptor"/>
+ </bind>
+</aop>
\ No newline at end of file
Copied: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodTestCase.java (from rev 57766, projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java)
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java 2006-10-22 11:53:15 UTC (rev 57766)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodTestCase.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,108 @@
+/*
+ * 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.bridgemethod;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.aop.proxy.ClassProxyFactory;
+import org.jboss.test.aop.AOPTestWithSetup;
+
+/**
+ * Test that we handle bridgemethods created by the java15 compiler correctly
+ * regarding reflection.
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class BridgeMethodTestCase extends AOPTestWithSetup
+{
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("BridgeMethodTestCase");
+ suite.addTestSuite(BridgeMethodTestCase.class);
+ return suite;
+ }
+
+ public BridgeMethodTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ public void testMethod()
+ {
+ try {
+ ClassProxyFactory.newInstance(POJO.class);
+ assertTrue("ClassProxy failed to instrument class", true);
+ }
+ catch(Exception e)
+ {
+ System.out.println("ERROR: "+e.getMessage());
+ e.printStackTrace();
+ assertTrue("ClassProxy failed to instrument class", false);
+
+ }
+
+ }
+
+ public void testGenericMethod()
+ {
+ try {
+ SuperPOJO superPojo = (SuperPOJO) ClassProxyFactory.newInstance(SubPOJO.class);
+ assertTrue("ClassProxy failed to instrument generic class", true);
+ }
+ catch(Exception e)
+ {
+ System.out.println("ERROR: "+e.getMessage());
+ e.printStackTrace();
+ assertTrue("ClassProxy failed to instrument generic class", false);
+
+ }
+ }
+
+ public void testMethodOverride()
+ {
+ try {
+ ClassProxyFactory.newInstance(SubPOJO2.class);
+ assertTrue("ClassProxy failed to instrument overrided class", true);
+ }
+ catch(Exception e)
+ {
+ System.out.println("ERROR: "+e.getMessage());
+ e.printStackTrace();
+ assertTrue("ClassProxy failed to instrument overrided class", false);
+ }
+ }
+
+}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodWeavingTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodWeavingTestCase.java 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/BridgeMethodWeavingTestCase.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,94 @@
+/*
+ * 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.bridgemethod;
+
+import java.util.ArrayList;
+
+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 BridgeMethodWeavingTestCase extends AOPTestWithSetup
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("BridgeMethodWeavingTestCase");
+ suite.addTestSuite(BridgeMethodWeavingTestCase.class);
+ return suite;
+ }
+
+ public BridgeMethodWeavingTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+ public void testMethod()
+ {
+ POJO p = new POJO("bar");
+ p.getFoo();
+ assertTrue(SimpleMethodInterceptor.method);
+
+ }
+
+ public void testGenericMethod()
+ {
+ SimpleMethodInterceptor.method = false;
+ SubPOJO spojo = new SubPOJO();
+ spojo.setFoo(new ArrayList());
+ assertTrue(SimpleMethodInterceptor.method);
+ }
+
+ public void testMethodOverride()
+ {
+ SimpleMethodInterceptor.method = false;
+ SubPOJO2 spojo2 = new SubPOJO2();
+ spojo2.setFoo("bar");
+ assertTrue(SimpleMethodInterceptor.method);
+ }
+
+ public void testMethodOverrideNotWeaved()
+ {
+ SimpleMethodInterceptor.method = false;
+ SubPOJO2 spojo2 = new SubPOJO2();
+ spojo2.setFoo(new POJO());
+ assertFalse(SimpleMethodInterceptor.method);
+ }
+
+
+}
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/MethodOverrideTestCase.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -1,107 +0,0 @@
-/*
- * 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.bridgemethod;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import org.jboss.aop.proxy.ClassProxyFactory;
-import org.jboss.test.aop.AOPTestWithSetup;
-
-/**
- *
- * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
- * @version $Revision
- */
-public class MethodOverrideTestCase extends AOPTestWithSetup
-{
-
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("MethodOverrideTestCase");
- suite.addTestSuite(MethodOverrideTestCase.class);
- return suite;
- }
-
- public MethodOverrideTestCase(String name)
- {
- super(name);
- }
-
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- public void testMethod()
- {
- try {
- ClassProxyFactory.newInstance(POJO.class);
- assertTrue("ClassProxy failed to instrument class", true);
- }
- catch(Exception e)
- {
- System.out.println("ERROR: "+e.getMessage());
- e.printStackTrace();
- assertTrue("ClassProxy failed to instrument class", false);
-
- }
-
- }
-
- public void testGenericMethod()
- {
- try {
- SuperPOJO superPojo = (SuperPOJO) ClassProxyFactory.newInstance(SubPOJO.class);
- assertTrue("ClassProxy failed to instrument generic class", true);
- }
- catch(Exception e)
- {
- System.out.println("ERROR: "+e.getMessage());
- e.printStackTrace();
- assertTrue("ClassProxy failed to instrument generic class", false);
-
- }
- }
-
- public void testMethodOverride()
- {
- try {
- ClassProxyFactory.newInstance(SubPOJOJDK2.class);
- assertTrue("ClassProxy failed to instrument overrided class", true);
- }
- catch(Exception e)
- {
- System.out.println("ERROR: "+e.getMessage());
- e.printStackTrace();
- assertTrue("ClassProxy failed to instrument overrided class", false);
-
- }
- }
-
-}
\ No newline at end of file
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SimpleMethodInterceptor.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SimpleMethodInterceptor.java 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SimpleMethodInterceptor.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,51 @@
+/*
+ * 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.bridgemethod;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class SimpleMethodInterceptor implements Interceptor
+{
+ public static boolean method;
+
+ public String getName()
+ {
+ return "SimpleMethodInterceptor";
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ if (invocation instanceof MethodInvocation)
+ {
+ method = true;
+ }
+ return invocation.invokeNext();
+ }
+
+}
Copied: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJO2.java (from rev 57766, projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java)
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java 2006-10-22 11:53:15 UTC (rev 57766)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJO2.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,44 @@
+/*
+ * 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.bridgemethod;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class SubPOJO2 extends SuperPOJO2
+{
+
+ private String bar;
+
+ public void setFoo(String s)
+ {
+ bar = s;
+ }
+
+ public String getFoo()
+ {
+ return bar;
+ }
+
+}
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SubPOJOJDK2.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -1,44 +0,0 @@
-/*
- * 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.bridgemethod;
-
-/**
- *
- * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
- * @version $Revision
- */
-public class SubPOJOJDK2 extends SuperPOJOJDK2
-{
-
- private String bar;
-
- public void setFoo(String s)
- {
- bar = s;
- }
-
- public String getFoo()
- {
- return bar;
- }
-
-}
Copied: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJO2.java (from rev 57766, projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java)
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java 2006-10-22 11:53:15 UTC (rev 57766)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJO2.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -0,0 +1,42 @@
+/*
+ * 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.bridgemethod;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class SuperPOJO2
+{
+ private Object foo;
+
+ public void setFoo(Object arg)
+ {
+ foo = arg;
+ }
+
+ public Object getFoo()
+ {
+ return foo;
+ }
+}
Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java 2006-10-22 14:08:27 UTC (rev 57769)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/bridgemethod/SuperPOJOJDK2.java 2006-10-22 16:49:26 UTC (rev 57770)
@@ -1,42 +0,0 @@
-/*
- * 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.bridgemethod;
-
-/**
- *
- * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
- * @version $Revision
- */
-public class SuperPOJOJDK2
-{
- private Object foo;
-
- public void setFoo(Object arg)
- {
- foo = arg;
- }
-
- public Object getFoo()
- {
- return foo;
- }
-}
More information about the jboss-cvs-commits
mailing list