cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1549542 - in /cxf/branches/2.6.x-fixes: ./ api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
Date Mon, 09 Dec 2013 11:16:31 GMT
Author: sergeyb
Date: Mon Dec  9 11:16:31 2013
New Revision: 1549542

URL: http://svn.apache.org/r1549542
Log:
Merged revisions 1549541 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1549541 | sergeyb | 2013-12-09 11:12:02 +0000 (Mon, 09 Dec 2013) | 13 lines
  
  Merged revisions 1549537,1549539 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1549537 | sergeyb | 2013-12-09 10:45:46 +0000 (Mon, 09 Dec 2013) | 1 line
    
    Blocking namespaces in writeAttribute methods in IgnoreNamespaceWriter
  ........
    r1549539 | sergeyb | 2013-12-09 10:58:16 +0000 (Mon, 09 Dec 2013) | 1 line
    
    [CXF-5445] Adding a JSONProvider test
  ........
................

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1549541
  Merged /cxf/trunk:r1549537-1549539

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

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java?rev=1549542&r1=1549541&r2=1549542&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java
(original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/transform/IgnoreNamespacesWriter.java
Mon Dec  9 11:16:31 2013
@@ -29,6 +29,15 @@ public class IgnoreNamespacesWriter exte
         super(writer);
     }
 
+    public void writeAttribute(String prefix, String uri, 
+                               String local, String value) throws XMLStreamException {
+        super.writeAttribute(local, value);
+    }
+
+    public void writeAttribute(String uri, String local, String value) throws XMLStreamException
{
+        super.writeAttribute(local, value);
+    }
+    
     public void writeStartElement(String prefix, String local, String uri) throws XMLStreamException
{
         super.writeStartElement(local);
     }

Modified: cxf/branches/2.6.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.6.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java?rev=1549542&r1=1549541&r2=1549542&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/json/JSONProviderTest.java
Mon Dec  9 11:16:31 2013
@@ -685,6 +685,21 @@ public class JSONProviderTest extends As
     }
     
     @Test
+    public void testIgnoreNamespaces() throws Exception {
+        JSONProvider<TestBean> p = new JSONProvider<TestBean>();
+        p.setIgnoreNamespaces(true);
+        TestBean bean = new TestBean();
+        bean.setName("a");
+        bean.setId("b");
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        p.writeTo(bean, TestBean.class, TestBean.class, new Annotation[0], 
+                  MediaType.APPLICATION_JSON_TYPE, new MetadataMap<String, Object>(),
os);
+        String s = os.toString();
+        assertEquals("{\"testBean\":{\"@id\":\"b\",\"name\":\"a\"}}", s);
+        
+    }
+    
+    @Test
     public void testWriteUnqualifiedCollection() throws Exception {
         JSONProvider<List<Book>> p = new JSONProvider<List<Book>>();
         List<Book> books = new ArrayList<Book>();
@@ -1632,4 +1647,26 @@ public class JSONProviderTest extends As
             }
         }
     }
+    
+    @XmlRootElement(namespace = "http://testbean")
+    public static class TestBean {
+        private String name;
+        private String id;
+        public TestBean() {
+            
+        }
+        public String getName() {
+            return name;
+        }
+        public void setName(String name) {
+            this.name = name;
+        }
+        public String getId() {
+            return id;
+        }
+        @XmlAttribute(namespace = "http://testbean")
+        public void setId(String id) {
+            this.id = id;
+        }
+    }    
 }



Mime
View raw message