geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
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 GMT
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;
     }



Mime
View raw message