commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcu...@apache.org
Subject svn commit: r413682 - in /jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation: ./ asm/
Date Mon, 12 Jun 2006 15:28:48 GMT
Author: tcurdt
Date: Mon Jun 12 08:28:47 2006
New Revision: 413682

URL: http://svn.apache.org/viewvc?rev=413682&view=rev
Log:
activate ASM tests

Modified:
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
    jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/ClassTransformerClassLoader.java
Mon Jun 12 08:28:47 2006
@@ -25,8 +25,26 @@
         transformer = pTransformer;
     }
 
-    protected byte[] transform( final InputStream pClassStream ) throws IOException {
-        return transformer.transform(IOUtils.toByteArray(pClassStream));
+    protected byte[] transform(final String pName, final InputStream pClassStream) throws
IOException {
+        final byte[] oldClass = IOUtils.toByteArray(pClassStream);
+        final byte[] newClass = transformer.transform(oldClass);
+
+//    	CheckClassAdapter.verify(new ClassReader(newClass), true);
+
+//        
+//    	new ClassReader(oldClass).accept(
+//    			new ASMifierClassVisitor(
+//    					new PrintWriter(
+//    							new FileOutputStream(
+//    									transformer.getClass().getSimpleName() + pName + ".old"))), false);
+//
+//    	new ClassReader(newClass).accept(
+//    			new ASMifierClassVisitor(
+//    					new PrintWriter(
+//    							new FileOutputStream(
+//    									transformer.getClass().getSimpleName() + pName + ".new"))), false);
+    	
+        return newClass;
     }
 
     
@@ -87,14 +105,8 @@
                 if (name.indexOf(".rewrite.") >= 0) {
 //                    System.err.println("Instrumenting: " + name);
 
-                	bytecode = transform(is);
-
-                	/*
-                     * FileOutputStream os = new FileOutputStream(name+".class");
-                     * os.write(bytecode); os.flush(); os.close();
-                     */
+                	bytecode = transform(name, is);
 
-                	// CheckClassAdapter.verify(new ClassReader(bytecode), true);
                 } else {
                     ClassReader cr = new ClassReader(is);
                     bytecode = cr.b;

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/BlackRedTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,14 +6,13 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 public final class BlackRedTestCase extends TestCase {
 
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ClassAccessTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public class ClassAccessTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/CounterTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class CounterTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/DefaultConstructorTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class DefaultConstructorTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/InvokerTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class InvokerTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NewObjectTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class NewObjectTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/NoReferenceTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class NoReferenceTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/ResumeTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class ResumeTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SerializationTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class SerializationTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/SimpleTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class SimpleTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(

Modified: jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java?rev=413682&r1=413681&r2=413682&view=diff
==============================================================================
--- jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
(original)
+++ jakarta/commons/sandbox/javaflow/trunk/src/test/org/apache/commons/javaflow/bytecode/transformation/asm/StackTestCase.java
Mon Jun 12 08:28:47 2006
@@ -6,7 +6,6 @@
 
 import org.apache.commons.javaflow.bytecode.transformation.AbstractTransformerTestCase;
 import org.apache.commons.javaflow.bytecode.transformation.ClassTransformerClassLoader;
-import org.apache.commons.javaflow.bytecode.transformation.bcel.BcelClassTransformer;
 
 
 public final class StackTestCase extends TestCase {
@@ -14,7 +13,7 @@
     public static Test suite() throws Exception {
 
     	final ClassTransformerClassLoader classloader =
-            new ClassTransformerClassLoader(new BcelClassTransformer());
+            new ClassTransformerClassLoader(new AsmClassTransformer());
         
         final Class clazz = classloader.loadClass(
         		AbstractTransformerTestCase.getTestCaseClassName(



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message