[jboss-cvs] JBossAS SVN: r59249 - in branches/Branch_AOP_1_5/aop/src: resources/test/regression test/org/jboss/test/aop/regression test/org/jboss/test/aop/regression/jbaop336callnpe

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Dec 30 14:37:23 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-12-30 14:37:19 -0500 (Sat, 30 Dec 2006)
New Revision: 59249

Added:
   branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/
   branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/CallerNPETestCase.java
   branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/Log.java
   branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/LogInterceptor.java
   branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/POJO.java
Modified:
   branches/Branch_AOP_1_5/aop/src/resources/test/regression/jboss-aop.xml
Log:
[JBAOP-336] Add test demonstrating the behaviour

Modified: branches/Branch_AOP_1_5/aop/src/resources/test/regression/jboss-aop.xml
===================================================================
--- branches/Branch_AOP_1_5/aop/src/resources/test/regression/jboss-aop.xml	2006-12-30 08:27:14 UTC (rev 59248)
+++ branches/Branch_AOP_1_5/aop/src/resources/test/regression/jboss-aop.xml	2006-12-30 19:37:19 UTC (rev 59249)
@@ -127,4 +127,9 @@
    </bind>
    
    <prepare expr="all(org.jboss.test.aop.regression.jbaop316annotationsinwrapperonly.POJO)"/>
+
+   <interceptor class="org.jboss.test.aop.regression.jbaop336callnpe.LogInterceptor" scope="PER_INSTANCE"/>
+   <bind pointcut="call(org.jboss.test.aop.regression.jbaop336callnpe.Log->new(java.lang.String))">
+   	<interceptor-ref name="org.jboss.test.aop.regression.jbaop336callnpe.LogInterceptor"/>
+  	</bind>
 </aop>

Added: branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/CallerNPETestCase.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/CallerNPETestCase.java	2006-12-30 08:27:14 UTC (rev 59248)
+++ branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/CallerNPETestCase.java	2006-12-30 19:37:19 UTC (rev 59249)
@@ -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.regression.jbaop336callnpe;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+
+/**
+ * http://jira.jboss.com/jira/browse/JBAOP-316
+ * 
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 45977 $
+ */
+public class CallerNPETestCase extends junit.framework.TestCase 
+{
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("CallerNPETestCase");
+      suite.addTestSuite(CallerNPETestCase.class);
+      return suite;
+   }
+
+   public CallerNPETestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testCallerInterceptor()throws Exception
+   {
+      POJO pojo = new POJO("XYZ");
+      assertEquals("XYZ", LogInterceptor.logFile);
+   }
+
+}

Added: branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/Log.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/Log.java	2006-12-30 08:27:14 UTC (rev 59248)
+++ branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/Log.java	2006-12-30 19:37:19 UTC (rev 59249)
@@ -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.regression.jbaop336callnpe;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Log
+{
+   String logFile;
+   
+   public Log(String logFile)
+   {
+      this.logFile = logFile;
+   }
+}

Added: branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/LogInterceptor.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/LogInterceptor.java	2006-12-30 08:27:14 UTC (rev 59248)
+++ branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/LogInterceptor.java	2006-12-30 19:37:19 UTC (rev 59249)
@@ -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.regression.jbaop336callnpe;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.ConstructorCalledByConstructorInvocation;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class LogInterceptor implements Interceptor
+{
+   public static String logFile;
+
+   public String getName()
+   {
+      return this.getClass().getName();
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      logFile = (String)((ConstructorCalledByConstructorInvocation)invocation).getArguments()[0];
+      return invocation.invokeNext();
+   }
+
+}

Added: branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/POJO.java
===================================================================
--- branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/POJO.java	2006-12-30 08:27:14 UTC (rev 59248)
+++ branches/Branch_AOP_1_5/aop/src/test/org/jboss/test/aop/regression/jbaop336callnpe/POJO.java	2006-12-30 19:37:19 UTC (rev 59249)
@@ -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.regression.jbaop336callnpe;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJO
+{
+   private Log log;
+   
+   public POJO(String logFile)
+   {
+      log = new Log(logFile);
+   }
+}




More information about the jboss-cvs-commits mailing list