[Jboss-cvs] JBossAS SVN: r56791 - in trunk/aop: . src/resources/test/jdk15 src/resources/test/jdk15/annotated src/resources/test/jdk15/annotated/field src/test/org/jboss/test/aop/jdk15/annotated src/test/org/jboss/test/aop/jdk15/annotated/field

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 13 06:15:58 EDT 2006


Author: stalep
Date: 2006-09-13 06:15:54 -0400 (Wed, 13 Sep 2006)
New Revision: 56791

Added:
   trunk/aop/src/resources/test/jdk15/annotated/
   trunk/aop/src/resources/test/jdk15/annotated/field/
   trunk/aop/src/resources/test/jdk15/annotated/field/jboss-aop.xml
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/AnnotatedFieldTestCase.java
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/POJO.java
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/SubPOJO.java
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/Trace.java
   trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/TraceInterceptor.java
Modified:
   trunk/aop/build.xml
Log:
JBAOP-284
a simple test that comfirms the problem


Modified: trunk/aop/build.xml
===================================================================
--- trunk/aop/build.xml	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/build.xml	2006-09-13 10:15:54 UTC (rev 56791)
@@ -1322,6 +1322,18 @@
          <formatter usefile="true" type="xml" extension="-jdk15-loadtime-tests.xml"/>
          <test todir="${report.dir}" name="org.jboss.test.aop.jdk15.annotated.declare.AnnotatedDeclareTestCase" />
       </junit>
+      <junit printsummary="yes" fork="yes" haltonfailure="no">
+         <sysproperty key="jboss.aop.class.path" value="${build.tests.classes}"/>
+         <jvmarg value="-javaagent:${build.lib}/jboss-aop-jdk50.jar"/>
+         <classpath>
+            <path refid="test15.classpath"/>
+            <pathelement location="${build.tests.classes}"/>
+            <pathelement location="docs"/>
+         </classpath>
+         <formatter usefile="true" type="plain" extension="-jdk15-loadtime-tests.txt"/>
+         <formatter usefile="true" type="xml" extension="-jdk15-loadtime-tests.xml"/>
+         <test todir="${report.dir}" name="org.jboss.test.aop.jdk15.annotated.field.AnnotatedFieldTestCase" />
+      </junit>
 
       <junit printsummary="yes" fork="yes" haltonfailure="no">
          <sysproperty key="jboss.aop.path" value="${source.res}/test/jdk15/dynamic/prepareAll/jboss-aop.xml"/>
@@ -1421,8 +1433,71 @@
          <formatter usefile="true" type="xml" extension="-jdk15-loadtime-tests.xml"/>
          <test todir="${report.dir}" name="org.jboss.test.aop.jdk15.dynamic.prepareFieldSet.HotSwapDisabledTester" />
       </junit>
+      <junit printsummary="yes" fork="yes" haltonfailure="no">
+         <sysproperty key="jboss.aop.class.path" value="${build.tests.classes}"/>
+         <sysproperty key="jboss.aop.path" value="${source.res}/test/jdk15/annotated/field/jboss-aop.xml"/>
+         <sysproperty key="jboss.aop.debug.classes" value="false"/>
+         <sysproperty key="jboss.aop.verbose" value="true"/>
+         <!--
+         <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
+         -->
+         <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.ClassicInstrumentor"/>
+         <jvmarg value="-javaagent:${build.lib}/jboss-aop-jdk50.jar"/>
+         <classpath>
+            <path refid="test15.classpath"/>
+            <pathelement location="${build.tests.classes}"/>
+            <pathelement location="docs"/>
+         </classpath>
+         <formatter usefile="true" type="plain" extension="-jdk15-loadtime-tests.txt"/>
+         <formatter usefile="true" type="xml" extension="-jdk15-loadtime-tests.xml"/>
+         <test todir="${report.dir}" name="org.jboss.test.aop.jdk15.annotated.field.AnnotatedFieldTestCase" />
+      </junit>
    </target>
 
+<!--
+   <target name="annotatedfield" depends="jdk15-precompiled-tests">
+   -->
+   <target name="annotatedfield" depends="compile-jdk15-tests">
+
+      <taskdef name="aopc" classname="org.jboss.aop.ant.AopC" classpathref="jboss.aop.classpath"/>
+      <path id="aop.task.classpath">
+         <path refid="test15.classpath"/>
+         <pathelement location="${build.tests.classes}"/>
+         <pathelement location="docs"/>
+      </path>
+
+      <aopc compilerclasspathref="aop.task.classpath">
+         <sysproperty key="jboss.aop.debug.classes" value="true"/>
+         <classpath refid="aop.task.classpath"/>
+         <classpath path="${build.tests.classes}"/>
+         <src path="${build.tests.classes}"/>
+         <include name="org/jboss/test/aop/jdk15/annotated/field/*"/>
+         <aoppath path="${source.res}/test/jdk15/annotated/field/jboss-aop.xml"/>
+         <aopclasspath path="${build.tests.classes}"/>
+      </aopc>
+      <property name="report.dir" value="${build.reports}"/>
+      <mkdir dir="${report.dir}"/>
+      <junit printsummary="yes" fork="yes" haltonfailure="no">
+         <sysproperty key="jboss.aop.class.path" value="${build.tests.classes}"/>
+         <sysproperty key="jboss.aop.path" value="${source.res}/test/jdk15/annotated/field/jboss-aop.xml"/>
+         <sysproperty key="jboss.aop.debug.classes" value="false"/>
+         <sysproperty key="jboss.aop.verbose" value="true"/>
+         <!--
+         <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.GeneratedAdvisorInstrumentor"/>
+         -->
+         <sysproperty key="jboss.aop.instrumentor" value="org.jboss.aop.instrument.ClassicInstrumentor"/>
+         <jvmarg value="-javaagent:${build.lib}/jboss-aop-jdk50.jar"/>
+         <classpath>
+            <path refid="test15.classpath"/>
+            <pathelement location="${build.tests.classes}"/>
+            <pathelement location="docs"/>
+         </classpath>
+         <formatter usefile="true" type="plain" extension="-jdk15-loadtime-tests.txt"/>
+         <formatter usefile="true" type="xml" extension="-jdk15-loadtime-tests.xml"/>
+         <test todir="${report.dir}" name="org.jboss.test.aop.jdk15.annotated.field.AnnotatedFieldTestCase" />
+      </junit>
+   </target>
+
    <target name="jdk15-precompiled-tests" depends="compile-jdk15-tests">
 
       <property name="report.dir" value="${build.reports}"/>

Added: trunk/aop/src/resources/test/jdk15/annotated/field/jboss-aop.xml
===================================================================
--- trunk/aop/src/resources/test/jdk15/annotated/field/jboss-aop.xml	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/resources/test/jdk15/annotated/field/jboss-aop.xml	2006-09-13 10:15:54 UTC (rev 56791)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<aop>
+
+   <bind pointcut="all(@org.jboss.test.aop.jdk15.annotated.field.Trace)">                
+       <interceptor class="org.jboss.test.aop.jdk15.annotated.field.TraceInterceptor"/>
+   </bind>
+
+</aop>
\ No newline at end of file

Added: trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/AnnotatedFieldTestCase.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/AnnotatedFieldTestCase.java	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/AnnotatedFieldTestCase.java	2006-09-13 10:15:54 UTC (rev 56791)
@@ -0,0 +1,67 @@
+/*
+  * 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.jdk15.annotated.field;
+
+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 AnnotatedFieldTestCase extends AOPTestWithSetup
+{
+   
+   public static void main(String[] args)
+   {
+      TestRunner.run(suite());
+   }
+
+   public static Test suite()
+   {
+      TestSuite suite = new TestSuite("AnnotatedFieldTestCase");
+      suite.addTestSuite(AnnotatedFieldTestCase.class);
+      return suite;
+   }
+
+   public AnnotatedFieldTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+   }
+   
+   public void testAnnotatedField()
+   {
+      System.out.println("*** testAnnotatedField");
+      SubPOJO spojo = new SubPOJO(4);
+      assertEquals("Field is not set correctly", spojo.getPOJOField(), (spojo.getSubPOJOField()/2));  
+   }
+
+}

Added: trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/POJO.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/POJO.java	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/POJO.java	2006-09-13 10:15:54 UTC (rev 56791)
@@ -0,0 +1,45 @@
+/*
+  * 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.jdk15.annotated.field;
+
+/**
+*
+* @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+* @version $Revision
+*/
+public class POJO
+{
+   @Trace int field;
+   
+   public POJO() {}
+   
+   public POJO(int i)
+   {
+      field = i;
+   }
+   
+   public int getPOJOField()
+   {
+      return field;
+   }
+ 
+}

Added: trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/SubPOJO.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/SubPOJO.java	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/SubPOJO.java	2006-09-13 10:15:54 UTC (rev 56791)
@@ -0,0 +1,46 @@
+/*
+  * 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.jdk15.annotated.field;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class SubPOJO extends POJO
+{
+   private int field;
+   public SubPOJO() { }
+   
+   public SubPOJO(int i)
+   {
+      super(i/2);
+      field = i;
+   }
+
+   public int getSubPOJOField()
+   {
+      return field;
+   }
+   
+
+}

Added: trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/Trace.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/Trace.java	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/Trace.java	2006-09-13 10:15:54 UTC (rev 56791)
@@ -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.jdk15.annotated.field;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public @interface Trace
+{
+
+}

Added: trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/TraceInterceptor.java
===================================================================
--- trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/TraceInterceptor.java	2006-09-13 04:14:16 UTC (rev 56790)
+++ trunk/aop/src/test/org/jboss/test/aop/jdk15/annotated/field/TraceInterceptor.java	2006-09-13 10:15:54 UTC (rev 56791)
@@ -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.jdk15.annotated.field;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.FieldReadInvocation;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="mailto:stalep at conduct.no">Stale W. Pedersen</a>
+ * @version $Revision
+ */
+public class TraceInterceptor implements Interceptor
+{
+
+   public String getName()
+   {
+      return "TraceInterceptor";
+   }
+
+   public Object invoke(Invocation invocation) throws Throwable
+   {
+      String msg = null;
+      if (invocation instanceof FieldReadInvocation)
+      {
+         msg = "read field name: " + ((FieldReadInvocation)invocation).getField();
+      }
+
+      try
+      {
+         System.out.println("<<< Trace : " + msg);
+         return invocation.invokeNext();
+      }
+      finally
+      {
+         System.out.println(">>> Leaving Trace");
+      }
+   }
+
+}




More information about the jboss-cvs-commits mailing list