geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r770413 - in /geronimo/sandbox/blueprint/blueprint-core/src: main/java/org/apache/geronimo/blueprint/context/ test/java/org/apache/geronimo/blueprint/ test/java/org/apache/geronimo/blueprint/pojos/ test/resources/
Date Thu, 30 Apr 2009 19:50:28 GMT
Author: gawor
Date: Thu Apr 30 19:50:28 2009
New Revision: 770413

URL: http://svn.apache.org/viewvc?rev=770413&view=rev
Log:
support compound property names

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/BeanD.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoB.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-wiring.xml

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java?rev=770413&r1=770412&r2=770413&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Instanciator.java
Thu Apr 30 19:50:28 2009
@@ -204,7 +204,7 @@
         recipe.setExplicitDependencies(local.getExplicitDependencies());
         for (BeanProperty property : local.getProperties()) {
             Object value = getValue(property.getValue(), null);
-            recipe.setProperty(property.getName(), value);
+            recipe.setCompoundProperty(property.getName(), value);
         }
         if (BeanMetadata.SCOPE_PROTOTYPE.equals(local.getScope())) {
             recipe.setKeepRecipe(true);

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java?rev=770413&r1=770412&r2=770413&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.java
Thu Apr 30 19:50:28 2009
@@ -126,6 +126,20 @@
         // test destroy-method
         assertEquals(true, pojob.getDestroyCalled());
     }
+    
+    public void testCompoundProperties() throws Exception {
+        ComponentDefinitionRegistryImpl registry = parse("/test-wiring.xml");
+        Instanciator i = new Instanciator(new TestBlueprintContext(registry));
+        BlueprintObjectRepository repository = i.createRepository(registry);
+        ObjectGraph graph = new ObjectGraph(repository);
+        
+        Object obj5 = graph.create("compound");
+        assertNotNull(obj5);
+        assertTrue(obj5 instanceof PojoB);
+        PojoB pojob = (PojoB) obj5;
+    
+        assertEquals("hello bean property", pojob.getBean().getName());
+    }
 
     public void testDependencies() throws Exception {
         CallbackTracker.clear();

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/BeanD.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/BeanD.java?rev=770413&r1=770412&r2=770413&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/BeanD.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/BeanD.java
Thu Apr 30 19:50:28 2009
@@ -23,6 +23,16 @@
 
 public class BeanD {
 
+    private String name;
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
     public void init() {
         CallbackTracker.add(new Callback(Callback.INIT, this));
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoB.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoB.java?rev=770413&r1=770412&r2=770413&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoB.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/pojos/PojoB.java
Thu Apr 30 19:50:28 2009
@@ -24,6 +24,7 @@
 
     private URI uri;
     private int number;
+    private BeanD bean;
     
     private boolean initCalled;
     private boolean destroyCalled;
@@ -64,6 +65,13 @@
         return number;
     }
     
+    public BeanD getBean() {
+        if (bean == null) {
+            bean = new BeanD();
+        }
+        return bean;
+    }
+    
     public static PojoB createStatic(URI uri, int number) {
         return new PojoB(URI.create(uri + "-static"), number);
     }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-wiring.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-wiring.xml?rev=770413&r1=770412&r2=770413&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-wiring.xml (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/resources/test-wiring.xml Thu Apr 30
19:50:28 2009
@@ -87,4 +87,8 @@
         </property>
     </bean>
 
+    <bean id="compound" class="org.apache.geronimo.blueprint.pojos.PojoB">
+        <property name="bean.name" value="hello bean property" />
+    </bean>
+    
 </blueprint>
\ No newline at end of file



Mime
View raw message