You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/10/24 14:31:41 UTC

svn commit: r707613 - in /felix/trunk/ipojo/tests/manipulator/creation/src/main: java/org/apache/felix/ipojo/test/scenarios/component/ java/org/apache/felix/ipojo/test/scenarios/manipulation/ resources/

Author: clement
Date: Fri Oct 24 05:31:41 2008
New Revision: 707613

URL: http://svn.apache.org/viewvc?rev=707613&view=rev
Log:
Add tests on the invocation of super contructors with the bundle context in parameter.

Added:
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java
Modified:
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
    felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java?rev=707613&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/CallSuperConstructorWithBC.java Fri Oct 24 05:31:41 2008
@@ -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);
+    } 
+
+}

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java?rev=707613&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java (added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ParentClassWithBC.java Fri Oct 24 05:31:41 2008
@@ -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 + ")");
+    } 
+
+}

Modified: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java?rev=707613&r1=707612&r2=707613&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java (original)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/POJOCreation.java Fri Oct 24 05:31:41 2008
@@ -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

Modified: felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml?rev=707613&r1=707612&r2=707613&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/resources/metadata.xml Fri Oct 24 05:31:41 2008
@@ -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>