felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r749557 - 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/
Date Tue, 03 Mar 2009 07:56:53 GMT
Author: clement
Date: Tue Mar  3 07:56:53 2009
New Revision: 749557

URL: http://svn.apache.org/viewvc?rev=749557&view=rev
Log:
Test case about Felix-967.  (a default constructor delegates to another one with an argument)

Added:
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SeveralConstructors.java
  (with props)
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java
  (with props)
Modified:
    felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.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/SeveralConstructors.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SeveralConstructors.java?rev=749557&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SeveralConstructors.java
(added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SeveralConstructors.java
Tue Mar  3 07:56:53 2009
@@ -0,0 +1,31 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import java.util.Properties;
+
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.CheckService;
+
+public class SeveralConstructors implements CheckService {
+    
+   
+        private String name;
+
+        public SeveralConstructors(){
+            this("hello world");
+        }
+
+        public SeveralConstructors(final String n) {
+            name = n;
+        }
+
+        public boolean check() {
+            return name != null;
+        }
+
+        public Properties getProps() {
+            Properties props = new Properties();
+            props.put("name", name);
+            return props;
+        }
+
+
+}

Propchange: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/SeveralConstructors.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java?rev=749557&r1=749556&r2=749557&view=diff
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
(original)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
Tue Mar  3 07:56:53 2009
@@ -28,6 +28,7 @@
 	public static Test suite(BundleContext bc) {
 		OSGiTestSuite ots = new OSGiTestSuite("Manipulation Creation Test Suite", bc);
         ots.addTestSuite(POJOCreation.class);
+        ots.addTestSuite(SeveralConstructorTest.class);
 		return ots;
 	}
 

Added: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java?rev=749557&view=auto
==============================================================================
--- felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java
(added)
+++ felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java
Tue Mar  3 07:56:53 2009
@@ -0,0 +1,34 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.junit4osgi.helpers.IPOJOHelper;
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.CheckService;
+import org.osgi.framework.ServiceReference;
+
+import org.apache.felix.ipojo.ComponentInstance;
+
+public class SeveralConstructorTest extends OSGiTestCase {
+    
+    private IPOJOHelper helper;
+    
+    private ComponentInstance ci;
+    
+    public void setUp() {
+        helper = new IPOJOHelper(this);
+        ci = helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.SeveralConstructors");
+    }
+    
+    public void tearDown() {
+        helper.dispose();
+    }
+
+    
+    public void testSeveralConstructor() {
+        ServiceReference ref = helper.getServiceReferenceByName(CheckService.class.getName(),
ci.getInstanceName());
+        CheckService cs = (CheckService) getServiceObject(ref);
+        assertTrue("Check assignation", cs.check());
+        String name = (String) cs.getProps().get("name");
+        assertEquals("Check message", "hello world", name);
+    }
+
+}

Propchange: felix/trunk/ipojo/tests/manipulator/creation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/SeveralConstructorTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=749557&r1=749556&r2=749557&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 Tue Mar 
3 07:56:53 2009
@@ -58,4 +58,9 @@
 	<!-- 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"/>
+	 
+	 <!--  Several constructors -->
+	 <component classname="org.apache.felix.ipojo.test.scenarios.component.SeveralConstructors">
+	 	<provides/>
+	 </component>
 </ipojo>



Mime
View raw message