Author: richard.opalka(a)jboss.com
Date: 2009-09-25 08:25:39 -0400 (Fri, 25 Sep 2009)
New Revision: 10780
Added:
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointBean.java
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointInterface.java
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointTestCase.java
Log:
[JBWS-2674][JBWS-2754] creating common dynamic endpoint test case
Added:
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointBean.java
===================================================================
---
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointBean.java
(rev 0)
+++
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointBean.java 2009-09-25
12:25:39 UTC (rev 10780)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.endpoint.jse;
+
+import javax.jws.WebService;
+
+/**
+ * Endpoint implementation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+@WebService
+(
+ serviceName = "EndpointService",
+ endpointInterface =
"org.jboss.test.ws.jaxws.endpoint.jse.EndpointInterface",
+ targetNamespace = "http://org.jboss.ws/jaxws/endpoint/jse/"
+)
+public class EndpointBean implements EndpointInterface
+{
+
+ private int count;
+
+ public String echo(String input)
+ {
+ count++;
+ return input;
+ }
+
+ public int getCount()
+ {
+ return count;
+ }
+
+}
Added:
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointInterface.java
===================================================================
---
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointInterface.java
(rev 0)
+++
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointInterface.java 2009-09-25
12:25:39 UTC (rev 10780)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.endpoint.jse;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Endpoint interface.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+@WebService(targetNamespace = "http://org.jboss.ws/jaxws/endpoint/jse/")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface EndpointInterface extends Remote
+{
+
+ String echo(String input) throws RemoteException;
+
+ public int getCount();
+
+}
Added:
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointTestCase.java
===================================================================
---
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointTestCase.java
(rev 0)
+++
framework/branches/ropalka/testsuite/test/java/org/jboss/test/ws/jaxws/endpoint/jse/EndpointTestCase.java 2009-09-25
12:25:39 UTC (rev 10780)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.endpoint.jse;
+
+import java.net.URL;
+
+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.test.JBossWSTest;
+
+/**
+ * Tests JAXWS dynamic endpoint deployment in an JSE environment.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public class EndpointTestCase extends JBossWSTest
+{
+ private static final int port = 8878;
+
+ public void test() throws Exception
+ {
+ String publishURL1 = "http://" + getServerHost() + ":" + port +
"/jaxws-endpoint1";
+ Endpoint endpoint1 = publishEndpoint(new EndpointBean(), publishURL1);
+
+ String publishURL2 = "http://" + getServerHost() + ":" + port +
"/jaxws-endpoint2";
+ Endpoint endpoint2 = publishEndpoint(new EndpointBean(), publishURL2);
+
+ invokeEndpoint(publishURL1);
+ invokeEndpoint(publishURL2);
+
+ endpoint1.stop();
+ endpoint2.stop();
+ }
+
+ private Endpoint publishEndpoint(EndpointBean epImpl, String publishURL)
+ {
+ Endpoint endpoint = Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, epImpl);
+ endpoint.publish(publishURL);
+ return endpoint;
+ }
+
+ private void invokeEndpoint(String publishURL) throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/endpoint/jse/",
"EndpointService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ // Invoke the endpoint
+ String helloWorld = "Hello world!";
+ assertEquals(0, port.getCount());
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld, retObj);
+ assertEquals(1, port.getCount());
+ port.echo(helloWorld);
+ assertEquals(2, port.getCount());
+ }
+}