[jboss-cvs] JBossAS SVN: r59317 - projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 3 14:36:50 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-01-03 14:36:47 -0500 (Wed, 03 Jan 2007)
New Revision: 59317

Modified:
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayReferenceTestCase.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/TestArrayElementInterceptor.java
Log:
Test that woven array access does not interfere with branches/jumps

Modified: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java	2007-01-03 18:48:43 UTC (rev 59316)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java	2007-01-03 19:36:47 UTC (rev 59317)
@@ -974,6 +974,51 @@
       checkNoReadWrite();
    }
 
+   public void testBranchesStillValidFollowingInstrumentation()
+   {
+      ClassWithArrayFields obj = new ClassWithArrayFields();
+      StringBuffer sb = new StringBuffer();
+      
+      for (int i = 0 ; i < 3 ; i++)
+      {
+         int[] ints = new int[] {0, 1, 2};
+         
+         if (i >= 1)
+         {
+            sb.append("g");
+            obj.ints = ints;
+            
+            clearInterceptors();
+            int val = ints[i];
+            assertEquals(i, val);
+            assertEquals(i, TestArrayElementInterceptor.index);
+            assertNull(TestArrayElementInterceptor.value);
+            
+            clearInterceptors();
+            obj.ints[i] = i + 2;
+            assertEquals(i, TestArrayElementInterceptor.index);
+            assertEquals(i + 2, ((Integer)TestArrayElementInterceptor.value).intValue());
+         }
+         else
+         {
+            sb.append("s");
+            obj.ints = ints;
+
+            clearInterceptors();
+            obj.ints[i] = i + 2;
+            assertEquals(i, TestArrayElementInterceptor.index);
+            assertEquals(i + 2, ((Integer)TestArrayElementInterceptor.value).intValue());
+
+            clearInterceptors();
+            int val = ints[i];
+            assertEquals(i + 2, ints[i]);
+            assertEquals(i, TestArrayElementInterceptor.index);
+            assertNull(TestArrayElementInterceptor.value);
+         }
+      }
+      assertEquals("sgg", sb.toString());
+   }
+   
    void clearInterceptors()
    {
       TestArrayElementInterceptor.clear();

Modified: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayReferenceTestCase.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayReferenceTestCase.java	2007-01-03 18:48:43 UTC (rev 59316)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayReferenceTestCase.java	2007-01-03 19:36:47 UTC (rev 59317)
@@ -486,5 +486,8 @@
       assertEquals(new Integer(2), reference.getNestedArrayIndices().get(0));
       assertEquals(new Integer(1), reference.getNestedArrayIndices().get(1));
       assertEquals(new Integer(2), reference.getNestedArrayIndices().get(2));
+
+      //TODO For an ObjectArrayElementInvocation, where the value is an array belonging to a registered array,
+      //should the references be updated at the end of the invocation, or in the weaving as is done at present?
    }
 }

Modified: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/TestArrayElementInterceptor.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/TestArrayElementInterceptor.java	2007-01-03 18:48:43 UTC (rev 59316)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/TestArrayElementInterceptor.java	2007-01-03 19:36:47 UTC (rev 59317)
@@ -35,7 +35,6 @@
 import org.jboss.aop.array.CharArrayElementWriteInvocation;
 import org.jboss.aop.array.DoubleArrayElementWriteInvocation;
 import org.jboss.aop.array.FloatArrayElementWriteInvocation;
-import org.jboss.aop.array.IntArrayElementReadInvocation;
 import org.jboss.aop.array.IntArrayElementWriteInvocation;
 import org.jboss.aop.array.LongArrayElementWriteInvocation;
 import org.jboss.aop.array.ObjectArrayElementWriteInvocation;




More information about the jboss-cvs-commits mailing list