[jboss-cvs] JBossAS SVN: r83799 - in branches/Branch_5_0/testsuite: imports/sections and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 3 02:52:33 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-02-03 02:52:33 -0500 (Tue, 03 Feb 2009)
New Revision: 83799
Added:
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointBean.java
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointInterface.java
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointServlet.java
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointTestCase.java
branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/
branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/
branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/web.xml
branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/
branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/TestService.wsdl
Modified:
branches/Branch_5_0/testsuite/.classpath
branches/Branch_5_0/testsuite/build.xml
branches/Branch_5_0/testsuite/imports/sections/webservice.xml
branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/WebserviceTestBase.java
Log:
[JBAS-6436] Added integration test to AS testsuite
Modified: branches/Branch_5_0/testsuite/.classpath
===================================================================
--- branches/Branch_5_0/testsuite/.classpath 2009-02-03 06:50:29 UTC (rev 83798)
+++ branches/Branch_5_0/testsuite/.classpath 2009-02-03 07:52:33 UTC (rev 83799)
@@ -48,5 +48,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/profileservice"/>
<classpathentry kind="lib" path="/cluster/output/lib/jboss-ha-legacy-client.jar"/>
<classpathentry kind="lib" path="output/resources/security"/>
+ <classpathentry kind="lib" path="/thirdparty/org/jboss/ws/lib/jbossws-spi.jar" sourcepath="/thirdparty/org/jboss/ws/lib/jbossws-spi-sources.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/org/jboss/ws/lib/jbossws-common.jar" sourcepath="/thirdparty/org/jboss/ws/lib/jbossws-common-src.zip"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Modified: branches/Branch_5_0/testsuite/build.xml
===================================================================
--- branches/Branch_5_0/testsuite/build.xml 2009-02-03 06:50:29 UTC (rev 83798)
+++ branches/Branch_5_0/testsuite/build.xml 2009-02-03 07:52:33 UTC (rev 83799)
@@ -153,6 +153,7 @@
<path refid="jboss.jboss.ejb3.proxy.classpath" />
<path refid="ejb3-persistence.classpath"/>
<path refid="org.jboss.ws.native.classpath"/>
+ <path refid="org.jboss.ws.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="jboss.metadata.classpath"/>
<path refid="jboss.integration.classpath"/>
Modified: branches/Branch_5_0/testsuite/imports/sections/webservice.xml
===================================================================
--- branches/Branch_5_0/testsuite/imports/sections/webservice.xml 2009-02-03 06:50:29 UTC (rev 83798)
+++ branches/Branch_5_0/testsuite/imports/sections/webservice.xml 2009-02-03 07:52:33 UTC (rev 83799)
@@ -119,5 +119,16 @@
</metainf>
</ear>
+ <!-- jaxws-endpoint-servlet -->
+ <war warfile="${build.lib}/jaxws-endpoint-servlet.war" webxml="${build.resources}/webservice/endpoint/WEB-INF/web.xml">
+ <classes dir="${build.classes}">
+ <include name="org/jboss/test/webservice/endpoint/EndpointServlet.class"/>
+ <include name="org/jboss/test/webservice/endpoint/EndpointBean.class"/>
+ <include name="org/jboss/test/webservice/endpoint/EndpointInterface.class"/>
+ </classes>
+ <webinf dir="${build.resources}/webservice/endpoint/WEB-INF">
+ <include name="wsdl/**"/>
+ </webinf>
+ </war>
</target>
</project>
\ No newline at end of file
Modified: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/WebserviceTestBase.java
===================================================================
--- branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/WebserviceTestBase.java 2009-02-03 06:50:29 UTC (rev 83798)
+++ branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/WebserviceTestBase.java 2009-02-03 07:52:33 UTC (rev 83799)
@@ -25,8 +25,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -40,7 +38,6 @@
*/
public class WebserviceTestBase extends JBossTestCase
{
-
public WebserviceTestBase(String name)
{
super(name);
@@ -67,59 +64,10 @@
return getClientContext("ws4ee-client");
}
- /** Return true if the Axis based stack is available
- */
- public static boolean isWS4EEAvailable()
- {
- try
- {
- ServiceFactory factory = ServiceFactory.newInstance();
- if ("org.jboss.webservice.client.ServiceFactoryImpl".equals(factory.getClass().getName()))
- return true;
- }
- catch (ServiceException e)
- {
- // ignore
- }
- return false;
- }
-
- /** Return true if the JBossWS stack is available
- */
- public static boolean isJBossWSAvailable()
- {
- try
- {
- ServiceFactory factory = ServiceFactory.newInstance();
- if ("org.jboss.ws.jaxrpc.ServiceFactoryImpl".equals(factory.getClass().getName()))
- return true;
- }
- catch (ServiceException e)
- {
- // ignore
- }
- return false;
- }
-
- public static Test getDeploySetupForWS4EE(final Class clazz, String jarName) throws Exception
- {
- TestSuite suite = new TestSuite();
- suite.addTest(new TestSuite(clazz));
- if (isWS4EEAvailable() == false)
- {
- jarName = null;
- }
- return getDeploySetup(suite, jarName);
- }
-
public static Test getDeploySetupForJBossWS(final Class clazz, String jarName) throws Exception
{
TestSuite suite = new TestSuite();
suite.addTest(new TestSuite(clazz));
- if (isJBossWSAvailable() == false)
- {
- jarName = null;
- }
return getDeploySetup(suite, jarName);
}
}
Added: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointBean.java
===================================================================
--- branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointBean.java (rev 0)
+++ branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointBean.java 2009-02-03 07:52:33 UTC (rev 83799)
@@ -0,0 +1,39 @@
+/*
+ * 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.webservice.endpoint;
+
+import javax.jws.WebService;
+
+/**
+ * Test Endpoint deployment
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+ at WebService(endpointInterface = "org.jboss.test.webservice.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: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointInterface.java
===================================================================
--- branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointInterface.java (rev 0)
+++ branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointInterface.java 2009-02-03 07:52:33 UTC (rev 83799)
@@ -0,0 +1,39 @@
+/*
+ * 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.webservice.endpoint;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+ at WebService(targetNamespace = "http://org.jboss.ws/jaxws/endpoint")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface extends Remote
+{
+ String echo(String input) throws RemoteException;
+}
Property changes on: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointInterface.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointServlet.java
===================================================================
--- branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointServlet.java (rev 0)
+++ branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointServlet.java 2009-02-03 07:52:33 UTC (rev 83799)
@@ -0,0 +1,98 @@
+/*
+ * 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.webservice.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 at 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: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointTestCase.java
===================================================================
--- branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointTestCase.java (rev 0)
+++ branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointTestCase.java 2009-02-03 07:52:33 UTC (rev 83799)
@@ -0,0 +1,83 @@
+/*
+ * 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.webservice.endpoint;
+
+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.framework.Test;
+
+import org.jboss.test.webservice.WebserviceTestBase;
+
+/**
+ * Test JAXWS Endpoint deployment
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+public class EndpointTestCase extends WebserviceTestBase
+{
+ public EndpointTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EndpointTestCase.class, "jaxws-endpoint-servlet.war");
+ }
+
+ 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
+ String wsdlURL = getResourceURL("webservice/endpoint/WEB-INF/wsdl/TestService.wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/endpoint", "EndpointService");
+ Service service = Service.create(new URL(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: branches/Branch_5_0/testsuite/src/main/org/jboss/test/webservice/endpoint/EndpointTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/web.xml
===================================================================
--- branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/web.xml (rev 0)
+++ branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/web.xml 2009-02-03 07:52:33 UTC (rev 83799)
@@ -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.webservice.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: branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/TestService.wsdl
===================================================================
--- branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/TestService.wsdl (rev 0)
+++ branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/TestService.wsdl 2009-02-03 07:52:33 UTC (rev 83799)
@@ -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://@jbosstest.host.name@:8080/jaxws-endpoint"/>
+ </port>
+ </service>
+</definitions>
Property changes on: branches/Branch_5_0/testsuite/src/resources/webservice/endpoint/WEB-INF/wsdl/TestService.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jboss-cvs-commits
mailing list