cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1569058 - in /cxf/branches/2.7.x-fixes: ./ rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/resources/jaxb/Book2NoRootElement.java
Date Mon, 17 Feb 2014 17:03:59 GMT
Author: sergeyb
Date: Mon Feb 17 17:03:59 2014
New Revision: 1569058

URL: http://svn.apache.org/r1569058
Log:
Merged revisions 1569056 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1569056 | sergeyb | 2014-02-17 16:57:09 +0000 (Mon, 17 Feb 2014) | 1 line
  
  Adding few more tests to JSONProviderTest
........

Added:
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/resources/jaxb/Book2NoRootElement.java
      - copied unchanged from r1569056, cxf/trunk/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/resources/jaxb/Book2NoRootElement.java
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1569056

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java?rev=1569058&r1=1569057&r2=1569058&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
Mon Feb 17 17:03:59 2014
@@ -73,6 +73,7 @@ import org.apache.cxf.jaxrs.resources.Ta
 import org.apache.cxf.jaxrs.resources.TagVO2;
 import org.apache.cxf.jaxrs.resources.Tags;
 import org.apache.cxf.jaxrs.resources.jaxb.Book2;
+import org.apache.cxf.jaxrs.resources.jaxb.Book2NoRootElement;
 import org.apache.cxf.staxutils.DelegatingXMLStreamWriter;
 import org.apache.cxf.staxutils.StaxUtils;
 
@@ -508,6 +509,40 @@ public class JSONProviderTest extends As
     }
     
     @Test
+    public void testIgnoreNamespacesPackageInfo() throws Exception {
+        JSONProvider<Book2> p = new JSONProvider<Book2>();
+        p.setIgnoreNamespaces(true);
+        Book2 book = new Book2(123);
+        book.setName("CXF");
+        
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        
+        p.writeTo(book, Book2.class, Book2.class, Book2.class.getAnnotations(), 
+                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(),
os);
+        
+        String s = os.toString();
+        assertEquals("{\"thebook2\":{\"id\":123,\"name\":\"CXF\"}}", s);
+        
+    }
+    
+    @Test
+    public void testIgnoreNamespacesPackageInfo2() throws Exception {
+        JSONProvider<Book2NoRootElement> p = new JSONProvider<Book2NoRootElement>();
+        p.setMarshallAsJaxbElement(true);
+        p.setIgnoreNamespaces(true);
+        Book2NoRootElement book = new Book2NoRootElement(123);
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        
+        p.writeTo(book, Book2NoRootElement.class, Book2NoRootElement.class, 
+                  Book2NoRootElement.class.getAnnotations(), 
+                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(),
os);
+        
+        String s = os.toString();
+        assertEquals("{\"book2\":{\"id\":123}}", s);
+        
+    }
+    
+    @Test
     public void testCopyReaderToDocument() throws Exception {
         String s = "{\"tagVO\":{\"group\":\"b\",\"name\":\"a\"}}";
         



Mime
View raw message