cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1414318 - in /cxf/branches/2.6.x-fixes: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/core/src/main/java/org/apache/cxf/test/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/ rt/frontend/jaxrs/src/main/ja...
Date Tue, 27 Nov 2012 19:09:44 GMT
Author: dkulp
Date: Tue Nov 27 19:09:40 2012
New Revision: 1414318

URL: http://svn.apache.org/viewvc?rev=1414318&view=rev
Log:
Merged revisions 1413973 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1413973 | dkulp | 2012-11-26 21:22:41 -0500 (Mon, 26 Nov 2012) | 2 lines

  Bunches of fixes that should allow things to work "better" with Saxon.   May need to force
a dom in some cases.

........

Modified:
    cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/xml/XMLSourceTest.java
    cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
    cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
    cxf/branches/2.6.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/utils/WSDLGenerationTester.java
    cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java

Modified: cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Tue Nov 27 19:09:40 2012
@@ -182,14 +182,8 @@ public class SAAJInInterceptor extends A
             }
             final SOAPPart part = soapMessage.getSOAPPart();
             Document node = (Document) message.getContent(Node.class);
-            if (node != part) {
-                if (node == null) {
-                    // replicate 2.1 behavior.
-                    part.setContent(new DOMSource(null));
-                } else {
-                    //part.setContent(new DOMSource(node));
-                    StaxUtils.copy(node, new SAAJStreamWriter(part));
-                }
+            if (node != part && node != null) {
+                StaxUtils.copy(node, new SAAJStreamWriter(part));
             }
             message.setContent(Node.class, soapMessage.getSOAPPart());
 

Modified: cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Tue
Nov 27 19:09:40 2012
@@ -137,17 +137,25 @@ public final class XPathAssert {
                                          Node node, 
                                          Map<String, String> namespaces)
         throws Exception {
-        Node result = (Node)createXPath(namespaces).evaluate(xpath, node, XPathConstants.NODE);
-        if (result == null) {
-            throw new AssertionFailedError("No nodes were found for expression: " 
-                                           + xpath 
-                                           + " in document " 
-                                           + writeNodeToString(node));
+        Object o = createXPath(namespaces).compile(xpath)
+            .evaluate(node, XPathConstants.NODE);
+        if (o instanceof Node) {
+            Node result = (Node)o;
+            String value2 = DOMUtils.getContent(result);
+            Assert.assertEquals(value, value2);
+            return;
+        } else {
+            o = createXPath(namespaces).compile(xpath)
+                .evaluate(node, XPathConstants.STRING);
+            if (o instanceof String) {
+                Assert.assertEquals(value, (String)o);
+                return;
+            }
         }
-
-        String value2 = DOMUtils.getContent(result);
-
-        Assert.assertEquals(value, value2);
+        throw new AssertionFailedError("No nodes were found for expression: " 
+            + xpath 
+            + " in document " 
+            + writeNodeToString(node));
     }
 
     public static void assertNoFault(Node node) throws Exception {
@@ -178,7 +186,6 @@ public final class XPathAssert {
         if (namespaces != null) {
             xpath.setNamespaceContext(new MapNamespaceContext(namespaces));
         }
-
         return xpath;
     }
 

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
Tue Nov 27 19:09:40 2012
@@ -19,7 +19,6 @@
 package org.apache.cxf.jaxrs.ext.xml;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Array;
@@ -28,64 +27,58 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.logging.Logger;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
 import org.xml.sax.InputSource;
 
-import org.apache.cxf.common.i18n.BundleUtils;
-import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
+import org.apache.cxf.staxutils.StaxUtils;
 
 /**
  * Utility class for manipulating XML response using XPath and XSLT
  *
  */
 public class XMLSource {
-    private static final Logger LOG = LogUtils.getL7dLogger(XMLSource.class);
-    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(XMLSource.class);
     
     private static final String XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; 
     
-    private InputStream stream; 
-    private boolean buffering;
-    private boolean markFailed;
+    private InputStream stream;
+    private Document doc; 
     
     public XMLSource(InputStream is) {
         stream = is;
     }
     
     /**
-     * Allows for multiple queries against the same stream
-     * @param enable if set to true then multiple queries will be supported. 
+     * Allows for multiple queries against the same stream by buffering to DOM
      */
-    public void setBuffering(boolean enable) {
-        buffering = enable;
-        if (!stream.markSupported()) {
-            try {
-                stream = IOUtils.loadIntoBAIS(stream);
-            } catch (IOException ex) {
-                LOG.warning(new org.apache.cxf.common.i18n.Message("NO_SOURCE_MARK", BUNDLE).toString());
-            }
+    public void setBuffering() {
+        try {
+            doc = StaxUtils.read(new StreamSource(stream));
+            stream = null;
+        } catch (XMLStreamException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
     }
     
@@ -114,15 +107,19 @@ public class XMLSource {
      */
     @SuppressWarnings("unchecked")
     public <T> T getNode(String expression, Map<String, String> namespaces, Class<T>
cls) {
-        Node node = (Node)evaluate(expression, namespaces, XPathConstants.NODE);
-        if (node == null) {
+        Object obj = evaluate(expression, namespaces, XPathConstants.NODE);
+        if (obj == null) {
             return null;
         }
-        if (cls.isPrimitive() || cls == String.class) {
-            return (T)readPrimitiveValue(node, cls);    
-        } else {
-            return readNode(node, cls);
+        if (obj instanceof Node) {
+            Node node = (Node)obj;
+            if (cls.isPrimitive() || cls == String.class) {
+                return (T)readPrimitiveValue(node, cls);    
+            } else {
+                return readNode(node, cls);
+            }
         }
+        return cls.cast(evaluate(expression, namespaces, XPathConstants.STRING));
     }
     
     /**
@@ -290,7 +287,11 @@ public class XMLSource {
         XPath xpath = XPathFactory.newInstance().newXPath();
         xpath.setNamespaceContext(new NamespaceContextImpl(namespaces));
         try {
-            return xpath.evaluate(expression, getSource(), type);
+            if (stream == null) {
+                return xpath.compile(expression).evaluate(doc, type);
+            } else {
+                return xpath.compile(expression).evaluate(new InputSource(stream), type);
+            }
         } catch (XPathExpressionException ex) {
             throw new IllegalArgumentException("Illegal XPath expression '" + expression
+ "'", ex);
         }
@@ -374,23 +375,5 @@ public class XMLSource {
             throw new RuntimeException(ex);
         }
     }
-    
-    private InputSource getSource() {
-        if (!markFailed && buffering) {
-            try {
-                stream.reset();
-                stream.mark(stream.available());
-            } catch (IOException ex) {
-                LOG.fine(new org.apache.cxf.common.i18n.Message("NO_SOURCE_MARK", BUNDLE).toString());
-                markFailed = true;
-                try {
-                    stream = IOUtils.loadIntoBAIS(stream);
-                } catch (IOException ex2) {
-                    throw new RuntimeException(ex2);
-                }
-            }
-        }
-        
-        return new InputSource(stream);
-    }
+
 }

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Tue Nov 27 19:09:40 2012
@@ -1312,7 +1312,7 @@ public class WadlGenerator implements Re
         }
         ByteArrayInputStream bis = IOUtils.loadIntoBAIS(is);
         XMLSource source = new XMLSource(bis);
-        source.setBuffering(true);
+        source.setBuffering();
         String targetNs = source.getValue("/*/@targetNamespace");
 
         Map<String, String> nsMap =
@@ -1396,7 +1396,7 @@ public class WadlGenerator implements Re
             // we'll need to do the proper schema caching eventually
             for (String s : schemas) {
                 XMLSource source = new XMLSource(new ByteArrayInputStream(s.getBytes()));
-                source.setBuffering(true);
+                source.setBuffering();
                 Map<String, String> locs = getLocationsMap(source, "import", links,
ui);
                 locs.putAll(getLocationsMap(source, "include", links, ui));
                 String actualSchema = !locs.isEmpty() ? transformSchema(s, locs) : s;

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
Tue Nov 27 19:09:40 2012
@@ -43,6 +43,7 @@ public class XPathProvider<T> implements
     private Map<String, String> classExpressions;
     private String globalExpression;
     private String className;
+    private boolean forceDOM;
     private Map<String, String> globalNamespaces = 
         Collections.emptyMap();
     
@@ -53,6 +54,10 @@ public class XPathProvider<T> implements
     public List<String> getConsumeMediaTypes() {
         return consumeMediaTypes;    
     }
+    
+    public void setForceDOM(boolean b) {
+        forceDOM = b;
+    }
 
     public void setExpression(String expr) {
         globalExpression = expr;
@@ -86,6 +91,9 @@ public class XPathProvider<T> implements
             throw new WebApplicationException(500);
         }
         XMLSource source = new XMLSource(is);
+        if (forceDOM) {
+            source.setBuffering();
+        }
         return source.getNode(expression, globalNamespaces, cls);
     }
 

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
Tue Nov 27 19:09:40 2012
@@ -29,6 +29,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.ws.rs.Consumes;
@@ -167,7 +168,14 @@ public class XSLTJaxbProvider<T> extends
             if (t == null && supportJaxbOnly) {
                 return super.unmarshalFromInputStream(unmarshaller, is, mt);
             }
-            XMLFilter filter = factory.newXMLFilter(t);
+            XMLFilter filter = null;
+            try {
+                filter = factory.newXMLFilter(t);
+            } catch (TransformerConfigurationException ex) {
+                TemplatesImpl ti = (TemplatesImpl)t;
+                filter = factory.newXMLFilter(ti.getTemplates());
+                trySettingProperties(filter, ti);
+            }
             SAXSource source = new SAXSource(filter, new InputSource(is));
             if (systemId != null) {
                 source.setSystemId(systemId);
@@ -179,6 +187,25 @@ public class XSLTJaxbProvider<T> extends
         }
     }
     
+    private void trySettingProperties(Object filter, TemplatesImpl ti) {
+        try {
+            //Saxon doesn't allow creating a Filter or Handler from anything other than it's
original 
+            //Templates.  That then requires setting the paramaters after the fact, but there
+            //isn't a standard API for that, so we have to grab the Transformer via reflection
to
+            //set the parameters.
+            Transformer tr = (Transformer)filter.getClass().getMethod("getTransformer").invoke(filter);
+            tr.setURIResolver(ti.resolver);
+            for (Map.Entry<String, Object> entry : ti.transformParameters.entrySet())
{
+                tr.setParameter(entry.getKey(), entry.getValue());
+            }
+            for (Map.Entry<String, String> entry : ti.outProps.entrySet()) {
+                tr.setOutputProperty(entry.getKey(), entry.getValue());
+            }
+        } catch (Exception e) {
+            LOG.log(Level.WARNING, "Could not set properties for transfomer", e);
+        }
+    }
+
     protected Object unmarshalFromReader(Unmarshaller unmarshaller, XMLStreamReader reader,
MediaType mt) 
         throws JAXBException {
         CachedOutputStream out = new CachedOutputStream();
@@ -217,8 +244,14 @@ public class XSLTJaxbProvider<T> extends
             super.marshalToOutputStream(ms, obj, os, mt);
             return;
         }
-        
-        TransformerHandler th = factory.newTransformerHandler(t);
+        TransformerHandler th = null;
+        try {
+            th = factory.newTransformerHandler(t);
+        } catch (TransformerConfigurationException ex) {
+            TemplatesImpl ti = (TemplatesImpl)t;
+            th = factory.newTransformerHandler(ti.getTemplates());
+            this.trySettingProperties(th, ti);
+        }
         Result result = new StreamResult(os);
         if (systemId != null) {
             result.setSystemId(systemId);
@@ -388,6 +421,10 @@ public class XSLTJaxbProvider<T> extends
             this.resolver = resolver;
         }
         
+        public Templates getTemplates() {
+            return templates;
+        }
+
         public void setTransformerParameter(String name, Object value) {
             transformParameters.put(name, value);
         }

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/xml/XMLSourceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/xml/XMLSourceTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/xml/XMLSourceTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/xml/XMLSourceTest.java
Tue Nov 27 19:09:40 2012
@@ -46,17 +46,19 @@ public class XMLSourceTest extends Asser
     public void testNodeStringValue() {
         InputStream is = getClass().getResourceAsStream("/book1.xsd");
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> nsMap = 
             Collections.singletonMap("xs", XmlSchemaConstants.XSD_NAMESPACE_URI);
         String value = xp.getNode("/xs:schema", nsMap, String.class);
         assertFalse(value.contains("<?xml"));
-        assertTrue(value.startsWith("<xs:schema"));
+        assertTrue(value, value.startsWith("<xs:schema"));
     }
     
     @Test
     public void testAttributeValue() {
         InputStream is = new ByteArrayInputStream("<foo><bar attr=\"baz\">barValue</bar></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         assertEquals("baz", xp.getValue("/foo/bar/@attr"));
     }
     
@@ -64,6 +66,7 @@ public class XMLSourceTest extends Asser
     public void testAttributeValueAsNode() {
         InputStream is = new ByteArrayInputStream("<foo><bar attr=\"baz\">barValue</bar></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Node node = xp.getNode("/foo/bar/@attr", Node.class);
         assertNotNull(node);
         assertEquals("baz", node.getTextContent());
@@ -73,6 +76,7 @@ public class XMLSourceTest extends Asser
     public void testNodeTextValue() {
         InputStream is = new ByteArrayInputStream("<foo><bar attr=\"baz\">barValue</bar></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         assertEquals("barValue", xp.getValue("/foo/bar"));
     }
     
@@ -81,6 +85,7 @@ public class XMLSourceTest extends Asser
         InputStream is = new ByteArrayInputStream(
             "<foo><bar attr=\"baz\">bar1</bar><bar attr=\"baz2\">bar2</bar></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         List<String> values = Arrays.asList(xp.getValues("/foo/bar/@attr"));
         assertEquals(2, values.size());
         assertTrue(values.contains("baz"));
@@ -92,6 +97,7 @@ public class XMLSourceTest extends Asser
         InputStream is = new ByteArrayInputStream(
             "<foo><bar attr=\"baz\">bar1</bar><bar attr=\"baz2\">bar2</bar></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         List<String> values = Arrays.asList(xp.getValues("/foo/bar/text()"));
         assertEquals(2, values.size());
         assertTrue(values.contains("bar1"));
@@ -103,6 +109,7 @@ public class XMLSourceTest extends Asser
         InputStream is = new ByteArrayInputStream(
             "<foo><bar attr=\"1\"/><bar attr=\"2\"/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Integer[] values = xp.getNodes("/foo/bar/@attr", Integer.class);
         assertEquals(2, values.length);
         assertTrue(values[0] == 1 && values[1] == 2 || values[0] == 2 &&
values[1] == 1);
@@ -112,6 +119,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodeNoNamespace() {
         InputStream is = new ByteArrayInputStream("<foo><bar/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Bar bar = xp.getNode("/foo/bar", Bar.class);
         assertNotNull(bar);
     }
@@ -120,6 +128,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodeAsElement() {
         InputStream is = new ByteArrayInputStream("<foo><bar/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Element element = xp.getNode("/foo/bar", Element.class);
         assertNotNull(element);
     }
@@ -128,6 +137,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodeAsSource() {
         InputStream is = new ByteArrayInputStream("<foo><bar/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Source element = xp.getNode("/foo/bar", Source.class);
         assertNotNull(element);
     }
@@ -136,6 +146,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodeNull() {
         InputStream is = new ByteArrayInputStream("<foo><bar/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         assertNull(xp.getNode("/foo/bar1", Element.class));
     }
     
@@ -143,6 +154,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodeAsJaxbElement() {
         InputStream is = new ByteArrayInputStream("<foo><bar name=\"foo\"/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Bar3 bar = xp.getNode("/foo/bar", Bar3.class);
         assertNotNull(bar);
         assertEquals("foo", bar.getName());
@@ -153,6 +165,7 @@ public class XMLSourceTest extends Asser
         String data = "<x:foo xmlns:x=\"http://baz\"><x:bar/></x:foo>";

         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://baz");
         Bar2 bar = xp.getNode("/x:foo/x:bar", map, Bar2.class);
@@ -164,7 +177,7 @@ public class XMLSourceTest extends Asser
         String data = "<x:foo xmlns:x=\"http://baz\"><x:bar/></x:foo>";

         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
-        xp.setBuffering(true);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://baz");
         Bar2 bar = xp.getNode("/x:foo/x:bar", map, Bar2.class);
@@ -178,6 +191,7 @@ public class XMLSourceTest extends Asser
         String data = "<z:foo xmlns:z=\"http://baz\"><z:bar/></z:foo>";

         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://baz");
         Bar2 bar = xp.getNode("/x:foo/x:bar", map, Bar2.class);
@@ -189,6 +203,7 @@ public class XMLSourceTest extends Asser
         String data = "<x:foo xmlns:x=\"http://foo\" xmlns:z=\"http://baz\"><z:bar/></x:foo>";

         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://foo");
         map.put("y", "http://baz");
@@ -201,6 +216,7 @@ public class XMLSourceTest extends Asser
         String data = "<foo xmlns=\"http://baz\"><bar/></foo>"; 
         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://baz");
         Bar2 bar = xp.getNode("/x:foo/x:bar", map, Bar2.class);
@@ -211,6 +227,7 @@ public class XMLSourceTest extends Asser
     public void testGetNodesNoNamespace() {
         InputStream is = new ByteArrayInputStream("<foo><bar/><bar/></foo>".getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Bar[] bars = xp.getNodes("/foo/bar", Bar.class);
         assertNotNull(bars);
         assertEquals(2, bars.length);
@@ -222,6 +239,7 @@ public class XMLSourceTest extends Asser
         String data = "<x:foo xmlns:x=\"http://baz\"><x:bar/><x:bar/></x:foo>";

         InputStream is = new ByteArrayInputStream(data.getBytes());
         XMLSource xp = new XMLSource(is);
+        xp.setBuffering();
         Map<String, String> map = new LinkedHashMap<String, String>();
         map.put("x", "http://baz");
         Bar2[] bars = xp.getNodes("/x:foo/x:bar", map, Bar2.class);

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java
Tue Nov 27 19:09:40 2012
@@ -62,6 +62,7 @@ public class XPathProviderTest extends A
         XPathProvider<Book> provider = new XPathProvider<Book>();
         provider.setExpression("/Book");
         provider.setClassName(Book.class.getName());
+        provider.setForceDOM(true);
         Book book = (Book)provider.readFrom(Book.class, null, null, null, null,
                           new ByteArrayInputStream(value.getBytes()));
         assertNotNull(book);

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
Tue Nov 27 19:09:40 2012
@@ -521,7 +521,7 @@ public class JAXRSClientServerBookTest e
         InputStream is = (InputStream)r.getEntity();
         assertNotNull(is);
         XMLSource source = new XMLSource(is);
-        source.setBuffering(true);
+        source.setBuffering();
         assertEquals(124L, Long.parseLong(source.getValue("Book/id")));
         assertEquals("CXF rocks", source.getValue("Book/name"));
     }

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
Tue Nov 27 19:09:40 2012
@@ -204,6 +204,7 @@ public class JAXRSClientServerSpringBook
         WebClient wc = WebClient.create(endpointAddress);
         wc.accept("application/xhtml+xml").path(666).matrix("name2", 2).query("name", "Action
- ");
         XMLSource source = wc.get(XMLSource.class);
+        source.setBuffering();
         Map<String, String> namespaces = new HashMap<String, String>();
         namespaces.put("xhtml", "http://www.w3.org/1999/xhtml");
         Book2 b = source.getNode("xhtml:html/xhtml:body/xhtml:ul/xhtml:Book", namespaces,
Book2.class);

Modified: cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
Tue Nov 27 19:09:40 2012
@@ -392,7 +392,7 @@ public class JAXRSSoapBookTest extends A
         WebClient client = WebClient.create(baseAddress);
         client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
         XMLSource source = client.get(XMLSource.class);
-        source.setBuffering(true);
+        source.setBuffering();
         Book b = source.getNode("/Book", Book.class);
         assertEquals(123, b.getId());
         assertEquals("CXF in Action", b.getName());

Modified: cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
(original)
+++ cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerRPCLitTest.java
Tue Nov 27 19:09:40 2012
@@ -55,6 +55,7 @@ import org.apache.cxf.binding.soap.Soap1
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.W3CNamespaceContext;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -141,7 +142,7 @@ public class ClientServerRPCLitTest exte
         Source resp = disp.invoke(source);
         assertNotNull(resp);
         
-        Node nd = XMLUtils.fromSource(resp);
+        Node nd = StaxUtils.read(resp);
         if (nd instanceof Document) {
             nd = ((Document)nd).getDocumentElement();
         }

Modified: cxf/branches/2.6.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/utils/WSDLGenerationTester.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/utils/WSDLGenerationTester.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/utils/WSDLGenerationTester.java
(original)
+++ cxf/branches/2.6.x-fixes/tools/corba/src/test/java/org/apache/cxf/tools/corba/utils/WSDLGenerationTester.java
Tue Nov 27 19:09:40 2012
@@ -131,7 +131,7 @@ public class WSDLGenerationTester {
     private void compareCharacters(QName elName, XMLStreamReader orig, XMLStreamReader actual)
         throws Exception {
         Assert.assertEquals("Element Characters not matched " + elName,
-                            orig.getText(), actual.getText());
+                            orig.getText().trim(), actual.getText().trim());
     }
 
     public File writeDefinition(File targetDir, File defnFile) throws Exception {

Modified: cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?rev=1414318&r1=1414317&r2=1414318&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
(original)
+++ cxf/branches/2.6.x-fixes/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Tue Nov 27 19:09:40 2012
@@ -329,8 +329,8 @@ public class JaxwsServiceBuilderTest ext
 
         s = IOUtils.toString(new FileInputStream(logical));
 
-        assertTrue(s.indexOf("<import namespace=\"http://foo.com/HelloWorld\" "
-                             + "schemaLocation=\"HelloService_schema1.xsd\"/>") != -1);
+        assertTrue(s.indexOf("<import namespace=\"http://foo.com/HelloWorld\"") != -1);
+        assertTrue(s.indexOf("schemaLocation=\"HelloService_schema1.xsd\"/>") != -1);
         assertTrue(s.indexOf("targetNamespace=\"http://foo.com/HelloWorld\"") != -1);
 
         s = IOUtils.toString(new FileInputStream(schema));



Mime
View raw message