Author: alessio.soldano(a)jboss.com
Date: 2011-02-18 08:48:46 -0500 (Fri, 18 Feb 2011)
New Revision: 13772
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/Client.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointBean.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointTestCase.java
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/TestServlet.java
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web-ws.xml
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web.xml
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/wsdl/
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/wsdl/TestService.wsdl
Modified:
shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3223] Adding initial testcase
Modified: shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml
===================================================================
--- shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-02-18 12:21:35
UTC (rev 13771)
+++ shared-testsuite/trunk/src/test/ant-import/build-jars-jaxws.xml 2011-02-18 13:48:46
UTC (rev 13772)
@@ -1013,6 +1013,26 @@
</webinf>
</war>
+ <!-- jaxws-jbws3223 -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3223.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws3223/WEB-INF/web-ws.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws3223/EndpointBean.class"
/>
+ <include name="org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.class"
/>
+ </classes>
+ </war>
+
+ <!-- jaxws-jbws3223-servlet -->
+ <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3223-servlet.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws3223/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws3223/TestServlet.class"
/>
+ <include name="org/jboss/test/ws/jaxws/jbws3223/Client.class" />
+ <include name="org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.class"
/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws3223/WEB-INF">
+ <include name="wsdl/**" />
+ </webinf>
+ </war>
+
<!-- jaxws-endpoint-servlet -->
<war warfile="${tests.output.dir}/test-libs/jaxws-endpoint-servlet.war"
webxml="${tests.output.dir}/test-resources/jaxws/endpoint/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added: shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/Client.java
===================================================================
--- shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/Client.java
(rev 0)
+++
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/Client.java 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3223;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+public class Client
+{
+ public String run(String param, URL wsdlURL)
+ {
+ // Create the port
+ QName qname = new QName("http://org.jboss.ws/jaxws/jbws3223",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ return port.echo(param);
+ }
+}
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointBean.java
===================================================================
---
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointBean.java
(rev 0)
+++
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointBean.java 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3223;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.jbws3223.EndpointInterface", targetNamespace =
"http://org.jboss.ws/jaxws/jbws3223", serviceName =
"EndpointService")
+public class EndpointBean implements EndpointInterface
+{
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.java
===================================================================
---
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.java
(rev 0)
+++
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointInterface.java 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3223;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://org.jboss.ws/jaxws/jbws3223")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface
+{
+ @WebResult(partName = "result")
+ String echo(@WebParam(partName = "String_1") String input);
+}
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointTestCase.java
===================================================================
---
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointTestCase.java
(rev 0)
+++
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/EndpointTestCase.java 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3223;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-3223] Runtime ws client classloader setup (on AS 7)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 18-Feb-2011
+ */
+public class EndpointTestCase extends JBossWSTest
+{
+
+ public static Test suite()
+ {
+ return new TestSetup(new JBossWSTestSetup(EndpointTestCase.class,
"jaxws-jbws3223-servlet.war jaxws-jbws3223.war"));
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ readWSDL(new URL("http://" + getServerHost() +
":8080/jaxws-jbws3223?wsdl"));
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ String helloWorld = "Hello world!";
+ Client client = new Client();
+ Object retObj = client.run(helloWorld,
getResourceURL("jaxws/jbws3223/WEB-INF/wsdl/TestService.wsdl"));
+ assertEquals(helloWorld, retObj);
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() +
":8080/jaxws-jbws3223-servlet?param=hello-world");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("hello-world", br.readLine());
+ }
+
+ private void readWSDL(URL wsdlURL) throws Exception
+ {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
+ assertNotNull(wsdlDefinition);
+ }
+
+}
Added:
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/TestServlet.java
===================================================================
---
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/TestServlet.java
(rev 0)
+++
shared-testsuite/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws3223/TestServlet.java 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws3223;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import java.net.URL;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@SuppressWarnings("serial")
+public class TestServlet extends HttpServlet
+{
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ // Invoke the endpoint
+ String param = req.getParameter("param");
+ Client client = new Client();
+ //URL wsdlURL =
getServletContext().getResource("/WEB-INF/wsdl/TestService.wsdl");
+ URL wsdlURL = new URL("http://localhost:8080/jaxws-jbws3223?wsdl");
+ String retStr = client.run(param, wsdlURL);
+
+ // Return the result
+ PrintWriter pw = new PrintWriter(res.getWriter());
+ pw.print(retStr);
+ pw.close();
+ }
+}
Added: shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web-ws.xml
===================================================================
--- shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web-ws.xml
(rev 0)
+++ shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web-ws.xml 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>EpService</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws3223.EndpointBean</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>EpService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Added: shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web.xml
===================================================================
--- shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web.xml
(rev 0)
+++ shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/web.xml 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+ version="2.4">
+
+ <servlet>
+ <servlet-name>TestService</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws3223.TestServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Added:
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/wsdl/TestService.wsdl
===================================================================
---
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/wsdl/TestService.wsdl
(rev 0)
+++
shared-testsuite/trunk/src/test/resources/jaxws/jbws3223/WEB-INF/wsdl/TestService.wsdl 2011-02-18
13:48:46 UTC (rev 13772)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions name="EndpointService"
targetNamespace="http://org.jboss.ws/jaxws/jbws3223"
xmlns:tns="http://org.jboss.ws/jaxws/jbws3223"
+
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <types/>
+ <message name="EndpointInterface_echo">
+ <part name="String_1" type="xsd:string"/>
+ </message>
+ <message name="EndpointInterface_echoResponse">
+ <part name="result" type="xsd:string"/>
+ </message>
+ <portType name="EndpointInterface">
+ <operation name="echo" parameterOrder="String_1">
+ <input message="tns:EndpointInterface_echo"/>
+ <output message="tns:EndpointInterface_echoResponse"/>
+ </operation>
+ </portType>
+ <binding name="EndpointInterfaceBinding"
type="tns:EndpointInterface">
+ <soap:binding
transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
+ <operation name="echo">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"
namespace="http://org.jboss.ws/jaxws/jbws3223"/>
+ </input>
+ <output>
+ <soap:body use="literal"
namespace="http://org.jboss.ws/jaxws/jbws3223"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="EndpointService">
+ <port name="EndpointInterfacePort"
binding="tns:EndpointInterfaceBinding">
+ <soap:address
location="http://@jboss.bind.address@:8080/jaxws-jbws3223"/>
+ </port>
+ </service>
+</definitions>