[jboss-cvs] JBossAS SVN: r57915 - in branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop: . extender test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 30 08:01:23 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-10-30 08:01:19 -0500 (Mon, 30 Oct 2006)
New Revision: 57915

Added:
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Base.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildBase.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildExtender.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Extender.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderInterceptor.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTester.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTesterMBean.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/InfantBase.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubBase.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubExtender.java
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ExtenderTestCase.java
Log:
Add extender test case

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Base.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Base.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Base.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,41 @@
+/*
+* 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.extender;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 45208 $
+ */
+public abstract class Base {
+   private int base;
+
+   public int getBase()
+   {
+      return base;
+   }
+   
+   public void setBase(int val)
+   {
+      base = val;
+   }
+ }
\ No newline at end of file

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildBase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildBase.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildBase.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -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.extender;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class ChildBase extends SubBase
+{
+   public void updateBase()
+   {
+      setBase(-1);
+   }
+   
+   public int getAddBase()
+   {
+      return getBase()+1;
+   }
+   
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildExtender.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildExtender.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ChildExtender.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,36 @@
+/*
+* 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.extender;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class ChildExtender extends SubExtender
+{
+	public void updateExtender()
+	{
+		setExtender(1);
+	}
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Extender.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Extender.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/Extender.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -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.extender;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 45208 $
+ */
+public class Extender extends Base
+{
+   int extender;
+
+   public int getExtender()
+   {
+      return extender;
+   }
+
+   public void setExtender(int other)
+   {
+      this.extender = other;
+   }  
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderInterceptor.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderInterceptor.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderInterceptor.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,60 @@
+/*
+* 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.extender;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.FieldInvocation;
+import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class ExtenderInterceptor implements Interceptor
+{
+   public static boolean method;
+   public static boolean field;
+   
+   public String getName()
+   {
+      return "ExtenderInterceptor";
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      System.out.println("---------------------- ExtenderInterceptor ---------------------");
+   
+      if (invocation instanceof MethodInvocation)
+      {
+         method = true;
+      }
+      else if (invocation instanceof FieldInvocation)
+      {
+         field = true;
+      }
+      
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTester.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTester.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTester.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,66 @@
+/*
+ * 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.extender;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision: 
+ */
+public class ExtenderTester implements ExtenderTesterMBean
+{
+   
+   public void testMethod() throws Exception
+   {
+      
+      System.out.println("--------------------------- TESTING EXTENDER ------------------");
+      System.out.println("MY CLASSLOADER " + getClass().getClassLoader());
+      System.out.println("EXTENDER INTERCEPTOR CLASSLOADER " + ExtenderInterceptor.class.getClassLoader());
+      
+      
+      ChildBase childB = new ChildBase();
+      childB.updateBase();
+      if(!ExtenderInterceptor.method)
+         throw new RuntimeException("Expected ExtenderInterceptor.method to be true, it was: "+ExtenderInterceptor.method);
+      
+      ExtenderInterceptor.method = false;      
+      Base base = new SubBase();
+      base.setBase(1);
+      if(!ExtenderInterceptor.method)
+         throw new RuntimeException("Expected ExtenderInterceptor.method to be true, it was: "+ExtenderInterceptor.method);
+      
+      ExtenderInterceptor.method = false;
+      ChildExtender ext = new ChildExtender();
+      ext.updateExtender();
+      if(!ExtenderInterceptor.method)
+         throw new RuntimeException("Expected ExtenderInterceptor.method to be true, it was: "+ExtenderInterceptor.method);
+      
+      ExtenderInterceptor.method = false;
+      InfantBase infant = new InfantBase();
+      infant.infantize(3);
+      if(!ExtenderInterceptor.method)
+         throw new RuntimeException("Expected ExtenderInterceptor.method to be true, it was: "+ExtenderInterceptor.method);
+      
+      
+   }
+   
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTesterMBean.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTesterMBean.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/ExtenderTesterMBean.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,33 @@
+/*
+* 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.extender;
+
+/**
+* 
+* @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+* @version $Revision:
+*/
+public interface ExtenderTesterMBean {
+	
+	void testMethod() throws Exception;
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/InfantBase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/InfantBase.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/InfantBase.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,37 @@
+/*
+* 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.extender;
+
+/**
+ *
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class InfantBase extends ChildBase
+{
+   
+   public void infantize(int i)
+   {
+      setBase(i-1);
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubBase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubBase.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubBase.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,36 @@
+/*
+* 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.extender;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class SubBase extends Base {
+   
+   public SubBase()
+   {
+      
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubExtender.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubExtender.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/extender/SubExtender.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,36 @@
+/*
+* 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.extender;
+
+/**
+ * 
+ * @author <a href="stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision:
+ */
+public class SubExtender extends Extender
+{
+   public void fooExtender()
+   {
+      
+   }
+
+}

Added: branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ExtenderTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ExtenderTestCase.java	2006-10-30 11:50:31 UTC (rev 57914)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/aop/test/ExtenderTestCase.java	2006-10-30 13:01:19 UTC (rev 57915)
@@ -0,0 +1,58 @@
+/*
+* 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.test;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+
+public class ExtenderTestCase extends JBossTestCase
+{
+
+   public ExtenderTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testMethod() throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      ObjectName testerName = new ObjectName("jboss.aop:name=ExtenderTester");
+      Object[] params = {};
+      String[] sig = {};
+      server.invoke(testerName, "testMethod", params, sig);
+   }
+   
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new TestSuite(ExtenderTestCase.class));
+
+      AOPTestSetup setup = new AOPTestSetup(suite, "aop-extendertest.sar");
+      return setup;
+   }
+
+}




More information about the jboss-cvs-commits mailing list