geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r769523 - in /geronimo/sandbox/blueprint/blueprint-core/src: main/java/org/apache/geronimo/blueprint/context/ test/java/org/apache/geronimo/blueprint/ test/resources/
Date Tue, 28 Apr 2009 20:32:42 GMT
Author: gawor
Date: Tue Apr 28 20:32:39 2009
New Revision: 769523

URL: http://svn.apache.org/viewvc?rev=769523&view=rev
Log:
parse map key entries correctly

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
    geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/WiringTest.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/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=769523&r1=769522&r2=769523&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Tue Apr 28 20:32:39 2009
@@ -195,7 +195,7 @@
                         if (checkAllSatisfiables()) {
                             state = State.InitialReferencesSatisfied;
                         }
-                        break;
+                        return;
                     case InitialReferencesSatisfied:
                         instantiateComponents();
                         registerAllServices();

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java?rev=769523&r1=769522&r2=769523&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/Parser.java
Tue Apr 28 20:32:39 2009
@@ -694,7 +694,7 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (nodeNameEquals(e, KEY_ELEMENT)) {
-                    keyValue = (NonNullMetadata) parseValueElement(e, enclosingComponent,
false);
+                    keyValue = parseMapKeyEntry(e, enclosingComponent);
                 } else {
                     valValue = parseValueElement(e, enclosingComponent, true);
                 }
@@ -719,6 +719,20 @@
         return new MapEntryImpl(keyValue, valValue);
     }
 
+    private NonNullMetadata parseMapKeyEntry(Element element, ComponentMetadata enclosingComponent)
{
+        NonNullMetadata keyValue = null;
+        NodeList nl = element.getChildNodes();
+        for (int i = 0; i < nl.getLength(); i++) {
+            Node node = nl.item(i);
+            if (node instanceof Element) {
+                Element e = (Element) node;
+                keyValue = (NonNullMetadata) parseValueElement(e, enclosingComponent, false);
+                break;
+            }
+        }
+        return keyValue;
+    }
+    
     private RegistrationListener parseRegistrationListener(Element element) {
         // Parse attributes
         String ref = element.hasAttribute(REF_ATTRIBUTE) ? element.getAttribute(REF_ATTRIBUTE)
: null;

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=769523&r1=769522&r2=769523&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
Tue Apr 28 20:32:39 2009
@@ -85,6 +85,7 @@
         assertNotNull(pojoa.getMap());
         assertEquals("val", pojoa.getMap().get("key"));
         assertEquals(pojob, pojoa.getMap().get(pojob));      
+        assertEquals(URI.create("http://geronimo.apache.org"), pojoa.getMap().get(new Integer(5)));
         
         assertNotNull(pojoa.getProps());
         assertEquals("value1", pojoa.getProps().get("key1"));

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=769523&r1=769522&r2=769523&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 Tue Apr 28
20:32:39 2009
@@ -31,6 +31,10 @@
             <map>
                 <entry key="key" value="val"/>
                 <entry key-ref="pojoB" value-ref="pojoB" />
+                <entry>
+                     <key><value type="java.lang.Integer">5</value></key>
+                     <value type="java.net.URI">http://geronimo.apache.org</value>
+                </entry>
             </map>
         </property>
         <property name="set">



Mime
View raw message