JBossWS SVN: r10367 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP/src: test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 13:07:25 -0400 (Mon, 20 Jul 2009)
New Revision: 10367
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2703.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
Log:
[JBPAPP-2279] Node.getElementsByTagName() only works with name local part.
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-07-20 16:59:59 UTC (rev 10366)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 17:07:25 UTC (rev 10367)
@@ -741,7 +741,20 @@
public NodeList getElementsByTagName(String name)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, name, true));
+ Iterator nodes = DOMUtils.getChildElements(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ while (nodes.hasNext())
+ {
+ Element current = (Element)nodes.next();
+ if (current.getTagName().equals(name))
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
public String getAttributeNS(String namespaceURI, String localName)
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-07-20 16:59:59 UTC (rev 10366)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 17:07:25 UTC (rev 10367)
@@ -159,11 +159,10 @@
// JBWS-2704
public void testGetElementByTagNameNS_Wildcard() throws Exception
{
- InputStream is = new File("resources/common/soap/bws2704.xml").toURL().openStream();
+ InputStream is = new File("resources/common/soap/jbws2704.xml").toURL().openStream();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage(null, is);
SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
-
NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
assertEquals("String_1 nodes", 2, nodes.getLength());
assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
@@ -191,10 +190,30 @@
nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+ // JBWS-2703
+ public void testGetElementByTagName() throws Exception
+ {
+ InputStream is = new File("resources/common/soap/jbws2703.xml").toURL().openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+
+ NodeList nodeList;
+ nodeList = envelope.getElementsByTagName("soapenv:Header");
+ assertEquals("soapenv:Header nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("soapenv:Body");
+ assertEquals("soapenv:Body nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("jbw:echo");
+ assertEquals("jbw:echo nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("arg0");
+ assertEquals("arg0 nodes.", 2, nodeList.getLength());
+ assertEquals("arg0 text content", "111", nodeList.item(0).getTextContent());
+ assertEquals("arg0 text content", "222", nodeList.item(1).getTextContent());
}
-
// 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/jbws2703.xml (from rev 10364, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2703.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2703.xml 2009-07-20 17:07:25 UTC (rev 10367)
@@ -0,0 +1,13 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2703'>
+ <soapenv:Header>
+ <jbw:myvalue>
+ <arg0>111</arg0>
+ </jbw:myvalue>
+ </soapenv:Header>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>222</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
+
15 years, 5 months
JBossWS SVN: r10366 - in stack/native/branches/jbossws-native-3.1.2/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 12:59:59 -0400 (Mon, 20 Jul 2009)
New Revision: 10366
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
Log:
[JBPAPP-2279] Node.getElementsByTagName() only works with name local part.
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:50:51 UTC (rev 10365)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:59:59 UTC (rev 10366)
@@ -739,7 +739,19 @@
public NodeList getElementsByTagName(String name)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, name, true));
+ List<Element> nodes = DOMUtils.getChildElementsAsList(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ for (Element current : nodes)
+ {
+ if (current.getTagName().equals(name))
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
public String getAttributeNS(String namespaceURI, String localName)
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:50:51 UTC (rev 10365)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:59:59 UTC (rev 10366)
@@ -131,7 +131,6 @@
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage(null, is);
SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
-
NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
assertEquals("String_1 nodes", 2, nodes.getLength());
assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
@@ -159,9 +158,29 @@
nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+ // JBWS-2703
+ public void testGetElementByTagName() throws Exception
+ {
+ InputStream is = getResourceURL("common/soap/jbws2703.xml").openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+
+ NodeList nodeList;
+ nodeList = envelope.getElementsByTagName("soapenv:Header");
+ assertEquals("soapenv:Header nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("soapenv:Body");
+ assertEquals("soapenv:Body nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("jbw:echo");
+ assertEquals("jbw:echo nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("arg0");
+ assertEquals("arg0 nodes.", 2, nodeList.getLength());
+ assertEquals("arg0 text content", "111", nodeList.item(0).getTextContent());
+ assertEquals("arg0 text content", "222", nodeList.item(1).getTextContent());
}
-
// http://jira.jboss.com/jira/browse/JBWS-773
public void testGetNamespaceURI() throws Exception
{
Copied: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml (from rev 10364, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml)
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml 2009-07-20 16:59:59 UTC (rev 10366)
@@ -0,0 +1,13 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2703'>
+ <soapenv:Header>
+ <jbw:myvalue>
+ <arg0>111</arg0>
+ </jbw:myvalue>
+ </soapenv:Header>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>222</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
+
15 years, 5 months
JBossWS SVN: r10365 - stack/native/branches/dlofthouse.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 12:50:51 -0400 (Mon, 20 Jul 2009)
New Revision: 10365
Removed:
stack/native/branches/dlofthouse/JBWS-2703/
Log:
No longer required
15 years, 5 months
JBossWS SVN: r10364 - in stack/native/trunk/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 12:50:16 -0400 (Mon, 20 Jul 2009)
New Revision: 10364
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
Log:
[JBWS-2703] Node.getElementsByTagName only works with name local part.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:25:15 UTC (rev 10363)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:50:16 UTC (rev 10364)
@@ -739,7 +739,19 @@
public NodeList getElementsByTagName(String name)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, name, true));
+ List<Element> nodes = DOMUtils.getChildElementsAsList(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ for (Element current : nodes)
+ {
+ if (current.getTagName().equals(name))
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
public String getAttributeNS(String namespaceURI, String localName)
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:25:15 UTC (rev 10363)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:50:16 UTC (rev 10364)
@@ -131,7 +131,6 @@
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage(null, is);
SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
-
NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
assertEquals("String_1 nodes", 2, nodes.getLength());
assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
@@ -159,9 +158,29 @@
nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+ // JBWS-2703
+ public void testGetElementByTagName() throws Exception
+ {
+ InputStream is = getResourceURL("common/soap/jbws2703.xml").openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+
+ NodeList nodeList;
+ nodeList = envelope.getElementsByTagName("soapenv:Header");
+ assertEquals("soapenv:Header nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("soapenv:Body");
+ assertEquals("soapenv:Body nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("jbw:echo");
+ assertEquals("jbw:echo nodes.", 1, nodeList.getLength());
+ nodeList = envelope.getElementsByTagName("arg0");
+ assertEquals("arg0 nodes.", 2, nodeList.getLength());
+ assertEquals("arg0 text content", "111", nodeList.item(0).getTextContent());
+ assertEquals("arg0 text content", "222", nodeList.item(1).getTextContent());
}
-
// http://jira.jboss.com/jira/browse/JBWS-773
public void testGetNamespaceURI() throws Exception
{
Copied: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml (from rev 10340, stack/native/branches/dlofthouse/JBWS-2703/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml)
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2703.xml 2009-07-20 16:50:16 UTC (rev 10364)
@@ -0,0 +1,13 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2703'>
+ <soapenv:Header>
+ <jbw:myvalue>
+ <arg0>111</arg0>
+ </jbw:myvalue>
+ </soapenv:Header>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>222</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
+
15 years, 5 months
JBossWS SVN: r10363 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP/src: test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 12:25:15 -0400 (Mon, 20 Jul 2009)
New Revision: 10363
Added:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2704.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
Log:
[JBPAPP-2280] Element.getElementsByTagNameNS should support wildcards for namespace, local name or both
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-07-20 16:06:04 UTC (rev 10362)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:25:15 UTC (rev 10363)
@@ -27,6 +27,7 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.namespace.QName;
@@ -766,7 +767,33 @@
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI, localName), true));
+ Iterator nodes = DOMUtils.getChildElements(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ while (nodes.hasNext())
+ {
+ Element current = (Element)nodes.next();
+ boolean namespaceMatch = false;
+ boolean localNameMatch = false;
+
+ if ("*".equals(namespaceURI) || ((namespaceURI != null) && namespaceURI.equals(current.getNamespaceURI())))
+ {
+ namespaceMatch = true;
+ }
+
+ if ("*".equals(localName) || ((localName != null) && localName.equals(current.getLocalName())))
+ {
+ localNameMatch = true;
+ }
+
+ if (namespaceMatch == true && localNameMatch == true)
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
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-07-20 16:06:04 UTC (rev 10362)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:25:15 UTC (rev 10363)
@@ -156,6 +156,45 @@
assertEquals("Expected value", "123", value);
}
+ // JBWS-2704
+ public void testGetElementByTagNameNS_Wildcard() throws Exception
+ {
+ InputStream is = new File("resources/common/soap/bws2704.xml").toURL().openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+
+ NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
+ assertEquals("String_1 nodes", 2, nodes.getLength());
+ assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("String_1(1) text content", "Value_2", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("*", "String_2");
+ assertEquals("String_2 nodes", 2, nodes.getLength());
+ assertEquals("String_2(0) text content", "Value_3", nodes.item(0).getTextContent());
+ assertEquals("String_2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "*");
+ assertEquals("http://org.jboss.ws/testNS1 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS1(1) text content", "Value_3", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "*");
+ assertEquals("http://org.jboss.ws/testNS2 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2(0) text content", "Value_2", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "String_1");
+ assertEquals("http://org.jboss.ws/testNS1 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1 String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
+ assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+
+
// 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/jbws2704.xml (from rev 10360, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml)
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2704.xml (rev 0)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/resources/common/soap/jbws2704.xml 2009-07-20 16:25:15 UTC (rev 10363)
@@ -0,0 +1,11 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2704'>
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo xmlns:ns1='http://org.jboss.ws/testNS1' xmlns:ns2='http://org.jboss.ws/testNS2'>
+ <ns1:String_1>Value_1</ns1:String_1>
+ <ns2:String_1>Value_2</ns2:String_1>
+ <ns1:String_2>Value_3</ns1:String_2>
+ <ns2:String_2>Value_4</ns2:String_2>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
15 years, 5 months
JBossWS SVN: r10362 - in stack/native/branches/jbossws-native-3.1.2/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 12:06:04 -0400 (Mon, 20 Jul 2009)
New Revision: 10362
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
Log:
[JBPAPP-2280] Element.getElementsByTagNameNS should support wildcards for namespace, local name or both.
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 15:30:59 UTC (rev 10361)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 16:06:04 UTC (rev 10362)
@@ -25,6 +25,7 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.namespace.QName;
@@ -764,7 +765,32 @@
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI, localName), true));
+ List<Element> nodes = DOMUtils.getChildElementsAsList(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ for (Element current : nodes)
+ {
+ boolean namespaceMatch = false;
+ boolean localNameMatch = false;
+
+ if ("*".equals(namespaceURI) || ((namespaceURI != null) && namespaceURI.equals(current.getNamespaceURI())))
+ {
+ namespaceMatch = true;
+ }
+
+ if ("*".equals(localName) || ((localName != null) && localName.equals(current.getLocalName())))
+ {
+ localNameMatch = true;
+ }
+
+ if (namespaceMatch == true && localNameMatch == true)
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
public TypeInfo getSchemaTypeInfo()
Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 15:30:59 UTC (rev 10361)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 16:06:04 UTC (rev 10362)
@@ -123,7 +123,45 @@
}
assertEquals("Strawberry Apple Banana Orange Raspberry ", sb.toString());
}
+
+ // JBWS-2704
+ public void testGetElementByTagNameNS_Wildcard() throws Exception
+ {
+ InputStream is = getResourceURL("common/soap/jbws2704.xml").openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+ NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
+ assertEquals("String_1 nodes", 2, nodes.getLength());
+ assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("String_1(1) text content", "Value_2", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("*", "String_2");
+ assertEquals("String_2 nodes", 2, nodes.getLength());
+ assertEquals("String_2(0) text content", "Value_3", nodes.item(0).getTextContent());
+ assertEquals("String_2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "*");
+ assertEquals("http://org.jboss.ws/testNS1 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS1(1) text content", "Value_3", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "*");
+ assertEquals("http://org.jboss.ws/testNS2 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2(0) text content", "Value_2", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "String_1");
+ assertEquals("http://org.jboss.ws/testNS1 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1 String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
+ assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+
// http://jira.jboss.com/jira/browse/JBWS-773
public void testGetNamespaceURI() throws Exception
{
Copied: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml (from rev 10360, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml)
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml 2009-07-20 16:06:04 UTC (rev 10362)
@@ -0,0 +1,11 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2704'>
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo xmlns:ns1='http://org.jboss.ws/testNS1' xmlns:ns2='http://org.jboss.ws/testNS2'>
+ <ns1:String_1>Value_1</ns1:String_1>
+ <ns2:String_1>Value_2</ns2:String_1>
+ <ns1:String_2>Value_3</ns1:String_2>
+ <ns2:String_2>Value_4</ns2:String_2>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
15 years, 5 months
JBossWS SVN: r10361 - stack/native/branches/dlofthouse.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 11:30:59 -0400 (Mon, 20 Jul 2009)
New Revision: 10361
Removed:
stack/native/branches/dlofthouse/JBWS-2704/
Log:
No longer required.
15 years, 5 months
JBossWS SVN: r10360 - in stack/native/trunk/modules: testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 11:30:11 -0400 (Mon, 20 Jul 2009)
New Revision: 10360
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
Log:
[JBWS-2704] Element.getElementsByTagNameNS should support wildcards for namespace, local name or both.
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 14:41:34 UTC (rev 10359)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/SOAPElementImpl.java 2009-07-20 15:30:11 UTC (rev 10360)
@@ -25,6 +25,7 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.namespace.QName;
@@ -764,7 +765,32 @@
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
{
- return new NodeListImpl(DOMUtils.getChildElements(this, new QName(namespaceURI, localName), true));
+ List<Element> nodes = DOMUtils.getChildElementsAsList(this, (QName)null, true);
+
+ List filtered = new LinkedList();
+
+ for (Element current : nodes)
+ {
+ boolean namespaceMatch = false;
+ boolean localNameMatch = false;
+
+ if ("*".equals(namespaceURI) || ((namespaceURI != null) && namespaceURI.equals(current.getNamespaceURI())))
+ {
+ namespaceMatch = true;
+ }
+
+ if ("*".equals(localName) || ((localName != null) && localName.equals(current.getLocalName())))
+ {
+ localNameMatch = true;
+ }
+
+ if (namespaceMatch == true && localNameMatch == true)
+ {
+ filtered.add(current);
+ }
+ }
+
+ return new NodeListImpl(filtered.iterator());
}
public TypeInfo getSchemaTypeInfo()
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 14:41:34 UTC (rev 10359)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/soap/SOAPElementTestCase.java 2009-07-20 15:30:11 UTC (rev 10360)
@@ -123,7 +123,45 @@
}
assertEquals("Strawberry Apple Banana Orange Raspberry ", sb.toString());
}
+
+ // JBWS-2704
+ public void testGetElementByTagNameNS_Wildcard() throws Exception
+ {
+ InputStream is = getResourceURL("common/soap/jbws2704.xml").openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
+ NodeList nodes = envelope.getElementsByTagNameNS("*", "String_1");
+ assertEquals("String_1 nodes", 2, nodes.getLength());
+ assertEquals("String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("String_1(1) text content", "Value_2", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("*", "String_2");
+ assertEquals("String_2 nodes", 2, nodes.getLength());
+ assertEquals("String_2(0) text content", "Value_3", nodes.item(0).getTextContent());
+ assertEquals("String_2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "*");
+ assertEquals("http://org.jboss.ws/testNS1 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1(0) text content", "Value_1", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS1(1) text content", "Value_3", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "*");
+ assertEquals("http://org.jboss.ws/testNS2 nodes", 2, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2(0) text content", "Value_2", nodes.item(0).getTextContent());
+ assertEquals("http://org.jboss.ws/testNS2(1) text content", "Value_4", nodes.item(1).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS1", "String_1");
+ assertEquals("http://org.jboss.ws/testNS1 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS1 String_1(0) text content", "Value_1", nodes.item(0).getTextContent());
+
+ nodes = envelope.getElementsByTagNameNS("http://org.jboss.ws/testNS2", "String_1");
+ assertEquals("http://org.jboss.ws/testNS2 String_1 nodes", 1, nodes.getLength());
+ assertEquals("http://org.jboss.ws/testNS2 String_1(0) text content", "Value_2", nodes.item(0).getTextContent());
+ }
+
+
// http://jira.jboss.com/jira/browse/JBWS-773
public void testGetNamespaceURI() throws Exception
{
Copied: stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml (from rev 10337, stack/native/branches/dlofthouse/JBWS-2704/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml)
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml (rev 0)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2704.xml 2009-07-20 15:30:11 UTC (rev 10360)
@@ -0,0 +1,11 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2704'>
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo xmlns:ns1='http://org.jboss.ws/testNS1' xmlns:ns2='http://org.jboss.ws/testNS2'>
+ <ns1:String_1>Value_1</ns1:String_1>
+ <ns2:String_1>Value_2</ns2:String_1>
+ <ns1:String_2>Value_3</ns1:String_2>
+ <ns2:String_2>Value_4</ns2:String_2>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
15 years, 5 months
JBossWS SVN: r10359 - stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-07-20 10:41:34 -0400 (Mon, 20 Jul 2009)
New Revision: 10359
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
Log:
[JBPAPP-2105] Concurrency issues where multiple threads create Port using Service Simultaneously.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-07-20 13:53:37 UTC (rev 10358)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2009-07-20 14:41:34 UTC (rev 10359)
@@ -175,7 +175,7 @@
// com/sun/ts/tests/jaxws/api/javax_xml_ws/Service#GetPort1NegTest1WithWsdl
EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName);
- if (serviceMetaData.getEndpoints().size() > 0 && epMetaData == null)
+ if (epMetaData == null && serviceMetaData.getEndpoints().size() > 0)
throw new WebServiceException("Cannot get port meta data for: " + portName);
// This is the case when the service could not be created from wsdl
@@ -258,9 +258,15 @@
// Adjust the endpoint meta data according to the annotations
if (annotatedPorts.contains(portName) == false)
{
- JAXWSClientMetaDataBuilder metaDataBuilder = new JAXWSClientMetaDataBuilder();
- metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass);
- annotatedPorts.add(portName);
+ synchronized (epMetaData)
+ {
+ if (annotatedPorts.contains(portName) == false)
+ {
+ JAXWSClientMetaDataBuilder metaDataBuilder = new JAXWSClientMetaDataBuilder();
+ metaDataBuilder.rebuildEndpointMetaData(epMetaData, seiClass);
+ annotatedPorts.add(portName);
+ }
+ }
}
return (T)createProxy(seiClass, epMetaData);
15 years, 5 months