Author: thomas.diesler(a)jboss.com
Date: 2007-03-14 05:24:03 -0400 (Wed, 14 Mar 2007)
New Revision: 2615
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.java
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml
Removed:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
Modified:
trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/web.xml
Log:
Rebuild handler lifecycle test using a static tracker
Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-03-13 21:36:47 UTC (rev
2614)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-03-14 09:24:03 UTC (rev
2615)
@@ -126,11 +126,22 @@
<war warfile="${tests.output.dir}/libs/jaxws-handlerlifecycle.war"
webxml="${tests.output.dir}/resources/jaxws/handlerlifecycle/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.class"/>
- <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.class"/>
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.class"/>
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml"/>
</classes>
</war>
+ <war
warfile="${tests.output.dir}/libs/jaxws-handlerlifecycle-client.war"
webxml="${tests.output.dir}/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-client-handlers.xml"/>
+ </classes>
+ </war>
<!-- jaxws-handlerscope -->
<war warfile="${tests.output.dir}/libs/jaxws-handlerscope.war"
webxml="${tests.output.dir}/resources/jaxws/handlerscope/WEB-INF/web.xml">
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,94 @@
+/*
+ * 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.handlerlifecycle;
+
+// $Id$
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+
+/**
+ * Test JAXWS handler lifecycle
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 13-MAr-2007
+ */
+public class HandlerLifecycleClientTestCase extends JBossWSTest
+{
+ private static SOAPEndpoint port;
+ private static TrackerEndpoint trackerPort;
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(HandlerLifecycleClientTestCase.class,
"jaxws-handlerlifecycle.war");
+ }
+
+ public void setUp() throws Exception
+ {
+ if (port == null)
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle/soap?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"SOAPEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
+ }
+ if (trackerPort == null)
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle/tracker?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"TrackerEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ trackerPort = (TrackerEndpoint)service.getPort(TrackerEndpoint.class);
+ }
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ String retStr = port.echo("hello");
+ assertEquals("hello", retStr);
+ }
+
+ public void testTrackerMessages() throws Exception
+ {
+ String retStr = HandlerTracker.getListMessages();
+ assertEquals("[ClientHandler:PostConstruct, ClientHandler:OutBound,
ClientHandler:InBound, ClientHandler:Close]", retStr);
+
+ retStr = trackerPort.getListMessages();
+ assertEquals("[ServerHandler:PostConstruct, ServerHandler:InBound,
ServerHandler:OutBound, ServerHandler:Close]", retStr);
+
+ }
+
+ public void testClearTrackerData() throws Exception
+ {
+ HandlerTracker.clearListMessages();
+ trackerPort.clearListMessages();
+
+ assertEquals("[]", HandlerTracker.getListMessages());
+ assertEquals("[]", trackerPort.getListMessages());
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,75 @@
+/*
+ * 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.handlerlifecycle;
+
+// $Id$
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+
+/**
+ * Test JAXWS handler lifecycle
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 13-MAr-2007
+ */
+public class HandlerLifecycleServletTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(HandlerLifecycleServletTestCase.class,
"jaxws-handlerlifecycle.war, jaxws-handlerlifecycle-client.war");
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ invokeServletClient(getName());
+ }
+
+ public void testTrackerMessages() throws Exception
+ {
+ invokeServletClient(getName());
+ }
+
+ public void testClearTrackerData() throws Exception
+ {
+ invokeServletClient(getName());
+ }
+
+ private void invokeServletClient(String testMethod) throws MalformedURLException,
IOException
+ {
+ URL servletURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle-client?method=" + testMethod);
+ InputStream is = servletURL.openStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line = br.readLine();
+ assertEquals("pass", line);
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-03-13
21:36:47 UTC (rev 2614)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleTestCase.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -1,99 +0,0 @@
-/*
- * 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.handlerlifecycle;
-
-// $Id$
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Binding;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.handler.Handler;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-
-/**
- * Test JAXWS handler lifecycle
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 13-MAr-2007
- */
-public class HandlerLifecycleTestCase extends JBossWSTest
-{
- private static SOAPEndpoint port;
-
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(HandlerLifecycleTestCase.class,
"jaxws-handlerlifecycle.war");
- }
-
- public void setUp() throws Exception
- {
- if (port == null)
- {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle?wsdl");
- QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"SOAPEndpointService");
- Service service = Service.create(wsdlURL, serviceName);
- port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
- }
- }
-
- public void testClientAccess() throws Exception
- {
- String retStr = port.echo("hello");
- StringBuffer expStr = new
StringBuffer("hello:OutBound:ClientHandler:InBound:ServerHandler:endpoint:OutBound:ServerHandler:InBound:ClientHandler");
- assertEquals(expStr.toString(), retStr);
- }
-
- public void testPostConstruct() throws Exception
- {
- String retStr = LifecycleHandler.postConstructMsg;
- assertEquals("PostConstruct:ClientHandler", retStr);
-
- retStr = port.getPostConstruct();
- assertEquals("PostConstruct:ServerHandler", retStr);
- }
-
- /* Not Implemented
- public void testPreDestroy() throws Exception
- {
- String retStr = port.getPreDestroy();
- assertEquals("PreDestroy:ServerHandler", retStr);
- }
- */
-
- public void testClose() throws Exception
- {
- String retStr = LifecycleHandler.closeMsg;
- assertEquals("Close:ClientHandler", retStr);
-
- retStr = port.getClose();
- assertEquals("Close:ServerHandler", retStr);
- }
-}
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,84 @@
+/*
+ * 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. 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., 5 Franklin St, Fifth Floor, Boston, MA
+ * 020-30 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.handlerlifecycle;
+
+//$Id$
+
+import java.util.Vector;
+
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Tracks handler method invocations
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Mar-2007
+ */
+public final class HandlerTracker
+{
+ private static Logger log = Logger.getLogger(HandlerTracker.class);
+
+ private static Vector<String> messages = new Vector<String>();
+
+ public static void reportHandlePostConstruct(Handler handler)
+ {
+ String msg = handler + ":PostConstruct";
+ log.info(msg + " to vector: " + System.identityHashCode(messages));
+ messages.add(msg);
+ }
+
+ public static void reportHandlePreDestroy(Handler handler)
+ {
+ String msg = handler + ":PreDestroy";
+ log.info(msg + " to vector " + System.identityHashCode(messages));
+ messages.add(msg);
+ }
+
+ public static void reportHandleMessage(Handler handler, String direction)
+ {
+ String msg = handler + ":" + direction;
+ log.info(msg + " to vector: " + System.identityHashCode(messages));
+ messages.add(msg);
+ }
+
+ public static void reportHandleClose(Handler handler)
+ {
+ String msg = handler + ":Close";
+ log.info(msg + " to vector: " + System.identityHashCode(messages));
+ messages.add(msg);
+ }
+
+ public static String getListMessages()
+ {
+ log.info("getListMessages from vector: " +
System.identityHashCode(messages));
+ log.info(messages.toString());
+ return messages.toString();
+ }
+
+ public static void clearListMessages()
+ {
+ log.info("clearListMessages from vector: " +
System.identityHashCode(messages));
+ messages.clear();
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java 2007-03-13
21:36:47 UTC (rev 2614)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -37,10 +37,6 @@
{
private static Logger log = Logger.getLogger(LifecycleHandler.class);
- static String postConstructMsg;
- static String preDestroyMsg;
- static String closeMsg;
-
public LifecycleHandler()
{
log.info("new LifecycleHandler");
@@ -49,54 +45,31 @@
@Override
public boolean handleOutbound(MessageContext msgContext)
{
- log.info("handleOutbound: " + this);
- return appendHandlerName(msgContext, "OutBound:" + getHandlerName());
+ HandlerTracker.reportHandleMessage(this, "OutBound");
+ return true;
}
@Override
public boolean handleInbound(MessageContext msgContext)
{
- log.info("handleInbound: " + this);
- return appendHandlerName(msgContext, "InBound:" + getHandlerName());
+ HandlerTracker.reportHandleMessage(this, "InBound");
+ return true;
}
@PostConstruct
public void postConstruct()
{
- log.info("postConstruct: " + this);
- postConstructMsg = "PostConstruct:" + getHandlerName();
+ HandlerTracker.reportHandlePostConstruct(this);
}
@PreDestroy
public void preDestroy()
{
- log.info("preDestroy: " + this);
- preDestroyMsg = "PreDestroy:" + getHandlerName();
+ HandlerTracker.reportHandlePreDestroy(this);
}
public void close(MessageContext messageContext)
{
- log.info("close: " + this);
- closeMsg = "Close:" + getHandlerName();
+ HandlerTracker.reportHandleClose(this);
}
-
- private boolean appendHandlerName(MessageContext msgContext, String handlerMsg)
- {
- try
- {
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
- if (soapElement.getElementQName().getLocalPart().startsWith("echo"))
- {
- soapElement = (SOAPElement)soapElement.getChildElements().next();
- String value = soapElement.getValue();
- soapElement.setValue(value + ":" + handlerMsg);
- }
- return true;
- }
- catch (SOAPException ex)
- {
- throw new WebServiceException(ex);
- }
- }
}
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java 2007-03-13
21:36:47 UTC (rev 2614)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -33,13 +33,4 @@
{
@WebMethod
public String echo(String msg);
-
- @WebMethod
- public String getPostConstruct();
-
- @WebMethod
- public String getPreDestroy();
-
- @WebMethod
- public String getClose();
}
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java 2007-03-13
21:36:47 UTC (rev 2614)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -42,27 +42,6 @@
public String echo(String msg)
{
log.info("echo: " + msg);
- return msg + ":endpoint";
+ return msg;
}
-
- @WebMethod
- public String getPostConstruct()
- {
- log.info("getPostConstruct: " + LifecycleHandler.postConstructMsg);
- return LifecycleHandler.postConstructMsg;
- }
-
- @WebMethod
- public String getPreDestroy()
- {
- log.info("getPreDestroy: " + LifecycleHandler.preDestroyMsg);
- return LifecycleHandler.postConstructMsg;
- }
-
- @WebMethod
- public String getClose()
- {
- log.info("getClose: " + LifecycleHandler.closeMsg);
- return LifecycleHandler.closeMsg;
- }
}
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,125 @@
+/*
+ * 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.handlerlifecycle;
+
+// $Id$
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+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.Service;
+
+import org.jboss.logging.Logger;
+
+public class ServletClient extends HttpServlet
+{
+ private static Logger log = Logger.getLogger(ServletClient.class);
+
+ private SOAPEndpoint port;
+ private TrackerEndpoint trackerPort;
+
+ public void init(ServletConfig config) throws ServletException
+ {
+ super.init(config);
+
+ try
+ {
+ if (port == null)
+ {
+ URL wsdlURL = new
URL("http://localhost:8080/jaxws-handlerlifecycle/soap?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"SOAPEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
+ }
+ if (trackerPort == null)
+ {
+ URL wsdlURL = new
URL("http://localhost:8080/jaxws-handlerlifecycle/tracker?wsdl");
+ QName serviceName = new
QName("http://org.jboss.ws/jaxws/handlerlifecycle",
"TrackerEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ trackerPort = (TrackerEndpoint)service.getPort(TrackerEndpoint.class);
+ }
+ }
+ catch (MalformedURLException ex)
+ {
+ throw new ServletException(ex);
+ }
+ }
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ String message;
+ try
+ {
+ String methodName = req.getParameter("method");
+ Method method = getClass().getMethod(methodName, new Class[]{});
+ method.invoke(this, new Object[]{});
+ message = "pass";
+ }
+ catch (Exception ex)
+ {
+ log.error(ex);
+ message = ex.toString();
+ }
+
+ res.getWriter().println(message);
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ String retStr = port.echo("hello");
+ assertEquals("hello", retStr);
+ }
+
+ public void testTrackerMessages() throws Exception
+ {
+ String retStr = HandlerTracker.getListMessages();
+ assertEquals("[ClientHandler:PostConstruct, ClientHandler:OutBound,
ClientHandler:InBound, ClientHandler:Close]", retStr);
+
+ retStr = trackerPort.getListMessages();
+ assertEquals("[ServerHandler:PostConstruct, ServerHandler:InBound,
ServerHandler:OutBound, ServerHandler:Close]", retStr);
+
+ }
+
+ public void testClearTrackerData() throws Exception
+ {
+ HandlerTracker.clearListMessages();
+ trackerPort.clearListMessages();
+
+ assertEquals("[]", HandlerTracker.getListMessages());
+ assertEquals("[]", trackerPort.getListMessages());
+ }
+
+ private void assertEquals(String exp, String was)
+ {
+ if (exp.equals(was) == false)
+ throw new RuntimeException("Expected <" + exp + "> but was
<" + was + ">");
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,40 @@
+/*
+ * 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.handlerlifecycle;
+
+// $Id$
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+
+@WebService
+@SOAPBinding(style = Style.RPC)
+public interface TrackerEndpoint
+{
+ @WebMethod
+ public String getListMessages();
+
+ @WebMethod
+ public void clearListMessages();
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.java 2007-03-14
09:24:03 UTC (rev 2615)
@@ -0,0 +1,46 @@
+/*
+ * 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.handlerlifecycle;
+
+// $Id$
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+
+@WebService(name = "TrackerEndpoint", targetNamespace =
"http://org.jboss.ws/jaxws/handlerlifecycle")
+@SOAPBinding(style = Style.RPC)
+public class TrackerEndpointBean
+{
+ @WebMethod
+ public String getListMessages()
+ {
+ return HandlerTracker.getListMessages();
+ }
+
+ @WebMethod
+ public void clearListMessages()
+ {
+ HandlerTracker.clearListMessages();
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/TrackerEndpointBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml
===================================================================
---
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml
(rev 0)
+++
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml 2007-03-14
09:24:03 UTC (rev 2615)
@@ -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>ServletClient</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.handlerlifecycle.ServletClient</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ServletClient</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
+
Property changes on:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/web.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/web.xml 2007-03-13
21:36:47 UTC (rev 2614)
+++ trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/web.xml 2007-03-14
09:24:03 UTC (rev 2615)
@@ -6,14 +6,22 @@
version="2.4">
<servlet>
- <servlet-name>TestService</servlet-name>
+ <servlet-name>SOAPEndpoint</servlet-name>
<servlet-class>org.jboss.test.ws.jaxws.handlerlifecycle.SOAPEndpointBean</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>TrackerEndpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.handlerlifecycle.TrackerEndpointBean</servlet-class>
+ </servlet>
<servlet-mapping>
- <servlet-name>TestService</servlet-name>
- <url-pattern>/*</url-pattern>
+ <servlet-name>SOAPEndpoint</servlet-name>
+ <url-pattern>/soap</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>TrackerEndpoint</servlet-name>
+ <url-pattern>/tracker</url-pattern>
+ </servlet-mapping>
</web-app>