Add tests on the invocation of super contructors with the bundle context in parameter.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@707613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java
new file mode 100644
index 0000000..b8335aa
--- /dev/null
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java
@@ -0,0 +1,13 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.osgi.framework.BundleContext;
+
+public class CallSuperConstructorWithBC extends ParentClassWithBC {
+
+ public CallSuperConstructorWithBC(BundleContext bc) {
+ super("bc", bc, "bundle");
+ String message = "plop-bc";
+ System.out.println(message);
+ }
+
+}
diff --git a/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java
new file mode 100644
index 0000000..8902d43
--- /dev/null
+++ b/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java
@@ -0,0 +1,14 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.osgi.framework.BundleContext;
+
+public class ParentClassWithBC {
+
+ private BundleContext bc;
+
+ public ParentClassWithBC(String foo, BundleContext bc, String bar) {
+ this.bc = bc;
+ System.out.println(foo + " : " + this.bc + "(" + bar + ")");
+ }
+
+}
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 9cf0a35..8ce4af5 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
@@ -303,6 +303,16 @@
}
}
+ public void testSuperCallWithBC() {
+ try {
+ Factory fact = Utils.getFactoryByName(context, "org.apache.felix.ipojo.test.scenarios.component.CallSuperConstructorWithBC");
+ ComponentInstance ci = fact.createComponentInstance(null);
+ ci.dispose();
+ } catch (Throwable e) {
+ 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 b6f2f4c..0f2c9c8 100644
--- a/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
+++ b/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
@@ -57,4 +57,5 @@
<!-- 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.CallSuperConstructorWithBC" immediate="true"/>
</ipojo>