[jboss-cvs] JBossAS SVN: r63358 - projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 5 13:46:28 EDT 2007


Author: kabir.khan at jboss.com
Date: 2007-06-05 13:46:28 -0400 (Tue, 05 Jun 2007)
New Revision: 63358

Removed:
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/BaseClass.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/SubClass.java
Modified:
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/MethodHashingTestCase.java
Log:
Move the bulk of the MethodHashingTests to microcontainer/aop-mc-int

Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/BaseClass.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/BaseClass.java	2007-06-05 17:44:35 UTC (rev 63357)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/BaseClass.java	2007-06-05 17:46:28 UTC (rev 63358)
@@ -1,72 +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.methodhashing;
-
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public class BaseClass
-{
-   public int method(
-         BaseClass bc, 
-         java.lang.String s, 
-         byte by,
-         char ch,
-         double db,
-         float fl,
-         int i,
-         long l,
-         short sh,
-         boolean b,
-         BaseClass[] bca, 
-         java.lang.String[] sa, 
-         byte[] bya,
-         char[] cha,
-         double[] dba,
-         float[] fla,
-         int[] ia,
-         long[] la,
-         short[] sha,
-         boolean[] ba,
-         BaseClass[][] bcaa, 
-         java.lang.String[][] saa, 
-         byte[][] byaa,
-         char[][] chaa,
-         double[][] dbaa,
-         float[][] flaa,
-         int[][] iaa,
-         long[][] laa,
-         short[][] shaa,
-         boolean[][] baa)
-   {
-      return i;
-   }
-   
-   public void method()
-   {
-   }
-   
-
-}

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/MethodHashingTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/MethodHashingTestCase.java	2007-06-05 17:44:35 UTC (rev 63357)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/MethodHashingTestCase.java	2007-06-05 17:46:28 UTC (rev 63358)
@@ -23,21 +23,11 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.util.Iterator;
 import java.util.Map;
 
-import javassist.CtClass;
-import javassist.CtMethod;
 import junit.framework.TestCase;
 
-import org.jboss.aop.util.ClassInfoMethodHashing;
-import org.jboss.aop.util.JavassistMethodHashing;
 import org.jboss.aop.util.MethodHashing;
-import org.jboss.aop.util.ReflectToJavassist;
-import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
-import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
-import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.MethodInfo;
 
 /**
  * Test to make sure that the different mechanisms of creating method hashes return the same hashes
@@ -57,136 +47,6 @@
    }
 
    
-   
-   public void testDeclaredMethodHashing() throws Exception
-   {
-      Class clazz = SubClass.class;
-      CtClass ctclass = getCtClass(clazz);
-      ClassInfo classInfoReflect = getIntrospectTypeInfo(clazz);
-      ClassInfo classInfoJavassist = getJavassistTypeInfo(clazz);
-      
-      Map reflectInfoMethods = ClassInfoMethodHashing.getDeclaredMethodMap(classInfoReflect);
-      Map javassistInfoMethods = ClassInfoMethodHashing.getDeclaredMethodMap(classInfoJavassist);
-      Map javassistMethods = JavassistMethodHashing.getDeclaredMethodMap(ctclass);
-      
-      compareMaps(reflectInfoMethods, javassistInfoMethods, 1);
-      compareMaps(reflectInfoMethods, javassistMethods, 1);
-      
-      for (Iterator it = reflectInfoMethods.keySet().iterator() ; it.hasNext() ; )
-      {
-         Long hash = (Long)it.next();
-         CtMethod ctmethod = (CtMethod)javassistMethods.get(hash);
-         MethodInfo methodInfo = (MethodInfo)reflectInfoMethods.get(hash);
-         compareMethods(methodInfo, ctmethod);
-         
-         MethodInfo methodInfo2 = (MethodInfo)javassistInfoMethods.get(hash);
-         compareMethods(methodInfo, methodInfo2);
-
-         Method method = MethodHashing.findMethodByHash(clazz, hash.longValue());
-         assertNotNull(method);
-         compareMethods(methodInfo, method);
-         
-         Method methodB = org.jboss.util.MethodHashing.findMethodByHash(clazz, hash.longValue());
-         assertNotNull(methodB);
-         compareMethods(methodInfo, methodB);
-      }
-   }
-   
-   public void testMethodHashing() throws Exception
-   {
-      Class clazz = SubClass.class;
-      CtClass ctclass = getCtClass(clazz);
-      ClassInfo classInfoReflect = getIntrospectTypeInfo(clazz);
-      ClassInfo classInfoJavassist = getJavassistTypeInfo(clazz);
-      
-      Map reflectInfoMethods = ClassInfoMethodHashing.getMethodMap(classInfoReflect);
-      Map javassistInfoMethods = ClassInfoMethodHashing.getMethodMap(classInfoJavassist);
-      Map javassistMethods = JavassistMethodHashing.getMethodMap(ctclass);
-      
-      compareMaps(reflectInfoMethods, javassistInfoMethods, 2);
-      compareMaps(reflectInfoMethods, javassistMethods, 2);
-      
-      for (Iterator it = reflectInfoMethods.keySet().iterator() ; it.hasNext() ; )
-      {
-         Long hash = (Long)it.next();
-         CtMethod ctmethod = (CtMethod)javassistMethods.get(hash);
-         MethodInfo methodInfo = (MethodInfo)reflectInfoMethods.get(hash);
-         compareMethods(methodInfo, ctmethod);
-         
-         MethodInfo methodInfo2 = (MethodInfo)javassistInfoMethods.get(hash);
-         compareMethods(methodInfo, methodInfo2);
-
-         Method method = MethodHashing.findMethodByHash(clazz, hash.longValue());
-         assertNotNull(method);
-         compareMethods(methodInfo, method);
-         
-         Method methodB = org.jboss.util.MethodHashing.findMethodByHash(clazz, hash.longValue());
-         assertNotNull(methodB);
-         compareMethods(methodInfo, methodB);
-      }
-   }
-   
-   private CtClass getCtClass(Class clazz) throws Exception
-   {
-      return ReflectToJavassist.classToJavassist(clazz);
-   }
-   
-   private ClassInfo getIntrospectTypeInfo(Class clazz)
-   {
-      IntrospectionTypeInfoFactory typeInfoFactory = new IntrospectionTypeInfoFactory();
-      ClassInfo classInfo = (ClassInfo)typeInfoFactory.getTypeInfo(clazz);
-      return classInfo;
-   }
-   
-   private ClassInfo getJavassistTypeInfo(Class clazz)
-   {
-      JavassistTypeInfoFactory typeInfoFactory = new JavassistTypeInfoFactory();
-      ClassInfo classInfo = (ClassInfo)typeInfoFactory.getTypeInfo(clazz);
-      return classInfo;
-   }
-   
-   private void compareMaps(Map mapA, Map mapB, int expecedSize)
-   {
-      assertEquals(expecedSize, mapA.size());
-      assertEquals(expecedSize, mapB.size());
-      
-      for (Iterator it = mapA.keySet().iterator() ; it.hasNext() ; )
-      {
-         Long l = (Long)it.next();
-         assertNotNull(mapB.get(l));
-      }
-   }
-   
-   private void compareMethods(MethodInfo methodInfo, CtMethod method) throws Exception
-   {
-      System.out.println("-----> method " + method);
-      assertEquals(methodInfo.getName(), method.getName());
-      assertEquals(methodInfo.getDeclaringClass().getName(), method.getDeclaringClass().getName());
-      assertEquals(methodInfo.getReturnType().getName(), method.getReturnType().getName());
-      assertEquals(methodInfo.getModifiers(), method.getModifiers());
-      assertEquals(methodInfo.getParameterTypes().length, method.getParameterTypes().length);
-   }
-
-   private void compareMethods(MethodInfo methodInfo, MethodInfo method) throws Exception
-   {
-      System.out.println("-----> method " + method);
-      assertEquals(methodInfo.getName(), method.getName());
-      assertEquals(methodInfo.getDeclaringClass().getName(), method.getDeclaringClass().getName());
-      assertEquals(methodInfo.getReturnType().getName(), method.getReturnType().getName());
-      assertEquals(methodInfo.getModifiers(), method.getModifiers());
-      assertEquals(methodInfo.getParameterTypes().length, method.getParameterTypes().length);
-   }
-
-   private void compareMethods(MethodInfo methodInfo, Method method) throws Exception
-   {
-      System.out.println("-----> method " + method);
-      assertEquals(methodInfo.getName(), method.getName());
-      assertEquals(methodInfo.getDeclaringClass().getName(), method.getDeclaringClass().getName());
-      assertEquals(methodInfo.getReturnType().getName(), method.getReturnType().getName());
-      assertEquals(methodInfo.getModifiers(), method.getModifiers());
-      assertEquals(methodInfo.getParameterTypes().length, method.getParameterTypes().length);
-   }
-
    /**
     * Written as a sanity check when optimizing the MethodHashing class
     */

Deleted: projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/SubClass.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/SubClass.java	2007-06-05 17:44:35 UTC (rev 63357)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/methodhashing/SubClass.java	2007-06-05 17:46:28 UTC (rev 63358)
@@ -1,35 +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.methodhashing;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision$
- */
-public class SubClass extends BaseClass
-{
-   public void method()
-   {
-      super.method();
-   }
-}




More information about the jboss-cvs-commits mailing list