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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Dec 24 05:56:26 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-12-24 05:56:21 -0500 (Sun, 24 Dec 2006)
New Revision: 59221

Removed:
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPTransformer.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Agent.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayTestCase.bak
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithArrayFieldCaller.bak
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFieldCaller.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFields.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/META-INF/
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Main.bak
Modified:
   projects/aop/branches/arrays/aop/src/main/org/jboss/aop/array/ArrayAdvisor.java
   projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java
Log:
Tidy up a bit

Modified: projects/aop/branches/arrays/aop/src/main/org/jboss/aop/array/ArrayAdvisor.java
===================================================================
--- projects/aop/branches/arrays/aop/src/main/org/jboss/aop/array/ArrayAdvisor.java	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/main/org/jboss/aop/array/ArrayAdvisor.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -49,31 +49,6 @@
       registry.removeFieldReference(target, fieldName, oldValue);
       registry.addFieldReference(target, fieldName, newValue);
    }
-   
-   //Write operations
-//   public static void arrayWrite(boolean[] array, int index, boolean value)
-//   {
-//      array[index] = value; 
-//   }
-//
-//   public static void arrayWrite(short[] array, int index, short value)
-//   {
-//      array[index] = value; 
-//   }
-//
-   public static void arrayWriteInt(Object array, int index, int value) throws Throwable
-   {
-      if (ArrayRegistry.getInstance().isRegistered(array))
-      {
-         System.out.println("---------> Writing" + array + " advised");
-         IntArrayElementWriteInvocation invocation = new IntArrayElementWriteInvocation(interceptors, ((int[])array), index, value);
-         invocation.invokeNext();
-      }
-      else
-      {
-         ((int[])array)[index] = value;
-      }
-   }
 
    public static void arrayWriteObject(Object array, int index, Object value) throws Throwable
    {
@@ -99,6 +74,31 @@
       }
    }
    
+   public static void arrayWriteInt(Object array, int index, int value) throws Throwable
+   {
+      if (ArrayRegistry.getInstance().isRegistered(array))
+      {
+         System.out.println("---------> Writing" + array + " advised");
+         IntArrayElementWriteInvocation invocation = new IntArrayElementWriteInvocation(interceptors, ((int[])array), index, value);
+         invocation.invokeNext();
+      }
+      else
+      {
+         ((int[])array)[index] = value;
+      }
+   }
+
+   //Write operations
+//   public static void arrayWrite(boolean[] array, int index, boolean value)
+//   {
+//      array[index] = value; 
+//   }
+//
+//   public static void arrayWrite(short[] array, int index, short value)
+//   {
+//      array[index] = value; 
+//   }
+//
 //   
 //   public static void arrayWrite(long[] array, int index, long value)
 //   {
@@ -139,29 +139,29 @@
 //      return value;
 //   }
 //
-   public static int arrayReadInt(Object array, int index) throws Throwable
+   public static Object arrayReadObject(Object array, int index) throws Throwable
    {
       if (ArrayRegistry.getInstance().isRegistered(array))
       {
-         IntArrayElementReadInvocation invocation = new IntArrayElementReadInvocation(interceptors, (int[])array, index);
-         return ((Integer)invocation.invokeNext()).intValue();
+         ObjectArrayElementReadInvocation invocation = new ObjectArrayElementReadInvocation(interceptors, (Object[])array, index);
+         return invocation.invokeNext();
       }
       else
       {
-         return ((int[])array)[index];
+         return ((Object[])array)[index];
       }
    }
 
-   public static Object arrayReadObject(Object array, int index) throws Throwable
+   public static int arrayReadInt(Object array, int index) throws Throwable
    {
       if (ArrayRegistry.getInstance().isRegistered(array))
       {
-         ObjectArrayElementReadInvocation invocation = new ObjectArrayElementReadInvocation(interceptors, (Object[])array, index);
-         return invocation.invokeNext();
+         IntArrayElementReadInvocation invocation = new IntArrayElementReadInvocation(interceptors, (int[])array, index);
+         return ((Integer)invocation.invokeNext()).intValue();
       }
       else
       {
-         return ((Object[])array)[index];
+         return ((int[])array)[index];
       }
    }
 

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	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPArrayTestCase.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -68,14 +68,12 @@
    public void testMultiDimensionalTopLevelArray()
    {
       ClassWithArrayFields obj = new ClassWithArrayFields();
-      System.out.println("----------> Constructed");
       
       //Create replacement array for top level, this is not registered yet so should be unadvised
       TestArrayElementInterceptor.clear();
       int[][] replacement0 = new int[][] {new int[]{11,22}, new int[] {33,44}};
       assertEquals(-1, TestArrayElementInterceptor.index);
       assertNull(TestArrayElementInterceptor.value);
-      System.out.println("----------> Created");
 
       //Store reference to array to be replaced
       TestArrayElementInterceptor.clear();
@@ -88,7 +86,6 @@
       assertEquals(0, TestArrayElementInterceptor.index);
       assertNotNull(TestArrayElementInterceptor.value);
       assertEquals(replacement0, TestArrayElementInterceptor.value);
-      System.out.println("----------> Replaced");
       
       TestArrayElementInterceptor.clear();
       int i = obj.iiifield[0][0][1];

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPTransformer.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPTransformer.java	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/AOPTransformer.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,315 +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.array;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.classpool.AOPClassPool;
-
-import java.lang.instrument.ClassFileTransformer;
-import java.lang.instrument.IllegalClassFormatException;
-import java.security.ProtectionDomain;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import javassist.CodeConverter;
-import javassist.CtClass;
-import javassist.CtField;
-import javassist.CtMethod;
-import javassist.CtNewMethod;
-import javassist.Modifier;
-import javassist.convert.TransformAccessArrayField.DefaultMethodNames;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 44099 $
- */
-public class AOPTransformer implements ClassFileTransformer
-{
-   private static HashMap<String, HashSet<String>> simpleClassFields = new HashMap<String, HashSet<String>>(); 
-//   private static HashMap<String, HashSet<String>> arrayClassFields = new HashMap<String, HashSet<String>>();
-   private static HashSet<String> arrayClasses = new HashSet<String>();
-
-   public static void addArrayClass(String clazz)
-   {
-      arrayClasses.add(clazz);
-   }
-   
-   public static void addSimpleField(String clazz, String field)
-   {
-      addField(simpleClassFields, clazz, field);
-   }
-   
-//   public static void addArrayField(String clazz, String field)
-//   {
-//      addField(arrayClassFields, clazz, field);
-//   }
-   
-   private static void addField(HashMap<String, HashSet<String>> classFields, String clazz, String field)
-   {
-      HashSet<String> fields = classFields.get(clazz); 
-      if (fields == null)
-      {
-         fields = new HashSet<String>();
-         classFields.put(clazz, fields);
-      }
-      
-      fields.add(field);
-   }
-   
-   private static boolean isAdvisableField(HashMap<String, HashSet<String>> classFields, String clazz, String field)
-   {
-      HashSet<String> fields = classFields.get(clazz);
-      if (fields == null)
-      {
-         return false;
-      }
-      
-      return fields.contains(field);
-   }
-   
-   public static boolean isAdvisableSimpleField(CtField field)
-   {
-      return isAdvisableField(simpleClassFields, field.getDeclaringClass().getName(), field.getName());
-   }
-   
-//   public static boolean isAdvisableArrayField(CtField field)
-//   {
-//      return isAdvisableField(arrayClassFields, field.getDeclaringClass().getName(), field.getName());
-//   }
-   
-   public boolean isNonAdvisableClassName(String classname)
-   {
-      return (classname.startsWith("org.jboss.aop") ||
-      classname.endsWith("$aop") ||
-      classname.startsWith("javassist") ||
-      classname.startsWith("org.jboss.util.") ||
-      classname.startsWith("gnu.trove.") ||
-      classname.startsWith("EDU.oswego.cs.dl.util.concurrent.") ||
-      // System classes
-      classname.startsWith("org.apache.crimson") ||
-      classname.startsWith("org.apache.xalan") ||
-      classname.startsWith("org.apache.xml") ||
-      classname.startsWith("org.apache.xpath") ||
-      classname.startsWith("org.ietf.") ||
-      classname.startsWith("org.omg.") ||
-      classname.startsWith("org.w3c.") ||
-      classname.startsWith("org.xml.sax.") ||
-      classname.startsWith("sunw.") ||
-      classname.startsWith("sun.") ||
-      classname.startsWith("java.") ||
-      classname.startsWith("javax.") ||
-      classname.startsWith("com.sun.")
-      );
-   }
-
-   public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException
-   {
-      className = className.replace('/', '.');
-      System.out.println("<<< loading " + className + " " + loader);
-      try
-      {
-         if (classBeingRedefined != null || isNonAdvisableClassName(className))
-         {
-            //System.out.println(" ignoring");
-            return null;
-         }
-         //System.out.println(" transforming");
-         return aspectTransform(className, loader, classBeingRedefined, protectionDomain, classfileBuffer);
-      }
-      catch(Exception e)
-      {
-         return null;
-      }
-      finally
-      {
-         //System.out.println("finished " + className + ">>>");
-      }
-   }
-
-   private byte[] aspectTransform(String className, ClassLoader loader, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
-   {
-      try
-      {
-         //Make sure that we use the correct classloader, in order to get the correct domain if it is a scoped loader
-         AspectManager manager = AspectManager.instance();
-         AOPClassPool pool = (AOPClassPool) manager.registerClassLoader(loader);
-         
-         CtClass clazz = pool.getLocally(className);
-         
-         createFieldWrappers(pool, clazz);
-         convertReferences(pool, clazz);
-         clazz.debugWriteFile();
-         return clazz.toBytecode();
-         
-      }
-      catch (Exception e)
-      {
-         System.err.println("Error " + e.getMessage());
-         e.printStackTrace();
-         throw new RuntimeException(e);
-      }
-   }
-   
-   private void createFieldWrappers(AOPClassPool pool, CtClass clazz) throws Exception
-   {
-      CtClass objectClass = pool.get("java.lang.Object");
-      CtField[] fields = clazz.getFields();
-      for (int i = 0 ; i < fields.length ; i++)
-      {
-         if (isAdvisableSimpleField(fields[i]))
-         {
-            CtMethod write = CtNewMethod.make(
-                  Modifier.STATIC, 
-                  CtClass.voidType, 
-                  getWriteWrapperName(fields[i]), 
-                  new CtClass[] {objectClass, fields[i].getType()}, 
-                  new CtClass[0],
-                  !Modifier.isStatic(fields[i].getModifiers()) ?
-                        "{((" + clazz.getName() + ")$1)." + fields[i].getName() + "_written = true; ((" + clazz.getName() + ")$1)." + fields[i].getName() + "= $2;}" :
-                        "{" + clazz.getName() + "." + fields[i].getName() + "_written = true; " + clazz.getName() + "." + fields[i].getName() + "= $2;}",
-                  fields[i].getDeclaringClass());
-            fields[i].getDeclaringClass().addMethod(write);
-            
-            CtMethod read = CtNewMethod.make(
-                  Modifier.STATIC, 
-                  fields[i].getType(), 
-                  getReadWrapperName(fields[i]), 
-                  new CtClass[] {objectClass}, 
-                  new CtClass[0],
-                  !Modifier.isStatic(fields[i].getModifiers()) ?
-                        "{((" + clazz.getName() + ")$1)." + fields[i].getName() + "_read = true; return ((" + clazz.getName() + ")$1)." + fields[i].getName() + ";}" :
-                        "{" + clazz.getName() + "." + fields[i].getName() + "_read = true; return " + clazz.getName() + "." + fields[i].getName() + ";}",
-                  fields[i].getDeclaringClass());
-            fields[i].getDeclaringClass().addMethod(read);
-         }
-//         if (isAdvisableArrayField(fields[i]))
-//         {
-//            //Create read method
-//            CtClass componentType = fields[i].getType();
-//            while (componentType.isArray())
-//            {
-//               componentType = componentType.getComponentType();
-//            }
-//
-//            CtClass[] readParameters = new CtClass[3];
-//            readParameters[0] = objectClass;
-//            readParameters[1] = fields[i].getType();
-//            readParameters[2] = CtClass.intType;
-//            StringBuffer readBody = new StringBuffer("{((" + clazz.getName() + ")$1)." + fields[i].getName() + "_read_index=$3; return ((" + clazz.getName() + ")$1)." + fields[i].getName() + "[$3];}");
-//            
-//            System.out.println("READ BODY-----> " + readBody);
-//            
-//            CtMethod read = CtNewMethod.make(
-//                  Modifier.STATIC, 
-//                  componentType, 
-//                  getArrayReadWrapperName(fields[i]), 
-//                  readParameters, 
-//                  new CtClass[0],
-//                  readBody.toString(),
-//                  fields[i].getDeclaringClass());
-//            fields[i].getDeclaringClass().addMethod(read);
-//            
-//            //Create write method
-//            CtClass[] writeParameters = new CtClass[4];
-//            writeParameters[0] = objectClass;
-//            writeParameters[1] = fields[i].getType();
-//            writeParameters[2] = CtClass.intType;
-//            writeParameters[3] = componentType;
-//            StringBuffer writeBody = new StringBuffer("{((" + clazz.getName() + ")$1)." + fields[i].getName() + "_write_index=$3;((" + clazz.getName() + ")$1)." + fields[i].getName() + "_write_value=$4;((" + clazz.getName() + ")$1)." + fields[i].getName() + "[$3]=$4;}");
-//            
-//            System.out.println("WRITE BODY-----> " + writeBody);
-//            CtMethod write = CtNewMethod.make(
-//                  Modifier.STATIC, 
-//                  CtClass.voidType, 
-//                  getArrayWriteWrapperName(fields[i]), 
-//                  writeParameters, 
-//                  new CtClass[0],
-//                  writeBody.toString(),
-//                  fields[i].getDeclaringClass());
-//            fields[i].getDeclaringClass().addMethod(write);
-//         }
-      }
-   }
-   
-   private void convertReferences(AOPClassPool pool, CtClass clazz) throws Exception
-   {
-      boolean replaced = false;
-      Collection refClasses = clazz.getRefClasses();
-      for (Iterator it = refClasses.iterator() ; it.hasNext() ; )
-      {
-         String name = (String)it.next();
-         if (name.equals(clazz.getName()))
-         {
-            continue;
-         }
-         CtClass refClazz = pool.get(name);
-         
-         
-         CtField[] fields = refClazz.getFields();
-         CodeConverter converter = new CodeConverter();
-         for (int i = 0 ; i < fields.length ; i++)
-         {
-            if (isAdvisableSimpleField(fields[i]))
-            {
-               replaced = true;
-               converter.replaceFieldRead(fields[i], refClazz, getReadWrapperName(fields[i]));
-               converter.replaceFieldWrite(fields[i], refClazz, getWriteWrapperName(fields[i]));
-            }
-         }
-         
-         if (arrayClasses.contains(clazz.getName()))
-         {
-            replaced = true;
-            converter.replaceArrayAccess(pool.get(ArrayAdvisor.class.getName()), new DefaultMethodNames());
-         }
-
-         if (replaced)
-         {
-            clazz.instrument(converter);
-         }
-      }
-   }
-   
-   private String getWriteWrapperName(CtField field)
-   {
-      return "aop$_w_" + field.getName(); 
-   }
-   
-   private String getReadWrapperName(CtField field)
-   {
-      return "aop$_r_" + field.getName(); 
-   }
-
-//   private String getArrayWriteWrapperName(CtField field)
-//   {
-//      return "aop$_array_w_" + field.getName(); 
-//   }
-//   
-//   private String getArrayReadWrapperName(CtField field)
-//   {
-//      return "aop$_array_r_" + field.getName(); 
-//   }
-}

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Agent.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Agent.java	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Agent.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,46 +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.array;
-
-import org.jboss.aop.AspectManager;
-import org.jboss.aop.standalone.StandaloneClassPoolFactory;
-
-import java.lang.instrument.Instrumentation;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 46253 $
- */
-public class Agent
-{
-
-   public static void premain(String agentArgs, Instrumentation inst)
-   {
-      StandaloneClassPoolFactory factory = new StandaloneClassPoolFactory(); 
-      AspectManager.setClassPoolFactory(factory);
-      // necessary for configuration
-      AspectManager.instance();
-      inst.addTransformer(new AOPTransformer());
-   }
-}
\ No newline at end of file

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayTestCase.bak
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayTestCase.bak	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ArrayTestCase.bak	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,91 +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.array;
-
-import org.jboss.test.aop.AOPTestWithSetup;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-
-/**
- * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
- * @version $Revision: 45977 $
- */
-public class ArrayTestCase extends AOPTestWithSetup
-{
-   Main main = new Main();
-   public static void main(String[] args)
-   {
-      TestRunner.run(suite());
-   }
-
-   public static Test suite()
-   {
-      TestSuite suite = new TestSuite("ArrayTestCase");
-      suite.addTestSuite(ArrayTestCase.class);
-      return suite;
-   }
-
-   public ArrayTestCase(String name)
-   {
-      super(name);
-      AOPTransformer.addSimpleField("org.jboss.test.aop.array.ClassWithSimpleFields", "field");
-      AOPTransformer.addSimpleField("org.jboss.test.aop.array.ClassWithSimpleFields", "staticfield");
-
-      AOPTransformer.addArrayClass("org.jboss.test.aop.array.ClassWithArrayFields");
-      AOPTransformer.addArrayClass("org.jboss.test.aop.array.ClassWithArrayFieldCaller");
-   }
-
-   public void testSimpleField() throws Exception
-   {
-      main.testSimpleField();
-   }
-
-   
-   public void testArrayWrite() throws Exception
-   {
-      main.testArrayWrite();
-   }
-   
-   public void testArrayRead() throws Exception
-   {
-      main.testArrayRead();
-   }
-//   
-//   public void testArrayReadWriteSelf() throws Exception
-//   {
-//      main.testArrayReadWriteSelf();
-//   }
-//
-//   public void testArrayReadWriteFromNonAdvised() throws Exception
-//   {
-//      main.testArrayReadWriteFromNonAdvised();
-//   }
-//
-//   
-//   public void testArrayField() throws Exception
-//   {
-//      main.testArrayField();
-//   }
-}

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithArrayFieldCaller.bak
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithArrayFieldCaller.bak	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithArrayFieldCaller.bak	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,97 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.array;
-
-import java.lang.reflect.Array;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ClassWithArrayFieldCaller
-{
-   ClassWithArrayFields obj = new ClassWithArrayFields();
-   
-   public void testArrayWrite() throws Exception
-   {
-      ArrayAdvisor.clear();
-      obj.setValue(1, 100);
-      checkStatus(obj.ifield, 1, String.valueOf(100));
-      
-      ArrayAdvisor.clear();
-      obj.ifield[0] = 75;
-      checkStatus(obj.ifield, 0, String.valueOf(75));
-   }
-   
-   public void testArrayRead() throws Exception
-   {
-      obj.ifield[0] = 100;
-      obj.ifield[1] = 200;
-      
-      ArrayAdvisor.clear();
-      int val = obj.getValue(0);
-      if (val != 100) throw new RuntimeException("Wrong val " + 100);
-      checkStatus(obj.ifield, 0, String.valueOf(100));
-      
-      ArrayAdvisor.clear();
-      val = obj.ifield[1];
-      checkStatus(obj.ifield, 1, String.valueOf(200));
-   }
-
-   public void testDifferentTypes() throws Exception
-   {
-//      ArrayAdvisor.clear();
-//      obj.afield[1] = "Hello";
-//      checkStatus(obj.afield, 1, "Hello");
-//      ArrayAdvisor.clear();
-//      Object aval = obj.afield[1];
-//      if (!aval.equals("Hello")) throw new RuntimeException("Wrong val " + aval);
-//      checkStatus(obj.afield, 1, "Hello");
-//      
-//      ArrayAdvisor.clear();
-//      obj.bfield[2] = true;
-//
-//      ArrayAdvisor.clear();
-//      obj.cfield[1] = 'x';
-//      
-//      ArrayAdvisor.clear();
-//      obj.dfield[2] = 69.0d;
-//      
-//      
-//      ArrayAdvisor.clear();
-//      obj.ffield[1] = 3.9f;
-//      
-//      ArrayAdvisor.clear();
-//      obj.lfield[2] = 100L;
-//      
-//      ArrayAdvisor.clear();
-//      obj.sfield[1] = 5;
-   }
-  
-   private void checkStatus(Object array, int index, String value)
-   {
-      if (array != ArrayAdvisor.array) throw new RuntimeException("Wrong array " + ArrayAdvisor.array);
-      if (index != ArrayAdvisor.index) throw new RuntimeException("Wrong index " + ArrayAdvisor.index);
-      if (!value.equals(ArrayAdvisor.value)) throw new RuntimeException("Wrong string " + ArrayAdvisor.index);
-   }
-}
\ No newline at end of file

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFieldCaller.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFieldCaller.java	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFieldCaller.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,94 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.array;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ClassWithSimpleFieldCaller
-{
-   ClassWithSimpleFields obj = new ClassWithSimpleFields();
-   public void testSimple() throws Exception
-   {
-      checkStatus("field", false, false);
-      obj.field = false;
-      checkStatus("field", true, false);
-      if (obj.field)
-      {
-         throw new RuntimeException("Should have been false!");
-      }
-      checkStatus("field", true, true);
-      boolean b = obj.field;
-   }
-
-   public void testSimpleNotCalled() throws Exception
-   {
-      obj.nonfield = false;
-      if (obj.nonfield)
-      {
-         throw new RuntimeException("Should have been false!");
-      }
-      boolean b = obj.nonfield;
-   }
-   
-   public void testSimpleStatic() throws Exception
-   {
-      checkStatus("staticfield", false, false);
-      ClassWithSimpleFields.staticfield = false;
-      checkStatus("staticfield", true, false);
-      if (obj.staticfield)
-      {
-         throw new RuntimeException("Should have been false!");
-      }
-      checkStatus("staticfield", true, true);
-      
-      boolean b = ClassWithSimpleFields.staticfield;
-   }
-
-   public void testSimpleStaticNotCalled() throws Exception
-   {
-      ClassWithSimpleFields.staticnonfield = false;
-      if (obj.nonfield)
-      {
-         throw new RuntimeException("Should have been false!");
-      }
-
-      boolean b = ClassWithSimpleFields.staticnonfield;
-   }
-   
-   private void checkStatus(String field, boolean written, boolean read)
-   {
-      if (field.equals("field"))
-      {
-         if (obj.field_written != written) throw new RuntimeException("Expected written " + written);
-         if (obj.field_read != read) throw new RuntimeException("Expected read " + read);
-      }
-      else if (field.equals("staticfield"))
-      {
-         if (obj.staticfield_written != written) throw new RuntimeException("Expected written " + written);
-         if (obj.staticfield_read != read) throw new RuntimeException("Expected read " + read);
-      }
-   }
-   
-}

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFields.java
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFields.java	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/ClassWithSimpleFields.java	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.array;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ClassWithSimpleFields
-{
-   public boolean field;
-   public boolean field_written;
-   public boolean field_read;
-   
-   public static boolean staticfield;
-   public static boolean staticfield_written;
-   public static boolean staticfield_read;
-   
-   
-   public boolean nonfield;
-   public static boolean staticnonfield;
-}

Deleted: projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Main.bak
===================================================================
--- projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Main.bak	2006-12-24 00:42:54 UTC (rev 59220)
+++ projects/aop/branches/arrays/aop/src/test/org/jboss/test/aop/array/Main.bak	2006-12-24 10:56:21 UTC (rev 59221)
@@ -1,68 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.array;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class Main
-{
-   public Main()
-   {
-   }
-
-   public static void main(String[] args)throws Exception
-   {
-      Main main = new Main();
-      main.testSimpleField();
-      main.testArrayField();
-   }
-
-   public void testSimpleField() throws Exception
-   {
-      ClassWithSimpleFieldCaller caller = new ClassWithSimpleFieldCaller();
-      caller.testSimple();
-      caller.testSimpleStatic();
-   }
-
-   
-   public void testArrayField() throws Exception
-   {
-//      ClassWithArrayFieldCaller caller = new ClassWithArrayFieldCaller();
-//      caller.testArray();
-//      caller.testArrayStatic();
-   }
-   
-   public void testArrayWrite() throws Exception
-   {
-      ClassWithArrayFieldCaller caller = new ClassWithArrayFieldCaller();
-      caller.testArrayWrite();
-   }
-   
-   public void testArrayRead() throws Exception
-   {
-      ClassWithArrayFieldCaller caller = new ClassWithArrayFieldCaller();
-      caller.testArrayRead();
-   }
-}




More information about the jboss-cvs-commits mailing list