Author: darran.lofthouse(a)jboss.com
Date: 2009-06-19 09:17:56 -0400 (Fri, 19 Jun 2009)
New Revision: 10205
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2346.xml
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties
Log:
[JBPAPP-2108] Issue with SAAJ API: SOAPBody.getElementsByTagNameNS() is non-recursive.
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-06-19
12:02:46 UTC (rev 10204)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-06-19
13:17:56 UTC (rev 10205)
@@ -740,7 +740,7 @@
public NodeList getElementsByTagName(String name)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, name));
+ return new NodeListImpl(DOMUtils.getChildElements(this, name, true));
}
public String getAttributeNS(String namespaceURI, String localName)
@@ -766,7 +766,7 @@
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI,
localName)));
+ return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI,
localName), true));
}
public TypeInfo getSchemaTypeInfo()
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-06-19
12:02:46 UTC (rev 10204)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-06-19
13:17:56 UTC (rev 10205)
@@ -22,8 +22,12 @@
package org.jboss.test.ws.common.soap;
import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
import java.util.Iterator;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
@@ -33,6 +37,9 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.wsf.test.JBossWSTest;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* Test the SOAPElement
@@ -89,6 +96,33 @@
SOAPElement se2 = (SOAPElement)body.getChildElements().next();
assertEquals(se, se2);
}
+
+ //JBWS-2346
+ public void testGetElementByTagNameNS() throws Exception
+ {
+ InputStream is = new
File("resources/common/soap/jbws2346.xml").toURL().openStream();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document doc = db.parse(is);
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage msg = factory.createMessage();
+ msg.getSOAPBody().addDocument(doc);
+ SOAPBody body = msg.getSOAPBody();
+ NodeList list = body.getElementsByTagNameNS("http://org.jboss.ws/testNS",
"elementA");
+ assertEquals(1, list.getLength());
+ list = body.getElementsByTagNameNS("http://org.jboss.ws/testNS",
"elementC");
+ assertEquals(2, list.getLength());
+ list = body.getElementsByTagNameNS("http://org.jboss.ws/testNS",
"String_1");
+ StringBuilder sb = new StringBuilder();
+ for (int i=0; i<list.getLength(); i++)
+ {
+ Node n = list.item(i);
+ sb.append(n.getFirstChild().getNodeValue());
+ sb.append(" ");
+ }
+ assertEquals("Strawberry Apple Banana Orange Raspberry ",
sb.toString());
+ }
//
http://jira.jboss.com/jira/browse/JBWS-773
public void testGetNamespaceURI() throws Exception
Copied:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2346.xml
(from rev 8575,
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2346.xml)
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2346.xml
(rev 0)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2346.xml 2009-06-19
13:17:56 UTC (rev 10205)
@@ -0,0 +1,15 @@
+<ns1:elementA xmlns:ns1='http://org.jboss.ws/testNS'>
+ <ns1:String_1>Strawberry</ns1:String_1>
+ <ns1:elementB xmlns:ns1='http://org.jboss.ws/testNS'>
+ <ns1:String_1>Apple</ns1:String_1>
+ <ns1:elementC xmlns:ns1='http://org.jboss.ws/testNS'>
+ <ns1:String_1>Banana</ns1:String_1>
+ </ns1:elementC>
+ </ns1:elementB>
+ <ns1:elementC xmlns:ns1='http://org.jboss.ws/testNS'>
+ <ns1:String_1>Orange</ns1:String_1>
+ </ns1:elementC>
+ <ns2:elementA xmlns:ns1='http://org.jboss.ws/testNS'
xmlns:ns2='http://org.jboss.ws/testNS2'>
+ <ns1:String_1>Raspberry</ns1:String_1>
+ </ns2:elementA>
+</ns1:elementA>
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties 2009-06-19
12:02:46 UTC (rev 10204)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties 2009-06-19
13:17:56 UTC (rev 10205)
@@ -25,9 +25,9 @@
wscommons-policy=1.0
# Dependend integration projects
-jbossws-spi=1.0.0.GA_CP-SNAPSHOT
+jbossws-spi=1.0.0.GA_CP02-brew
jbossws-common=1.0.0.GA_CP-SNAPSHOT
-jbossws-framework=2.0.1.GA_CP-SNAPSHOT
+jbossws-framework=2.0.1.GA_CP04-brew
jbossws-jboss40=2.0.1.GA
jbossws-jboss42=2.0.1.GA_CP01