You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2007/02/25 18:54:22 UTC
svn commit: r511559 - in
/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws:
framework/ xmlhttp/clientTests/dispatch/source/
Author: scheu
Date: Sun Feb 25 09:54:21 2007
New Revision: 511559
URL: http://svn.apache.org/viewvc?view=rev&rev=511559
Log:
AXIS2-1783
Contributor: Rich Scheuerle
Adding missing tests
Added:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSource.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSource.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=511559&r1=511558&r2=511559
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Sun Feb 25 09:54:21 2007
@@ -76,8 +76,8 @@
import org.apache.axis2.jaxws.security.BasicAuthSecurityTests;
import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.datasource.DispatchXMessageDataSource;
import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.jaxb.DispatchXPayloadJAXB;
-//import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXMessageSource;
-//import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXPayloadSource;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXMessageSource;
+import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source.DispatchXPayloadSource;
import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.string.DispatchXMessageString;
import org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.string.DispatchXPayloadString;
import org.apache.log4j.BasicConfigurator;
@@ -167,8 +167,8 @@
suite.addTestSuite(DispatchXPayloadString.class);
suite.addTestSuite(DispatchXMessageString.class);
- //suite.addTestSuite(DispatchXPayloadSource.class);
- //suite.addTestSuite(DispatchXMessageSource.class);
+ suite.addTestSuite(DispatchXPayloadSource.class);
+ suite.addTestSuite(DispatchXMessageSource.class);
suite.addTestSuite(DispatchXPayloadJAXB.class);
suite.addTestSuite(DispatchXMessageDataSource.class);
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSource.java?view=auto&rev=511559
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSource.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXMessageSource.java Sun Feb 25 09:54:21 2007
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.apache.axis2.jaxws.message.util.Reader2Writer;
+
+import junit.framework.TestCase;
+
+public class DispatchXMessageSource extends TestCase {
+
+ private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ public String HOSTPORT = "http://localhost:8080";
+
+ private String ENDPOINT_URL = HOSTPORT + "/axis2/services/XMessageSourceProvider";
+ private QName SERVICE_NAME = new QName("http://ws.apache.org/axis2", "XMessageSourceProvider");
+ private QName PORT_NAME = new QName("http://ws.apache.org/axis2", "XMessageSourceProviderPort");
+
+ private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+ private static String XML_TEXT_NPE = "<p:echo xmlns:p=\"http://sample\">NPE</p:echo>";
+
+ public Dispatch<Source> getDispatch() {
+ Service service = Service.create(SERVICE_NAME);
+ service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+ Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
+ return dispatch;
+ }
+
+ /**
+ * Simple XML/HTTP Message Test
+ * @throws Exception
+ */
+ public void testSimple() throws Exception {
+ Dispatch<Source> dispatch = getDispatch();
+ String request = XML_TEXT;
+ ByteArrayInputStream stream = new ByteArrayInputStream(request.getBytes());
+ Source inSource = new StreamSource((InputStream) stream);
+
+ Source outSource = dispatch.invoke(inSource);
+
+ // Prepare the response content for checking
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
+ Reader2Writer r2w = new Reader2Writer(reader);
+ String response = r2w.getAsString();
+
+ assertTrue(response != null);
+ assertTrue(request.equals(response));
+ }
+
+
+}
+
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSource.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSource.java?view=auto&rev=511559
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSource.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/xmlhttp/clientTests/dispatch/source/DispatchXPayloadSource.java Sun Feb 25 09:54:21 2007
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.jaxws.xmlhttp.clientTests.dispatch.source;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.apache.axis2.jaxws.message.util.Reader2Writer;
+
+import junit.framework.TestCase;
+
+public class DispatchXPayloadSource extends TestCase {
+
+ private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+ public String HOSTPORT = "http://localhost:8080";
+
+ private String ENDPOINT_URL = HOSTPORT + "/axis2/services/XPayloadSourceProvider";
+ private QName SERVICE_NAME = new QName("http://ws.apache.org/axis2", "XPayloadSourceProvider");
+ private QName PORT_NAME = new QName("http://ws.apache.org/axis2", "XPayloadSourceProviderPort");
+
+ private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\">hello world</p:echo>";
+ private static String XML_TEXT_NPE = "<p:echo xmlns:p=\"http://sample\">NPE</p:echo>";
+
+ public Dispatch<Source> getDispatch() {
+ Service service = Service.create(SERVICE_NAME);
+ service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+ Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);
+ return dispatch;
+ }
+
+ /**
+ * Simple XML/HTTP Payload Test
+ * @throws Exception
+ */
+ public void testSimple() throws Exception {
+ Dispatch<Source> dispatch = getDispatch();
+ String request = XML_TEXT;
+ ByteArrayInputStream stream = new ByteArrayInputStream(request.getBytes());
+ Source inSource = new StreamSource((InputStream) stream);
+
+ Source outSource = dispatch.invoke(inSource);
+
+ // Prepare the response content for checking
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
+ Reader2Writer r2w = new Reader2Writer(reader);
+ String response = r2w.getAsString();
+
+ assertTrue(response != null);
+ assertTrue(request.equals(response));
+ }
+
+
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org