Try to reproduce FELIX-2430.
Seems to work in iPOJO 1.8.0

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1082610 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/manipulator/creation/pom.xml b/ipojo/tests/manipulator/creation/pom.xml
index 068e821..742f8a2 100644
--- a/ipojo/tests/manipulator/creation/pom.xml
+++ b/ipojo/tests/manipulator/creation/pom.xml
@@ -104,6 +104,24 @@
           <target>1.4</target>

         </configuration>

       </plugin>

+

+      <plugin>

+        <groupId>org.apache.felix</groupId>

+        <artifactId>maven-junit4osgi-plugin</artifactId>

+        <version>1.1.0-SNAPSHOT</version>

+        <executions>

+          <execution>

+            <goals>

+              <goal>test</goal>

+            </goals>

+            <configuration>

+              <configuration>

+              <org.osgi.http.port>8083</org.osgi.http.port>

+              </configuration>

+            </configuration>

+          </execution>

+        </executions>

+      </plugin>

     </plugins>

   </build>

 </project>

diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperSuperConstructorWithNew.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperSuperConstructorWithNew.java
new file mode 100644
index 0000000..6f0892f
--- /dev/null
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperSuperConstructorWithNew.java
@@ -0,0 +1,10 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class CallSuperSuperConstructorWithNew extends ParentClass2 {
+
+    public CallSuperSuperConstructorWithNew() {
+        super(new String("test"));
+        System.out.println("plop");
+    }
+
+}
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClass2.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClass2.java
new file mode 100644
index 0000000..39bea4e
--- /dev/null
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClass2.java
@@ -0,0 +1,9 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class ParentClass2 extends SuperParentClass {
+
+    public ParentClass2(String n) {
+        super(n);
+    }
+
+}
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SuperParentClass.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SuperParentClass.java
new file mode 100644
index 0000000..2b87f4a
--- /dev/null
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SuperParentClass.java
@@ -0,0 +1,17 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+public class SuperParentClass {
+
+    private String name;
+
+    public SuperParentClass(final String n) {
+        System.out.println("Hello from super super !");
+        name = n;
+    }
+
+    public SuperParentClass(final StringBuffer n) {
+        name = n.toString();
+    }
+
+
+}
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
index b9fa25f..bd30524 100644
--- a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
@@ -1,4 +1,4 @@
-/* 

+/*

  * Licensed to the Apache Software Foundation (ASF) under one

  * or more contributor license agreements.  See the NOTICE file

  * distributed with this work for additional information

@@ -33,96 +33,96 @@
  * Check the different method to create POJO object.

  */

 public class POJOCreation extends OSGiTestCase {

-    

+

     private IPOJOHelper helper;

-	

-	private ComponentInstance ci_lazzy;

-	private ComponentInstance ci_immediate;

-	private ComponentInstance ci_immediate_singleton;

-	

-	private Architecture lazzyArch;

-	private Architecture immeArch;

-	private Architecture immeArchSing;

-	

-	

+

+    private ComponentInstance ci_lazzy;

+    private ComponentInstance ci_immediate;

+    private ComponentInstance ci_immediate_singleton;

+

+    private Architecture lazzyArch;

+    private Architecture immeArch;

+    private Architecture immeArchSing;

+

+

     private ComponentInstance ci_lazzy_sing;

     private ComponentInstance ci_lazzy_sev;

-   

+

     private Architecture lazzyArchSing;

     private Architecture lazzyArchSev;

     private ComponentInstance ci_lazzy_singM;

     private ComponentInstance ci_lazzy_sevM;

-   

+

     private Architecture lazzyArchSingM;

     private Architecture lazzyArchSevM;

-	

-	public void setUp() {

-	    helper = new IPOJOHelper(this);

-	    

-		String factName = "ManipulationCreation-FooProviderType-1";

-		String compName = "FooProvider-1";

-		ci_lazzy = helper.createComponentInstance(factName ,compName);

-		

-		String factName2 = "ManipulationCreation-ImmediateFooProviderType";

-		String compName2 = "FooProvider-2";

-		ci_immediate = helper.createComponentInstance(factName2, compName2);

-		

-		String factName3 = "ManipulationCreation-ImmediateFooProviderTypeSingleton";

+

+    public void setUp() {

+        helper = new IPOJOHelper(this);

+

+        String factName = "ManipulationCreation-FooProviderType-1";

+        String compName = "FooProvider-1";

+        ci_lazzy = helper.createComponentInstance(factName ,compName);

+

+        String factName2 = "ManipulationCreation-ImmediateFooProviderType";

+        String compName2 = "FooProvider-2";

+        ci_immediate = helper.createComponentInstance(factName2, compName2);

+

+        String factName3 = "ManipulationCreation-ImmediateFooProviderTypeSingleton";

         String compName3 = "FooProvider-3";

         ci_immediate_singleton = helper.createComponentInstance(factName3, compName3);

-        

+

         String factName4 = "ManipulationCreation-FooProviderType-1-Sing";

         String compName4 = "FooProvider-1-Sing";

         ci_lazzy_sing = helper.createComponentInstance(factName4, compName4);

-        

+

         String factName5 = "ManipulationCreation-FooProviderType-1-Sev";

         String compName5 = "FooProvider-1-Sev";

         ci_lazzy_sev = helper.createComponentInstance(factName5, compName5);

-        

+

         String factName6 = "ManipulationCreation-FooProviderType-1-SingM";

         String compName6 = "FooProvider-1-SingM";

         ci_lazzy_singM = helper.createComponentInstance(factName6, compName6);

-        

+

         String factName7 = "ManipulationCreation-FooProviderType-1-SevM";

         String compName7 = "FooProvider-1-SevM";

         ci_lazzy_sevM = helper.createComponentInstance(factName7, compName7);

-		

-		lazzyArch = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName+")");

-		immeArch =   (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName2+")");

-		immeArchSing = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName3+")");

-		lazzyArchSing = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName4+")");

-		lazzyArchSev = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName5+")");

-		lazzyArchSingM = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName6+")");

-		lazzyArchSevM = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName7+")");

-	}

-	

-	public void tearDown() {

-		lazzyArch = null;

-		immeArch = null;

-		immeArchSing = null;

-		lazzyArchSing = null;

-		lazzyArchSev = null;

-		lazzyArchSingM = null;

+

+        lazzyArch = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName+")");

+        immeArch =   (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName2+")");

+        immeArchSing = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName3+")");

+        lazzyArchSing = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName4+")");

+        lazzyArchSev = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName5+")");

+        lazzyArchSingM = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName6+")");

+        lazzyArchSevM = (Architecture) getServiceObject(Architecture.class.getName(), "(architecture.instance="+compName7+")");

+    }

+

+    public void tearDown() {

+        lazzyArch = null;

+        immeArch = null;

+        immeArchSing = null;

+        lazzyArchSing = null;

+        lazzyArchSev = null;

+        lazzyArchSingM = null;

         lazzyArchSevM = null;

         helper.dispose();

-	}

-	

-	/**

-	 * Check lazy creation.

-	 */

-	public void testLazyCreation() {

-		assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);

-		ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());

-		assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",ref);

-		FooService fs = (FooService) getServiceObject(ref);

-		assertTrue("Check the FooService invocation", fs.foo());

-		assertEquals("Check the creation of 1 object",1,  ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);

-	}

-	

-	/**

-	 * Check lazy and singleton creation.

-	 */

-	public void testLazyCreationSingleton() {

+    }

+

+    /**

+     * Check lazy creation.

+     */

+    public void testLazyCreation() {

+        assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);

+        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());

+        assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available",ref);

+        FooService fs = (FooService) getServiceObject(ref);

+        assertTrue("Check the FooService invocation", fs.foo());

+        assertEquals("Check the creation of 1 object",1,  ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);

+    }

+

+    /**

+     * Check lazy and singleton creation.

+     */

+    public void testLazyCreationSingleton() {

         assertEquals("Check that no objects are created ", 0,  ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);

         ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName());

         assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available",ref);

@@ -130,11 +130,11 @@
         assertTrue("Check the FooService invocation", fs.foo());

         assertEquals("Check the creation of 1 object",1,  ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);

     }

-	

-	/**

-	 * Check lazy and "several" creation.

-	 */

-	public void testLazyCreationSeveral() {

+

+    /**

+     * Check lazy and "several" creation.

+     */

+    public void testLazyCreationSeveral() {

         assertEquals("Check that no objects are created ", 0,  ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);

         ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sev.getInstanceName());

         assertNotNull("Check that a FooService from " + ci_lazzy_sev.getInstanceName() + " is available", ref);

@@ -144,19 +144,19 @@
         assertTrue("Check the FooService invocation-2", fs2.foo());

         assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);

     }

-	

-	/**

-	 * Check immediate creation.

-	 */

-	public void testImmediateCreation() {

-		assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);

-		ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName());

-		assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref);

-		FooService fs = (FooService) getServiceObject(ref);

-		assertTrue("Check the FooService invocation", fs.foo());

-		assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);

-	}

-    

+

+    /**

+     * Check immediate creation.

+     */

+    public void testImmediateCreation() {

+        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);

+        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName());

+        assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref);

+        FooService fs = (FooService) getServiceObject(ref);

+        assertTrue("Check the FooService invocation", fs.foo());

+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);

+    }

+

     /**

      * Check bundle context injection.

      */

@@ -173,12 +173,12 @@
      * Test immediate singleton creation.

      */

     public void testImmediateSingletonCreation() {

-    	assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);

-    	ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName());

-    	assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available",ref);

-    	FooService fs = (FooService) getServiceObject(ref);

-    	assertTrue("Check the FooService invocation", fs.foo());

-    	assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);

+        assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);

+        ServiceReference ref = helper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName());

+        assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available",ref);

+        FooService fs = (FooService) getServiceObject(ref);

+        assertTrue("Check the FooService invocation", fs.foo());

+        assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);

     }

 

     /**

@@ -212,7 +212,7 @@
         // Only one object as the getService method is called only once (service factory) despite the policy="method".

         assertEquals("Check the creation of 1 object",1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);

     }

-    

+

     /**

      * Test a custom constructor.

      * Not manipulated.

@@ -224,7 +224,7 @@
         assertEquals("Check foo", "foo", props.get("foo"));

         assertEquals("Check context", getContext(), props.get("context"));

     }

-    

+

     public void testSuperCall() {

         try {

             helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructor");

@@ -232,7 +232,7 @@
             fail(e.getMessage());

         }

     }

-    

+

     public void testSuperCallWithNew() {

         try {

             helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithNew");

@@ -240,7 +240,15 @@
             fail(e.getMessage());

         }

     }

-    

+

+    public void testSuperSuperCallWithNew() {

+        try {

+            helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.CallSuperSuperConstructorWithNew");

+        } catch (Throwable e) {

+            fail(e.getMessage());

+        }

+    }

+

     public void testSuperCallWithBC() {

         try {

             helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithBC");

@@ -248,7 +256,7 @@
             fail(e.getMessage());

         }

     }

-    

-    

+

+

 

 }
\ No newline at end of file
diff --git a/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml b/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
index 3fdacde..c8cd937 100644
--- a/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
+++ b/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
@@ -3,72 +3,73 @@
     xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/SNAPSHOT/core.xsd"

     xmlns="org.apache.felix.ipojo"

 >

-	<!-- Simple provider  used for manipulation analysis -->

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-FooProviderType-1" architecture="true">

-		<provides />

-	</component>

-	

-	<!-- Non lazzy service provider, to check instantiation -->

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-ImmediateFooProviderType" immediate="true"

-		architecture="true">

-		<provides />

-	</component>

-	

-	<!-- Type checking different creation policy -->

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-FooProviderType-1-Sing" factory-method="singleton"

-		architecture="true">

-		<provides />

-	</component>

-	

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-FooProviderType-1-Sev" factory-method="several"

-		architecture="true">

-		<provides />

-	</component>

-	

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-FooProviderType-1-SingM" factory-method="singleton"

-		architecture="true">

-		<provides/>

-	</component>

-	

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-FooProviderType-1-SevM" factory-method="several"

-		architecture="true">

-		<provides/>

-	</component>

-	

-	<component

-		classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

-		name="ManipulationCreation-ImmediateFooProviderTypeSingleton" immediate="true"

-		factory-method="singleton" architecture="true">

-		<provides />

-	</component>

-	

-	

-	<!-- Try calling super constructors -->

-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructor" immediate="true"/>

-     <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithNew" immediate="true"/>

-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithBC" immediate="true"/>

-	 

-	 <!--  Several constructors -->

-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.SeveralConstructors">

-	 	<provides/>

-	 </component>

-	 <!--  No Empty constructor -->

-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.NoEmptyConstructor">

-	 	<provides/>

-	 </component>

-	 <component classname="org.apache.felix.ipojo.test.scenarios.component.NoEmptyConstructorWithParentClass">

-	 	<provides/>

-	 </component>

+  <!-- Simple provider  used for manipulation analysis -->

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-FooProviderType-1" architecture="true">

+    <provides />

+  </component>

+

+  <!-- Non lazzy service provider, to check instantiation -->

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-ImmediateFooProviderType" immediate="true"

+    architecture="true">

+    <provides />

+  </component>

+

+  <!-- Type checking different creation policy -->

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-FooProviderType-1-Sing" factory-method="singleton"

+    architecture="true">

+    <provides />

+  </component>

+

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-FooProviderType-1-Sev" factory-method="several"

+    architecture="true">

+    <provides />

+  </component>

+

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-FooProviderType-1-SingM" factory-method="singleton"

+    architecture="true">

+    <provides/>

+  </component>

+

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-FooProviderType-1-SevM" factory-method="several"

+    architecture="true">

+    <provides/>

+  </component>

+

+  <component

+    classname="org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"

+    name="ManipulationCreation-ImmediateFooProviderTypeSingleton" immediate="true"

+    factory-method="singleton" architecture="true">

+    <provides />

+  </component>

+

+

+  <!-- Try calling super constructors -->

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructor" immediate="true"/>

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithNew" immediate="true"/>

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithBC" immediate="true"/>

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.CallSuperSuperConstructorWithNew" immediate="true"/>

+

+   <!--  Several constructors -->

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.SeveralConstructors">

+     <provides/>

+   </component>

+   <!--  No Empty constructor -->

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.NoEmptyConstructor">

+     <provides/>

+   </component>

+   <component classname="org.apache.felix.ipojo.test.scenarios.component.NoEmptyConstructorWithParentClass">

+     <provides/>

+   </component>

 </ipojo>