cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r785621 - /cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
Date Wed, 17 Jun 2009 14:25:53 GMT
Author: sergeyb
Date: Wed Jun 17 14:25:52 2009
New Revision: 785621

URL: http://svn.apache.org/viewvc?rev=785621&view=rev
Log:
CXF-2297 : adding a negative Aegis test

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java?rev=785621&r1=785620&r2=785621&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
Wed Jun 17 14:25:52 2009
@@ -21,12 +21,16 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 
 import org.apache.cxf.jaxrs.fortest.AegisTestBean;
+
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class AegisProviderTest extends Assert {
@@ -74,4 +78,35 @@
         String xml = new String(bytes, "utf-8");
         assertEquals(SIMPLE_BEAN_XML, xml);
     }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    @Ignore
+    public void testReadWriteComplexMap() throws Exception {
+        Map<AegisTestBean, String> map = new HashMap<AegisTestBean, String>();
+        AegisTestBean bean = new AegisTestBean();
+        bean.setBoolValue(Boolean.TRUE);
+        bean.setStrValue("hovercraft");
+        map.put(bean, "hovercraft");
+        
+        MessageBodyWriter<Object> writer = new AegisElementProvider();
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        
+        writer.writeTo(bean, null, null, null, null, null, os);
+        byte[] bytes = os.toByteArray();
+        String xml = new String(bytes, "utf-8");
+                
+        MessageBodyReader<Object> reader = new AegisElementProvider();         
+        byte[] simpleBytes = xml.getBytes("utf-8");
+        Object beanObject = reader.readFrom((Class)Map.class, null, null, 
+                                          null, null, new ByteArrayInputStream(simpleBytes));
+        Map<AegisTestBean, String> map2 = (Map)beanObject;
+        AegisTestBean bean2 = map2.keySet().iterator().next();
+        assertEquals("hovercraft", bean2.getStrValue());
+        assertEquals(Boolean.TRUE, bean2.getBoolValue());
+        
+        
+    }
+    
+    
 }



Mime
View raw message