Re-enables disabled tests.
Adds a test about constructor parameters.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1186234 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java b/ipojo/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
index 4901b8c..acc6769 100644
--- a/ipojo/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
+++ b/ipojo/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java
@@ -1,11 +1,8 @@
 package org.apache.felix.ipojo.manipulation;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
+import java.io.*;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 
@@ -44,7 +41,7 @@
 
     }
 
-    public void _testManipulatingTheSimplePojo() throws Exception {
+    public void testManipulatingTheSimplePojo() throws Exception {
         Manipulator manipulator = new Manipulator();
         byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/SimplePojo.class")));
         TestClassLoader classloader = new TestClassLoader("test.SimplePojo", clazz);
@@ -95,7 +92,7 @@
 
     }
 
-    public void _testManipulatingChild() throws Exception {
+    public void testManipulatingChild() throws Exception {
         Manipulator manipulator = new Manipulator();
         byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/Child.class")));
         TestClassLoader classloader = new TestClassLoader("test.Child", clazz);
@@ -141,7 +138,7 @@
 
     }
 
-    public void _testManipulatingTheInner() throws Exception {
+    public void testManipulatingTheInner() throws Exception {
         Manipulator manipulator = new Manipulator();
         byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/PojoWithInner.class")));
         TestClassLoader classloader = new TestClassLoader("test.PojoWithInner", clazz);
@@ -195,7 +192,7 @@
 
     }
 
-    public void _testManipulatingWithConstructorModification() throws Exception {
+    public void testManipulatingWithConstructorModification() throws Exception {
         Manipulator manipulator = new Manipulator();
         byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/Child.class")));
         TestClassLoader classloader = new TestClassLoader("test.Child", clazz);
@@ -260,7 +257,7 @@
     }
 
 
-    public void _testManipulatingWithNoValidConstructor() throws Exception {
+    public void testManipulatingWithNoValidConstructor() throws Exception {
         Manipulator manipulator = new Manipulator();
         byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/NoValidConstructor.class")));
         TestClassLoader classloader = new TestClassLoader("test.NoValidConstructor", clazz);
@@ -297,17 +294,29 @@
 
     }
 
-//	public void test() throws Exception {
-//
-//
-//		byte[] clazz = getBytesFromFile(new File("target/test-classes/test/Constructor.class"));
-//		ClassReader cr = new ClassReader(clazz);
-//        MetadataCollector collector = new MetadataCollector();
-//        cr.accept(collector, 0);
-//
-//        System.out.println(collector.getComponentTypeDeclaration());
-//
-//	}
+     public void testConstructor() throws Exception {
+        Manipulator manipulator = new Manipulator();
+        byte[] clazz = manipulator.manipulate(getBytesFromFile(new File("target/test-classes/test/ConstructorCheck.class")));
+
+//        File out = new File("target/ManipulatedConstructorCheck.class");
+//        FileOutputStream fos = new FileOutputStream(out);
+//        fos.write(clazz);
+//        fos.close();
+
+        TestClassLoader classloader = new TestClassLoader("test.ConstructorCheck", clazz);
+        Class cl = classloader.findClass("test.ConstructorCheck");
+        Assert.assertNotNull(cl);
+        Assert.assertNotNull(manipulator.getManipulationMetadata());
+
+        System.out.println(manipulator.getManipulationMetadata());
+
+        Constructor c = cl.getConstructor(new Class[] {String.class });
+        Assert.assertNotNull(c);
+
+        Object o = c.newInstance("toto");
+        Field f = o.getClass().getField("m_foo");
+        Assert.assertEquals("toto", f.get(o));
+     }
 
     public static byte[] getBytesFromFile(File file) throws IOException {
         InputStream is = new FileInputStream(file);
diff --git a/ipojo/manipulator/src/test/java/test/ConstructorCheck.java b/ipojo/manipulator/src/test/java/test/ConstructorCheck.java
new file mode 100644
index 0000000..4492ca4
--- /dev/null
+++ b/ipojo/manipulator/src/test/java/test/ConstructorCheck.java
@@ -0,0 +1,12 @@
+package test;
+
+
+public class ConstructorCheck {
+
+    public String m_foo;
+
+    public ConstructorCheck(String foo) {
+        m_foo = foo;
+    }
+
+}