[seam-commits] Seam SVN: r11371 - in branches/community/Seam_2_2: src/remoting/org/jboss/seam/remoting/wrapper and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Aug 12 20:46:48 EDT 2009


Author: shane.bryzak at jboss.com
Date: 2009-08-12 20:46:47 -0400 (Wed, 12 Aug 2009)
New Revision: 11371

Modified:
   branches/community/Seam_2_2/.settings/org.eclipse.jdt.core.prefs
   branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/wrapper/MapWrapper.java
   branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java
Log:
JBSEAM-4342


Modified: branches/community/Seam_2_2/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/community/Seam_2_2/.settings/org.eclipse.jdt.core.prefs	2009-08-12 19:31:59 UTC (rev 11370)
+++ branches/community/Seam_2_2/.settings/org.eclipse.jdt.core.prefs	2009-08-13 00:46:47 UTC (rev 11371)
@@ -1,4 +1,4 @@
-#Sat Oct 25 15:55:36 BST 2008
+#Thu Aug 13 10:04:04 EST 2009
 eclipse.preferences.version=1
 org.eclipse.jdt.core.codeComplete.argumentPrefixes=
 org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -8,6 +8,8 @@
 org.eclipse.jdt.core.codeComplete.localSuffixes=
 org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
 org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve

Modified: branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/wrapper/MapWrapper.java
===================================================================
--- branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/wrapper/MapWrapper.java	2009-08-12 19:31:59 UTC (rev 11370)
+++ branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/wrapper/MapWrapper.java	2009-08-13 00:46:47 UTC (rev 11371)
@@ -53,6 +53,11 @@
 
    public Object convert(Type type) throws ConversionException
    {
+      if (context == null)
+      {
+         throw new IllegalStateException("No call context has been set");
+      }
+      
       Class typeClass = null;
       Type keyType = null;
       Type valueType = null;
@@ -113,7 +118,8 @@
          Element keyElement = (Element) e.element("k").elementIterator().next();
          Element valueElement = (Element) e.element("v").elementIterator().next();
 
-         ((Map) value).put(context.createWrapperFromElement(keyElement).convert(keyType), context.createWrapperFromElement(valueElement).convert(valueType));
+         ((Map) value).put(context.createWrapperFromElement(keyElement).convert(keyType), 
+               context.createWrapperFromElement(valueElement).convert(valueType));
       }
 
       return value;

Modified: branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java	2009-08-12 19:31:59 UTC (rev 11370)
+++ branches/community/Seam_2_2/src/test/unit/org/jboss/seam/test/unit/RemotingTest.java	2009-08-13 00:46:47 UTC (rev 11371)
@@ -8,6 +8,7 @@
 
 import static org.testng.Assert.assertEquals;
 
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -21,6 +22,7 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Queue;
@@ -51,6 +53,7 @@
 import org.jboss.seam.remoting.wrapper.StringWrapper;
 import org.jboss.seam.remoting.wrapper.WrapperFactory;
 import org.testng.annotations.Test;
+import org.w3c.dom.Node;
 import org.jboss.seam.remoting.InterfaceGenerator;
 import java.math.BigInteger;
 import java.math.BigDecimal;
@@ -599,12 +602,24 @@
       {
       }
 
-      byte[] expected = ("<map><element><k><str>foo</str></k><v><str>aaaaa</str></v></element>"
-            + "<element><k><str>bar</str></k><v><str>zzzzz</str></v></element></map>")
-            .getBytes();
+      // ensure when we marshal/unmarshal the values in the map remain the same      
       ByteArrayOutputStream out = new ByteArrayOutputStream();
       wrapper.marshal(out);
-      assertEquals(expected, out.toByteArray());
+      
+      SAXReader xmlReader = new SAXReader();
+      Document doc = xmlReader.read( new ByteArrayInputStream(out.toByteArray()) );     
+      
+      Element root = doc.getRootElement();      
+      
+      MapWrapper other = new MapWrapper();
+      other.setCallContext(new CallContext());
+      other.setElement(root);
+      
+      Map otherMap = (Map) other.convert(Map.class);
+      for (Object key : otherMap.keySet())
+      {
+         assert otherMap.get(key).equals(m.get(key));
+      }      
 
       // test conversionScore() method
       assert ConversionScore.exact == wrapper.conversionScore(Map.class);



More information about the seam-commits mailing list