JBossWS SVN: r10271 - 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-01 06:06:19 -0400 (Wed, 01 Jul 2009)
New Revision: 10271
Added:
stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2693.xml
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.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-2185] Implement Node.setTextContent().
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2009-07-01 07:43:41 UTC (rev 10270)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/NodeImpl.java 2009-07-01 10:06:19 UTC (rev 10271)
@@ -657,8 +657,17 @@
public void setTextContent(String textContent) throws DOMException
{
- // FIXME setTextContent
- throw new NotImplementedException("setTextContent");
+ NodeList nodes = getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++)
+ {
+ removeChild((Node)nodes.item(i));
+ }
+
+ if (textContent != null && textContent.length() > 0)
+ {
+ Node node = domNode.getOwnerDocument().createTextNode(textContent);
+ appendChild(node);
+ }
}
public Object setUserData(String key, Object data, UserDataHandler handler)
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-01 07:43:41 UTC (rev 10270)
+++ 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-01 10:06:19 UTC (rev 10271)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.common.soap;
import java.io.ByteArrayInputStream;
+import java.io.File;
import java.io.InputStream;
import java.util.Iterator;
@@ -155,7 +156,41 @@
assertEquals(soapFactory.createName("name"), it.next());
assertEquals(soapFactory.createName("species", null, "http://zoofan.net"), it.next());
}
+
+ public void testSetTextContent() throws Exception
+ {
+ InputStream is = getResourceURL("common/soap/jbws2693.xml").openStream();
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage soapMessage = messageFactory.createMessage(null, is);
+ NodeList nl = soapMessage.getSOAPBody().getChildNodes();
+ SOAPElement echo = null;
+ for (int i = 0; i < nl.getLength() && echo == null; i++)
+ {
+ Object current = nl.item(i);
+ if (current instanceof SOAPElement)
+ {
+ echo = (SOAPElement)current;
+ }
+ }
+ nl = echo.getChildNodes();
+ SOAPElement arg0 = null;
+ for (int i = 0; i < nl.getLength() && arg0 == null; i++)
+ {
+ Object current = nl.item(i);
+ if (current instanceof SOAPElement)
+ {
+ arg0 = (SOAPElement)current;
+ }
+ }
+ String value = arg0.getTextContent();
+ assertEquals("Expected value", "123", value);
+
+ arg0.setTextContent("456");
+ value = arg0.getTextContent();
+ assertEquals("Expected value", "456", value);
+ }
+
/** Return the count of iterator elements, rendering the iterator unusable.
*/
private int getIteratorCount(Iterator i)
Copied: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2693.xml (from rev 10268, stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2693.xml)
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2693.xml (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/common/soap/jbws2693.xml 2009-07-01 10:06:19 UTC (rev 10271)
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:jbw='http://ws.jboss.org/jbws2693'>
+ <soapenv:Header/>
+ <soapenv:Body>
+ <jbw:echo>
+ <arg0>123</arg0>
+ </jbw:echo>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
15 years, 6 months
JBossWS SVN: r10270 - stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-07-01 03:43:41 -0400 (Wed, 01 Jul 2009)
New Revision: 10270
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointBean.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointInterface.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
Log:
[JBWS-2112] Minor changes to the test
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointBean.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointBean.java 2009-06-30 16:49:45 UTC (rev 10269)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointBean.java 2009-07-01 07:43:41 UTC (rev 10270)
@@ -37,8 +37,16 @@
)
public class EndpointBean implements EndpointInterface
{
+ private int count;
+
public String echo(String input)
{
+ count++;
return input;
}
+
+ public int getCount()
+ {
+ return count;
+ }
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointInterface.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointInterface.java 2009-06-30 16:49:45 UTC (rev 10269)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointInterface.java 2009-07-01 07:43:41 UTC (rev 10270)
@@ -38,4 +38,6 @@
public interface EndpointInterface extends Remote
{
String echo(String input) throws RemoteException;
+
+ public int getCount();
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2009-06-30 16:49:45 UTC (rev 10269)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2009-07-01 07:43:41 UTC (rev 10270)
@@ -40,13 +40,30 @@
{
private static final int port = 8878;
- public void testJSEEndpointPublish() throws Exception
+ public void test() throws Exception
{
- EndpointBean epImpl = new EndpointBean();
+ String publishURL = "http://" + getServerHost() + ":" + port + "/jaxws-endpoint";
+ Endpoint endpoint = publishEndpoint(new EndpointBean(), publishURL);
+
+ String publishURL2 = "http://" + getServerHost() + ":" + port + "/jaxws-endpoint2";
+ Endpoint endpoint2 = publishEndpoint(new EndpointBean(), publishURL2);
+
+ invokeEndpoint(publishURL);
+ invokeEndpoint(publishURL2);
+
+ endpoint.stop();
+ endpoint2.stop();
+ }
+
+ private Endpoint publishEndpoint(EndpointBean epImpl, String publishURL)
+ {
Endpoint endpoint = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, epImpl);
- String publishURL = "http://" + getServerHost() + ":" + port + "/jaxws-endpoint";
endpoint.publish(publishURL);
-
+ return endpoint;
+ }
+
+ private void invokeEndpoint(String publishURL) throws Exception
+ {
URL wsdlURL = new URL(publishURL + "?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint", "EndpointService");
Service service = Service.create(wsdlURL, qname);
@@ -54,9 +71,11 @@
// Invoke the endpoint
String helloWorld = "Hello world!";
+ assertEquals(0, port.getCount());
Object retObj = port.echo(helloWorld);
assertEquals(helloWorld, retObj);
-
- endpoint.stop();
+ assertEquals(1, port.getCount());
+ port.echo(helloWorld);
+ assertEquals(2, port.getCount());
}
}
15 years, 6 months