Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 13446 invoked from network); 28 Oct 2008 10:29:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Oct 2008 10:29:23 -0000 Received: (qmail 56102 invoked by uid 500); 28 Oct 2008 10:29:27 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 56059 invoked by uid 500); 28 Oct 2008 10:29:27 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 56049 invoked by uid 99); 28 Oct 2008 10:29:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2008 03:29:26 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Oct 2008 10:28:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B7D83238898F; Tue, 28 Oct 2008 03:28:57 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r708513 - in /felix/trunk/ipojo: examples/junit4osgi/junit4osgi/ tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/ tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/tes... Date: Tue, 28 Oct 2008 10:28:56 -0000 To: commits@felix.apache.org From: clement@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081028102857.B7D83238898F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: clement Date: Tue Oct 28 03:28:51 2008 New Revision: 708513 URL: http://svn.apache.org/viewvc?rev=708513&view=rev Log: Export the helper package of junit4osgi. Add a test on Java 5 manipulation about generics (injection of typed lists). Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooServiceImpl.java felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/TestTypedList.java felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/TypedList.java Modified: felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml Modified: felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml?rev=708513&r1=708512&r2=708513&view=diff ============================================================================== --- felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml (original) +++ felix/trunk/ipojo/examples/junit4osgi/junit4osgi/pom.xml Tue Oct 28 03:28:51 2008 @@ -66,10 +66,11 @@ org.apache.felix.ipojo.junit4osgi.impl, org.apache.felix.ipojo.junit4osgi.test, - org.apache.felix.ipojo.junit4osgi.helpers - org.apache.felix.ipojo.junit4osgi, junit.* + org.apache.felix.ipojo.junit4osgi, + org.apache.felix.ipojo.junit4osgi.helpers, + junit.* !javax.swing*, * Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooServiceImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooServiceImpl.java?rev=708513&view=auto ============================================================================== --- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooServiceImpl.java (added) +++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/FooServiceImpl.java Tue Oct 28 03:28:51 2008 @@ -0,0 +1,44 @@ +package org.apache.felix.ipojo.test.scenarios.component; + +import java.util.Properties; + +import org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService; + +public class FooServiceImpl implements FooService { + + public boolean foo() { + // TODO Auto-generated method stub + return false; + } + + public Properties fooProps() { + // TODO Auto-generated method stub + return null; + } + + public boolean getBoolean() { + // TODO Auto-generated method stub + return false; + } + + public double getDouble() { + // TODO Auto-generated method stub + return 0; + } + + public int getInt() { + // TODO Auto-generated method stub + return 0; + } + + public long getLong() { + // TODO Auto-generated method stub + return 0; + } + + public Boolean getObject() { + // TODO Auto-generated method stub + return null; + } + +} Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/TestTypedList.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/TestTypedList.java?rev=708513&view=auto ============================================================================== --- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/TestTypedList.java (added) +++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/component/TestTypedList.java Tue Oct 28 03:28:51 2008 @@ -0,0 +1,32 @@ +package org.apache.felix.ipojo.test.scenarios.component; + +import java.util.List; +import java.util.Properties; + +import org.apache.felix.ipojo.test.scenarios.manipulation.service.CheckService; +import org.apache.felix.ipojo.test.scenarios.manipulation.service.FooService; + +public class TestTypedList implements CheckService { + + private List list; + + public boolean check() { + return ! list.isEmpty(); + } + + public Properties getProps() { + Properties props = new Properties(); + if (list != null) { + props.put("list", list); + + int i = 0; + for (FooService fs : list) { + props.put(i, fs.foo()); + i++; + } + } + + return props; + } + +} Modified: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java?rev=708513&r1=708512&r2=708513&view=diff ============================================================================== --- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java (original) +++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java Tue Oct 28 03:28:51 2008 @@ -30,6 +30,7 @@ ots.addTestSuite(DuplicateMethod.class); ots.addTestSuite(Boxing.class); ots.addTestSuite(Annotation.class); + ots.addTestSuite(TypedList.class); return ots; } Added: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/TypedList.java URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/TypedList.java?rev=708513&view=auto ============================================================================== --- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/TypedList.java (added) +++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/TypedList.java Tue Oct 28 03:28:51 2008 @@ -0,0 +1,67 @@ +package org.apache.felix.ipojo.test.scenarios.manipulation; + +import java.util.List; +import java.util.Properties; + +import org.apache.felix.ipojo.ComponentInstance; +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.apache.felix.ipojo.test.scenarios.manipulation.service.FooService; +import org.osgi.framework.ServiceReference; + +public class TypedList extends OSGiTestCase { + + ComponentInstance foo1, foo2; + ComponentInstance checker; + IPOJOHelper helper; + + public void setUp() { + helper = new IPOJOHelper(this); + foo1 = helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.FooServiceImpl", "foo1"); + foo2 = helper.createComponentInstance("org.apache.felix.ipojo.test.scenarios.component.FooServiceImpl", "foo2"); + checker = helper.createComponentInstance("TypedList", "checker"); + foo1.stop(); + foo2.stop(); + } + + public void tearDown() { + foo1.dispose(); + foo2.dispose(); + checker.dispose(); + } + + public void testTypedList() { + ServiceReference ref = getServiceReferenceByName(CheckService.class.getName(), checker.getInstanceName()); + CheckService check = (CheckService) context.getService(ref); + assertNotNull("Checker availability", check); + // Check without providers + assertFalse("Empty list", check.check()); + + // Start the first provider + foo1.start(); + assertTrue("List with one element", check.check()); + Properties props = check.getProps(); + List list = (List) props.get("list"); + assertEquals("Check size - 1", 1, list.size()); + + // Start the second provider + foo2.start(); + assertTrue("List with two element", check.check()); + props = check.getProps(); + list = (List) props.get("list"); + assertEquals("Check size - 2", 2, list.size()); + + // Stop the first one + foo1.stop(); + assertTrue("List with one element (2)", check.check()); + props = check.getProps(); + list = (List) props.get("list"); + assertEquals("Check size - 3", 1, list.size()); + + context.ungetService(ref); + } + + + +} Modified: felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml?rev=708513&r1=708512&r2=708513&view=diff ============================================================================== --- felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml (original) +++ felix/trunk/ipojo/tests/manipulator/manipulator-java5/src/main/resources/metadata.xml Tue Oct 28 03:28:51 2008 @@ -1,21 +1,30 @@ - + - + - + name="ManipulationPrimitives5-PrimitiveManipulationTester" + architecture="true"> - + + + + - + classname="org.apache.felix.ipojo.test.scenarios.component.FooServiceImpl"> + + + + + + + \ No newline at end of file