Author: alessio.soldano(a)jboss.com
Date: 2008-07-24 12:00:09 -0400 (Thu, 24 Jul 2008)
New Revision: 7907
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointBean.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/web.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl
Modified:
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBWS-2128] Moving current endpoint testcase from framework to native
Modified: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2008-07-24
15:57:13 UTC (rev 7906)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2008-07-24
16:00:09 UTC (rev 7907)
@@ -74,6 +74,18 @@
<include
name="org/jboss/test/ws/jaxws/enventry/EnvEntryServlet.class"/>
</classes>
</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">
+ <include
name="org/jboss/test/ws/jaxws/endpoint/EndpointServlet.class"/>
+ <include
name="org/jboss/test/ws/jaxws/endpoint/EndpointBean.class"/>
+ <include
name="org/jboss/test/ws/jaxws/endpoint/EndpointInterface.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/endpoint/WEB-INF">
+ <include name="wsdl/**"/>
+ </webinf>
+ </war>
<!-- jaxws-epr -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-epr.jar">
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointBean.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointBean.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointBean.java 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.endpoint;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint deployment
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Apr-2005
+ */
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.endpoint.EndpointInterface", targetNamespace =
"http://org.jboss.ws/jaxws/endpoint", serviceName =
"EndpointService")
+public class EndpointBean implements EndpointInterface
+{
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.endpoint;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Test the JSR-181 annotation: javax.jws.WebService
+ * This interface is only used in the client deployment.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Apr-2005
+ */
+@WebService(targetNamespace = "http://org.jboss.ws/jaxws/endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface extends Remote
+{
+ String echo(String input) throws RemoteException;
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointInterface.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.endpoint;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.http.HttpContext;
+import org.jboss.wsf.spi.http.HttpServer;
+import org.jboss.wsf.spi.http.HttpServerFactory;
+
+/**
+ * Test Endpoint deployment
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 12-Jul-2006
+ */
+public class EndpointServlet extends HttpServlet
+{
+ private Endpoint endpoint;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+
+ // Create the endpoint
+ EndpointBean epImpl = new EndpointBean();
+ endpoint = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, epImpl);
+
+ // Create and start the HTTP server
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ HttpServer httpServer =
spiProvider.getSPI(HttpServerFactory.class).getHttpServer();
+ httpServer.start();
+
+ // Create the context and publish the endpoint
+ HttpContext context = httpServer.createContext("/jaxws-endpoint");
+ endpoint.publish(context);
+ }
+
+ @Override
+ public void destroy()
+ {
+ // Stop the endpoint
+ endpoint.stop();
+
+ super.destroy();
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ // Create the port
+ URL wsdlURL =
getServletContext().getResource("/WEB-INF/wsdl/TestService.wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/endpoint",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ // Invoke the endpoint
+ String param = req.getParameter("param");
+ String retStr = port.echo(param);
+
+ // Return the result
+ PrintWriter pw = new PrintWriter(res.getWriter());
+ pw.print(retStr);
+ }
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.endpoint;
+
+// $Id$
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+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.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test JAXWS Endpoint deployment
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Apr-2005
+ */
+public class EndpointTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new TestSetup(new JBossWSTestSetup(EndpointTestCase.class,
"jaxws-endpoint-servlet.war")) {
+
+ private Boolean useJBossWebLoader;
+
+ protected void setUp() throws Exception
+ {
+ MBeanServerConnection server = JBossWSTestHelper.getServer();
+ useJBossWebLoader = (Boolean)server.getAttribute(new
ObjectName("jboss.web:service=WebServer"), "UseJBossWebLoader");
+ server.setAttribute(new ObjectName("jboss.web:service=WebServer"),
new Attribute("UseJBossWebLoader", Boolean.TRUE));
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ MBeanServerConnection server = JBossWSTestHelper.getServer();
+ server.setAttribute(new ObjectName("jboss.web:service=WebServer"),
new Attribute("UseJBossWebLoader", useJBossWebLoader));
+ }
+ };
+ }
+
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-endpoint?wsdl");
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
+ assertNotNull(wsdlDefinition);
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ // Create the port
+ URL wsdlURL =
getResourceURL("jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/endpoint",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ String helloWorld = "Hello world!";
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld, retObj);
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() +
":8080/jaxws-endpoint-servlet?param=hello-world");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("hello-world", br.readLine());
+ }
+}
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/EndpointTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/web.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/web.xml
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/web.xml 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,20 @@
+<?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.endpoint.EndpointServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TestService</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl
(rev 0)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl 2008-07-24
16:00:09 UTC (rev 7907)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions name="EndpointService"
targetNamespace="http://org.jboss.ws/jaxws/endpoint"
xmlns:tns="http://org.jboss.ws/jaxws/endpoint"
+
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/endpoint"/>
+ </input>
+ <output>
+ <soap:body use="literal"
namespace="http://org.jboss.ws/jaxws/endpoint"/>
+ </output>
+ </operation>
+ </binding>
+ <service name="EndpointService">
+ <port name="EndpointInterfacePort"
binding="tns:EndpointInterfaceBinding">
+ <soap:address
location="http://@jboss.bind.address@:8080/jaxws-endpoint"/>
+ </port>
+ </service>
+</definitions>
Property changes on:
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/WEB-INF/wsdl/TestService.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF