cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r797583 - in /cxf/trunk/rt/frontend/jaxrs/src: main/java/org/apache/cxf/jaxrs/provider/ test/java/org/apache/cxf/jaxrs/provider/
Date Fri, 24 Jul 2009 17:59:32 GMT
Author: dkulp
Date: Fri Jul 24 17:59:31 2009
New Revision: 797583

URL: http://svn.apache.org/viewvc?rev=797583&view=rev
Log:
Fix test failures with latest JAXB and test interaction issues due to
state carrying over from test to test

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

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java?rev=797583&r1=797582&r2=797583&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
Fri Jul 24 17:59:31 2009
@@ -41,6 +41,7 @@
     implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
     
     private static Map<Class<?>, AegisContext> classContexts = new WeakHashMap<Class<?>,
AegisContext>();
+    
     protected boolean writeXsiType = true;
     protected boolean readXsiType = true;
     @Context 
@@ -130,7 +131,7 @@
         return true;
     }
     
-    void clearContexts() {
+    static void clearContexts() {
         classContexts.clear();
     }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=797583&r1=797582&r2=797583&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
Fri Jul 24 17:59:31 2009
@@ -404,6 +404,8 @@
                 lastText += text;
             } else if (!isMixed) {
                 super.writeCharacters(text);                                
+            } else {
+                lastText = text;
             }
         }
         
@@ -435,8 +437,8 @@
             super.writeStartElement(local);
         }
         public void writeEndElement() throws XMLStreamException {
-            if (lastText != null && !isMixed) {
-                super.writeCharacters(lastText);                
+            if (lastText != null && (!isMixed || !StringUtils.isEmpty(lastText.trim())))
{
+                super.writeCharacters(lastText.trim());                
             }
             super.writeEndElement();
             isMixed = mixed.get(0);

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java?rev=797583&r1=797582&r2=797583&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
Fri Jul 24 17:59:31 2009
@@ -107,7 +107,7 @@
     
     private void doTestWriteTo(String data, boolean writeXsi, boolean setNsMap) throws Exception
{
         AegisJSONProvider p = new AegisJSONProvider();
-        p.clearContexts();
+        AbstractAegisProvider.clearContexts();
         p.setWriteXsiType(writeXsi);
         if (setNsMap) {
             Map<String, String> namespaceMap = new HashMap<String, String>();
@@ -131,7 +131,7 @@
     @Test
     public void testManyTags() throws Exception {
         AegisJSONProvider p = new AegisJSONProvider();
-        p.clearContexts();
+        AbstractAegisProvider.clearContexts();
         p.setWriteXsiType(false);
         p.setSerializeAsArray(true);
         

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=797583&r1=797582&r2=797583&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
Fri Jul 24 17:59:31 2009
@@ -31,6 +31,7 @@
 
 import org.apache.cxf.jaxrs.fortest.AegisTestBean;
 
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -43,6 +44,11 @@
             + "<ns1:boolValue>true</ns1:boolValue><ns1:strValue>hovercraft</ns1:strValue>"
             + "</ns1:AegisTestBean>";
     
+    @After
+    public void clearCache() {
+        AbstractAegisProvider.clearContexts();
+    }
+    
     @Test
     public void testIsWriteable() {
         MessageBodyWriter<Object> p = new AegisElementProvider();



Mime
View raw message