Author: alessio.soldano(a)jboss.com
Date: 2011-07-14 11:29:03 -0400 (Thu, 14 Jul 2011)
New Revision: 14693
Added:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/Endpoint.java
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointImpl.java
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishTestCase.java
Modified:
shared-testsuite/branches/asoldano/testsuite/src/test/ant-import/build-samples-jaxws.xml
Log:
Adding EndpointPublisher testcase
Modified:
shared-testsuite/branches/asoldano/testsuite/src/test/ant-import/build-samples-jaxws.xml
===================================================================
---
shared-testsuite/branches/asoldano/testsuite/src/test/ant-import/build-samples-jaxws.xml 2011-07-14
15:27:15 UTC (rev 14692)
+++
shared-testsuite/branches/asoldano/testsuite/src/test/ant-import/build-samples-jaxws.xml 2011-07-14
15:29:03 UTC (rev 14693)
@@ -482,6 +482,14 @@
<exclude
name="org/jboss/test/ws/jaxws/samples/xop/doclit/*TestCase.class"/>
</classes>
</war>
+
+ <!-- endpoint-publish.war -->
+ <war warfile="${tests.output.dir}/test-libs/endpoint-publish.war"
needxmlfile='false'>
+ <classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/publish/**"/>
+ <exclude name="org/jboss/test/ws/publish/*TestCase.class"/>
+ </classes>
+ </war>
<!-- management-recording.jar -->
<jar
destfile="${tests.output.dir}/test-libs/management-recording-native.jar">
Added:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/Endpoint.java
===================================================================
---
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/Endpoint.java
(rev 0)
+++
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/Endpoint.java 2011-07-14
15:29:03 UTC (rev 14693)
@@ -0,0 +1,34 @@
+/*
+ * 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.publish;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService (name="Endpoint")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Endpoint
+{
+ @WebMethod(operationName = "echoString", action =
"urn:EchoString")
+ String echo(String input);
+}
Added:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointImpl.java
===================================================================
---
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointImpl.java
(rev 0)
+++
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointImpl.java 2011-07-14
15:29:03 UTC (rev 14693)
@@ -0,0 +1,39 @@
+/*
+ * 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.publish;
+
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+
+@WebService(serviceName="EndpointService", portName="EndpointPort",
endpointInterface = "org.jboss.test.ws.publish.Endpoint")
+public class EndpointImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+ public String echo(String input)
+ {
+ log.info("echo: " + input);
+ return input;
+ }
+}
Added:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java
===================================================================
---
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java
(rev 0)
+++
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishServlet.java 2011-07-14
15:29:03 UTC (rev 14693)
@@ -0,0 +1,110 @@
+/*
+ * 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.publish;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ServiceLoader;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.publish.EndpointPublisher;
+import org.jboss.wsf.spi.publish.EndpointPublisherFactory;
+
+/**
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 01-Apr-2011
+ *
+ */
+@WebServlet(name = "EndpointPublishServlet", urlPatterns = "/*")
+public class EndpointPublishServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ Endpoint ep = null;
+ EndpointPublisher publisher = null;
+ try
+ {
+ //deploy endpoint
+ ClassLoader loader =
ClassLoaderProvider.getDefaultProvider().getWebServiceSubsystemClassLoader();
+ EndpointPublisherFactory factory =
ServiceLoader.load(EndpointPublisherFactory.class, loader).iterator().next();
+ publisher = factory.newEndpointPublisher("localhost");
+ ep = publisher.publish("org.jboss.test.ws.publish.EndpointImpl",
Thread.currentThread().getContextClassLoader(), "ep-publish-test",
"/pattern");
+
+ System.out.println("State: " + ep.getState());
+ System.out.println("Address: " + ep.getAddress());
+ System.out.println("TargetBeanClass: " + ep.getTargetBeanClass());
+
+ //call endpoint
+ URL wsdlURL = new
URL("http://localhost:8080/ep-publish-test/pattern?wsdl");
+ QName serviceName = new
QName("http://publish.ws.test.jboss.org/",
"EndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ org.jboss.test.ws.publish.Endpoint port =
service.getPort(org.jboss.test.ws.publish.Endpoint.class);
+ String result = port.echo("Foo");
+ if (!"Foo".equals(result))
+ {
+ throw new Exception("Expected 'Foo' but got '" + result
+ "'");
+ }
+
+ res.getWriter().print("1");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ res.getWriter().print(e.getMessage());
+ }
+ finally
+ {
+ if (ep != null && publisher != null)
+ {
+ try
+ {
+ //undeploy endpoint
+ publisher.destroy(ep);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ res.getWriter().print(e.getMessage());
+ }
+ }
+ }
+ }
+}
Added:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishTestCase.java
===================================================================
---
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishTestCase.java
(rev 0)
+++
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishTestCase.java 2011-07-14
15:29:03 UTC (rev 14693)
@@ -0,0 +1,52 @@
+/*
+ * 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.publish;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * Test WS endpoint publish api to JBoss AS container
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-Jul-2011
+ */
+public class EndpointPublishTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(EndpointPublishTestCase.class,
"endpoint-publish.war");
+ }
+
+ public void testEndpointPublish() throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() +
":8080/endpoint-publish");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("1", br.readLine());
+ }
+}
Property changes on:
shared-testsuite/branches/asoldano/testsuite/src/test/java/org/jboss/test/ws/publish/EndpointPublishTestCase.java
___________________________________________________________________
Added: svn:executable
+ *