Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 96093 invoked from network); 21 Apr 2009 13:40:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Apr 2009 13:40:26 -0000 Received: (qmail 21044 invoked by uid 500); 21 Apr 2009 13:40:26 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 20972 invoked by uid 500); 21 Apr 2009 13:40:26 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 20963 invoked by uid 99); 21 Apr 2009 13:40:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 13:40:26 +0000 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, 21 Apr 2009 13:40:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 36D9A23888E6; Tue, 21 Apr 2009 13:40:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r767145 - in /geronimo/sandbox/blueprint: blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/ blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/ Date: Tue, 21 Apr 2009 13:40:05 -0000 To: scm@geronimo.apache.org From: gnodet@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090421134005.36D9A23888E6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gnodet Date: Tue Apr 21 13:40:04 2009 New Revision: 767145 URL: http://svn.apache.org/viewvc?rev=767145&view=rev Log: Test instanciated component properties Modified: geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestModuleContext.java geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Bar.java geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java Modified: geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestModuleContext.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestModuleContext.java?rev=767145&r1=767144&r2=767145&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestModuleContext.java (original) +++ geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestModuleContext.java Tue Apr 21 13:40:04 2009 @@ -21,11 +21,14 @@ import java.net.URLDecoder; import java.util.Properties; import java.util.Hashtable; +import java.util.Currency; +import java.text.SimpleDateFormat; import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest; import org.apache.geronimo.blueprint.sample.Foo; import org.apache.geronimo.blueprint.sample.Bar; import org.apache.geronimo.blueprint.sample.InterfaceA; +import org.apache.geronimo.blueprint.sample.CurrencyTypeConverter; import org.osgi.framework.Bundle; import org.osgi.framework.ServiceRegistration; import org.osgi.framework.Constants; @@ -48,14 +51,25 @@ Object obj = moduleContext.getComponent("bar"); assertNotNull(obj); assertEquals(Bar.class, obj.getClass()); + Bar bar = (Bar) obj; + assertNotNull(bar.getContext()); + assertEquals("Hello FooBar", bar.getValue()); + assertNotNull(bar.getList()); + assertEquals(2, bar.getList().size()); + assertEquals("a list element", bar.getList().get(0)); + assertEquals(Integer.valueOf(5), bar.getList().get(1)); obj = moduleContext.getComponent("foo"); assertNotNull(obj); assertEquals(Foo.class, obj.getClass()); + Foo foo = (Foo) obj; + assertEquals(5, foo.getA()); + assertEquals(10, foo.getB()); + assertSame(bar, foo.getBar()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"), foo.getDate()); - // TODO: components properties - - Foo foo = getOsgiService(Foo.class, 5000); - assertNotNull(foo); + obj = getOsgiService(Foo.class, 5000); + assertNotNull(obj); assertSame(foo, obj); bundle.stop(); Modified: geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Bar.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Bar.java?rev=767145&r1=767144&r2=767145&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Bar.java (original) +++ geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Bar.java Tue Apr 21 13:40:04 2009 @@ -25,7 +25,19 @@ private BundleContext context; private String value; private List list; - + + public BundleContext getContext() { + return context; + } + + public String getValue() { + return value; + } + + public List getList() { + return list; + } + public String toString() { return hashCode() + ": " + value + " " + context + " " + list; } Modified: geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java?rev=767145&r1=767144&r2=767145&view=diff ============================================================================== --- geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java (original) +++ geronimo/sandbox/blueprint/blueprint-sample/src/main/java/org/apache/geronimo/blueprint/sample/Foo.java Tue Apr 21 13:40:04 2009 @@ -28,6 +28,26 @@ private Currency currency; private Date date; + public int getA() { + return a; + } + + public int getB() { + return b; + } + + public Bar getBar() { + return bar; + } + + public Currency getCurrency() { + return currency; + } + + public Date getDate() { + return date; + } + public String toString() { return a + " " + b + " " + bar + " " + currency + " " + date; }