geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r517153 - in /geronimo/xbean/trunk/xbean-spring/src: main/java/org/apache/xbean/spring/context/v2c/ test/java/org/apache/xbean/spring/context/ test/resources/org/apache/xbean/spring/context/
Date Mon, 12 Mar 2007 09:47:14 GMT
Author: gnodet
Date: Mon Mar 12 02:47:13 2007
New Revision: 517153

URL: http://svn.apache.org/viewvc?view=rev&rev=517153
Log:
XBEAN-69: Support for maps of objects

Modified:
    geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
    geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
    geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
    geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java?view=diff&rev=517153&r1=517152&r2=517153
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/context/v2c/XBeanNamespaceHandler.java
Mon Mar 12 02:47:13 2007
@@ -52,6 +52,7 @@
 import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.beans.factory.support.ManagedList;
+import org.springframework.beans.factory.support.ManagedMap;
 import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
 import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
 import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader;
@@ -590,7 +591,7 @@
     }
 
     protected Object parseCustomMapElement(MappingMetaData metadata, Element element, String
name) {
-        Map map = new HashMap();
+        Map map = new ManagedMap();
 
         Element parent = (Element) element.getParentNode();
         String entryName = metadata.getMapEntryName(getLocalName(parent), name);

Modified: geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java?view=diff&rev=517153&r1=517152&r2=517153
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/FavoriteUsingSpringTest.java
Mon Mar 12 02:47:13 2007
@@ -21,6 +21,7 @@
 
 import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.apache.xbean.spring.example.FavoriteService;
+import org.apache.xbean.spring.example.GinService;
 
 /**
  * @author James Strachan
@@ -34,7 +35,7 @@
   
         Map favorites = fs.getFavorites();
         assertNotNull(favorites);
-        assertEquals(2, favorites.size());
+        assertEquals(3, favorites.size());
         
         assertEquals("Grey Goose", favorites.get("Dan"));
         Object object = favorites.get("IndecisiveDan");
@@ -42,6 +43,15 @@
         assertTrue(object instanceof List);
         List l = (List) object;
         assertEquals(2, l.size());
+        object = l.get(0);
+        System.out.println(object.getClass());
+        assertTrue(object instanceof String);
+        object = l.get(1);
+        System.out.println(object.getClass());
+        assertTrue(object instanceof Integer);
+        object = favorites.get("WithInnerBean");
+        System.out.println(object.getClass());
+        assertTrue(object instanceof GinService);
     }
 
     protected AbstractXmlApplicationContext createApplicationContext() {

Modified: geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml?view=diff&rev=517153&r1=517152&r2=517153
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-normal.xml
Mon Mar 12 02:47:13 2007
@@ -29,8 +29,15 @@
         <entry key="IndecisiveDan">
           <list>
             <value>Malbec</value>
-            <value>Cognac</value>
+            <bean class="java.lang.Integer">
+              <constructor-arg value="0"/>
+            </bean>
           </list>
+        </entry>
+        <entry key="WithInnerBean">
+          <bean class="org.apache.xbean.spring.example.GinService">
+            <property name="name" value="name"/>
+          </bean>
         </entry>
       </map>
     </property>

Modified: geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml?view=diff&rev=517153&r1=517152&r2=517153
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/favorite-xbean.xml
Mon Mar 12 02:47:13 2007
@@ -26,9 +26,14 @@
       <b:favorite-item person="IndecisiveDan">
         <list>
           <value>Malbec</value>
-          <value>Cognac</value>
+          <bean class="java.lang.Integer">
+            <constructor-arg value="0"/>
+          </bean>
         </list>
-      </b:favorite-item>
+      </b:favorite-item>
+      <b:favorite-item person="WithInnerBean">
+        <b:gin><![CDATA[Bombay Sapphire]]></b:gin>
+      </b:favorite-item>
     </b:favorites>
   </b:favorite>
 



Mime
View raw message