Author: thomas.diesler(a)jboss.com
Date: 2007-03-16 15:18:35 -0400 (Fri, 16 Mar 2007)
New Revision: 2631
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler3.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler1.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler2.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler3.java
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/jaxws-client-config.xml
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/jaxws-endpoint-config.xml
Removed:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler.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/ServerHandler.java
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/ServletClient/
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java
trunk/jbossws-core/src/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml
trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.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/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/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-client-handlers.xml
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml
Log:
Fixed: [JBWS-1578] Redefine order of jaxws handlers
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -72,6 +72,14 @@
sepMetaData.registerConfigObserver(this);
}
+ /**
+ * For JAXRPC PRE/POST are defined in the context of message origin.
+ */
+ protected HandlerType[] getHandlerTypeOrder()
+ {
+ return new HandlerType[] { HandlerType.PRE, HandlerType.ENDPOINT, HandlerType.POST
};
+ }
+
public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
{
SOAPMessageContextJAXRPC msgContext =
(SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
@@ -94,7 +102,7 @@
handlerChain = jaxrpcHandlerChain;
else if (type == HandlerType.POST)
handlerChain = postHandlerChain;
-
+
if (handlerChain != null)
status = handlerChain.handleRequest(msgContext);
@@ -104,7 +112,7 @@
public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type)
{
SOAPMessageContextJAXRPC msgContext =
(SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-
+
HandlerChain handlerChain = null;
if (type == HandlerType.PRE)
handlerChain = preHandlerChain;
@@ -112,10 +120,10 @@
handlerChain = jaxrpcHandlerChain;
else if (type == HandlerType.POST)
handlerChain = postHandlerChain;
-
+
boolean status = (handlerChain != null ? handlerChain.handleResponse(msgContext) :
true);
- if(type == HandlerType.ENDPOINT)
+ if (type == HandlerType.ENDPOINT)
XOPContext.visitAndRestoreXOPData();
return status;
@@ -132,10 +140,10 @@
handlerChain = jaxrpcHandlerChain;
else if (type == HandlerType.POST)
handlerChain = postHandlerChain;
-
+
boolean status = (handlerChain != null ? handlerChain.handleFault(msgContext) :
true);
- if(type == HandlerType.ENDPOINT)
+ if (type == HandlerType.ENDPOINT)
XOPContext.visitAndRestoreXOPData();
return status;
@@ -164,16 +172,17 @@
{
hConfig.put(param.getParamName(), param.getParamValue());
}
-
+
Set<QName> headers = jaxrpcMetaData.getSoapHeaders();
QName[] headerArr = new QName[headers.size()];
headers.toArray(headerArr);
-
+
Class hClass = jaxrpcMetaData.getHandlerClass();
hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
- if(log.isDebugEnabled()) log.debug("Adding server side handler to service
'" + sepMetaData.getPortName() + "': " + info);
+ if (log.isDebugEnabled())
+ log.debug("Adding server side handler to service '" +
sepMetaData.getPortName() + "': " + info);
hInfos.add(info);
}
@@ -182,7 +191,8 @@
private void initHandlerChain(ServerEndpointMetaData sepMetaData,
List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
{
- if(log.isDebugEnabled()) log.debug("Init handler chain with [" +
hInfos.size() + "] handlers");
+ if (log.isDebugEnabled())
+ log.debug("Init handler chain with [" + hInfos.size() + "]
handlers");
ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles,
type);
if (type == HandlerType.PRE)
@@ -200,7 +210,7 @@
handlerChain.pullHeaders(headers);
Collections.addAll(roles, handlerChain.getRoles());
}
-
+
public Set<String> getRoles()
{
return roles;
@@ -210,7 +220,7 @@
{
return headers;
}
-
+
public void update(Observable observable, Object object)
{
}
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerChainExecutor.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -171,28 +171,6 @@
return doNext;
}
- private int getFirstHandler()
- {
- int index;
- if (falseIndex == -1)
- {
- index = (isOutbound ? 0 : handlers.size() - 1);
- }
- else
- {
- index = (isOutbound ? falseIndex - 1 : falseIndex + 1);
- }
- return index;
- }
-
- private int getNextIndex(int prevIndex)
- {
- int nextIndex = (isOutbound ? prevIndex + 1 : prevIndex - 1);
- if (nextIndex >= handlers.size())
- nextIndex = -1;
- return nextIndex;
- }
-
public boolean handleFault(MessageContext msgContext, Exception ex)
{
isOutbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
@@ -228,6 +206,7 @@
msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
int index = getFirstHandler();
+
Handler currHandler = null;
try
{
@@ -268,6 +247,28 @@
return doNext;
}
+ private int getFirstHandler()
+ {
+ int index;
+ if (falseIndex == -1)
+ {
+ index = (isOutbound ? 0 : handlers.size() - 1);
+ }
+ else
+ {
+ index = getNextIndex(falseIndex);
+ }
+ return index;
+ }
+
+ private int getNextIndex(int prevIndex)
+ {
+ int nextIndex = (isOutbound ? prevIndex + 1 : prevIndex - 1);
+ if (nextIndex >= handlers.size())
+ nextIndex = -1;
+ return nextIndex;
+ }
+
// 4.14 Conformance (Exceptions During Handler Processing): Exceptions thrown during
handler processing on
// the client MUST be passed on to the application. If the exception in question is a
subclass of WebService-
// Exception then an implementation MUST rethrow it as-is, without any additional
wrapping, otherwise it
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -61,6 +61,14 @@
sepMetaData.registerConfigObserver(this);
}
+ /**
+ * For JAXWS PRE/POST are defined in the context of an outbound message
+ */
+ protected HandlerType[] getHandlerTypeOrder()
+ {
+ return new HandlerType[] { HandlerType.POST, HandlerType.ENDPOINT, HandlerType.PRE
};
+ }
+
public boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType
type)
{
log.debug("callRequestHandlerChain: " + type);
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -140,7 +140,11 @@
// The direction of the message
DirectionHolder direction = new DirectionHolder(Direction.InBound);
-
+
+ // Get the order of pre/post handlerchains
+ HandlerType[] handlerType = delegate.getHandlerTypeOrder();
+ HandlerType[] faultType = delegate.getHandlerTypeOrder();
+
try
{
boolean oneway = false;
@@ -149,8 +153,8 @@
CommonBinding binding = bindingProvider.getCommonBinding();
binding.setHeaderSource(delegate);
- // call the handler chain
- boolean handlersPass = callRequestHandlerChain(sepMetaData, HandlerType.PRE);
+ // call the request handler chain
+ boolean handlersPass = callRequestHandlerChain(sepMetaData, handlerType[0]);
// Unbind the request message
if (handlersPass)
@@ -173,13 +177,13 @@
*/
if (binding instanceof CommonSOAPBinding)
((CommonSOAPBinding)binding).checkMustUnderstand(opMetaData);
-
+
// Unbind the request message
epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
}
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
HandlerType.ENDPOINT);
- handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
HandlerType.POST);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[1]);
+ handlersPass = handlersPass && callRequestHandlerChain(sepMetaData,
handlerType[2]);
if (handlersPass)
{
@@ -219,12 +223,15 @@
msgContext.setSOAPMessage(resMessage);
}
- // call the handler chain
+ // call the response handler chain, removing the fault type entry will not call
handleFault for that chain
if (oneway == false)
{
- handlersPass = callResponseHandlerChain(sepMetaData, HandlerType.POST);
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
HandlerType.ENDPOINT);
- handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
HandlerType.PRE);
+ handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
+ faultType[2] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[1]);
+ faultType[1] = null;
+ handlersPass = handlersPass && callResponseHandlerChain(sepMetaData,
handlerType[0]);
+ faultType[0] = null;
}
SOAPMessage resMessage = msgContext.getSOAPMessage();
@@ -240,10 +247,14 @@
CommonBinding binding = bindingProvider.getCommonBinding();
binding.bindFaultMessage(ex);
- // call the handler chain
- boolean handlersPass = callFaultHandlerChain(sepMetaData, HandlerType.POST,
ex);
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
HandlerType.ENDPOINT, ex);
- handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
HandlerType.PRE, ex);
+ // call the fault handler chain
+ boolean handlersPass = true;
+ if (faultType[2] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[2], ex);
+ if (faultType[1] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[1], ex);
+ if (faultType[0] != null)
+ handlersPass = handlersPass && callFaultHandlerChain(sepMetaData,
faultType[0], ex);
}
catch (RuntimeException subEx)
{
@@ -254,9 +265,9 @@
}
finally
{
- closeHandlerChain(sepMetaData, HandlerType.POST);
- closeHandlerChain(sepMetaData, HandlerType.ENDPOINT);
- closeHandlerChain(sepMetaData, HandlerType.PRE);
+ closeHandlerChain(sepMetaData, handlerType[2]);
+ closeHandlerChain(sepMetaData, handlerType[1]);
+ closeHandlerChain(sepMetaData, handlerType[0]);
destroyServiceEndpointInstance(seInstance);
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServerHandlerDelegate.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -41,6 +41,9 @@
this.sepMetaData = sepMetaData;
}
+ // Get the order of pre/post handlerchains
+ protected abstract HandlerType[] getHandlerTypeOrder();
+
public abstract boolean callRequestHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
public abstract boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData,
HandlerType type);
Modified:
trunk/jbossws-core/src/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml
===================================================================
---
trunk/jbossws-core/src/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-core/src/resources/jbossws.sar/META-INF/standard-jaxws-endpoint-config.xml 2007-03-16
19:18:35 UTC (rev 2631)
@@ -11,7 +11,7 @@
<endpoint-config>
<config-name>Standard WSAddressing Endpoint</config-name>
- <pre-handler-chains>
+ <post-handler-chains>
<javaee:handler-chain>
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
<javaee:handler>
@@ -19,12 +19,12 @@
<javaee:handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingServerHandler</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
- </pre-handler-chains>
+ </post-handler-chains>
</endpoint-config>
<endpoint-config>
<config-name>Standard WSSecurity Endpoint</config-name>
- <pre-handler-chains>
+ <post-handler-chains>
<javaee:handler-chain>
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
<javaee:handler>
@@ -32,7 +32,7 @@
<javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
- </pre-handler-chains>
+ </post-handler-chains>
</endpoint-config>
</jaxws-config>
Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-03-16 15:12:06 UTC (rev
2630)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-03-16 19:18:35 UTC (rev
2631)
@@ -128,22 +128,16 @@
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.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/ServerHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler*.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler*.class"/>
+ <include
name="org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler*.class"/>
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.class"/>
<include
name="org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml"/>
</classes>
+ <webinf
dir="${tests.output.dir}/resources/jaxws/handlerlifecycle/WEB-INF">
+ <include name="jaxws-endpoint-config.xml"/>
+ </webinf>
</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/ClientHandler.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">
Deleted:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -1,53 +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;
-
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-
-public class ClientHandler extends LifecycleHandler
-{
- @Override
- public boolean handleOutbound(MessageContext msgContext)
- {
- // set a handler prop
- msgContext.put("client-handler-prop", Boolean.TRUE);
-
- if (msgContext.get("client-req-prop") != Boolean.TRUE)
- throw new IllegalStateException("Cannot find client-req-prop");
-
- return super.handleOutbound(msgContext);
- }
-
- @Override
- public boolean handleInbound(MessageContext msgContext)
- {
- if (msgContext.get("client-handler-prop") != Boolean.TRUE)
- throw new IllegalStateException("Cannot find client-handler-prop");
-
- // set a app prop
- msgContext.put("client-res-prop", Boolean.TRUE);
- msgContext.setScope("client-res-prop", Scope.APPLICATION);
-
- return super.handleInbound(msgContext);
- }
-}
Copied:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler1.java
(from rev 2628,
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler.java)
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+public class ClientHandler1 extends LifecycleHandler
+{
+ protected boolean handleOutboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if (doNext &&
getTestMethod(msgContext).startsWith("testPropertyScoping"))
+ {
+ // set a handler prop
+ msgContext.put("client-handler-prop", Boolean.TRUE);
+
+ if (msgContext.get("client-req-prop") != Boolean.TRUE)
+ throw new IllegalStateException("Cannot find client-req-prop");
+ }
+ return doNext;
+ }
+
+ protected boolean handleInboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if (doNext &&
getTestMethod(msgContext).startsWith("testPropertyScoping"))
+ {
+ if (msgContext.get("client-handler-prop") != Boolean.TRUE)
+ throw new IllegalStateException("Cannot find
client-handler-prop");
+
+ // set a app prop
+ msgContext.put("client-res-prop", Boolean.TRUE);
+ msgContext.setScope("client-res-prop", Scope.APPLICATION);
+ }
+ return doNext;
+ }
+}
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+
+
+public class ClientHandler2 extends LifecycleHandler
+{
+ protected boolean handleOutboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if
(getTestMethod(msgContext).startsWith("testClientOutboundHandleMessageFalse"))
+ {
+ doNext = false;
+ }
+ else if
(getTestMethod(msgContext).startsWith("testClientOutboundHandleMessageThrowsRuntimeException"))
+ {
+ throw new WebServiceException("ErrorIn" + this);
+ }
+ return doNext;
+ }
+
+ protected boolean handleInboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if
(getTestMethod(msgContext).startsWith("testClientInboundHandleMessageFalse"))
+ {
+ doNext = false;
+ }
+ else if
(getTestMethod(msgContext).startsWith("testClientInboundHandleMessageThrowsRuntimeException"))
+ {
+ throw new WebServiceException("ErrorIn" + this);
+ }
+ return doNext;
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler3.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler3.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler3.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+
+
+public class ClientHandler3 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ClientHandler3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
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 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleClientTestCase.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -24,12 +24,14 @@
// $Id$
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
-import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
import junit.framework.Test;
@@ -46,7 +48,7 @@
{
private static SOAPEndpoint port;
private static TrackerEndpoint trackerPort;
-
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(HandlerLifecycleClientTestCase.class,
"jaxws-handlerlifecycle.war");
@@ -54,6 +56,14 @@
public void setUp() throws Exception
{
+ 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);
+ }
+
if (port == null)
{
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-handlerlifecycle/soap?wsdl");
@@ -61,44 +71,440 @@
Service service = Service.create(wsdlURL, serviceName);
port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
}
- if (trackerPort == null)
+ }
+
+ protected void tearDown() throws Exception
+ {
+ HandlerTracker.clearListMessages();
+ trackerPort.clearListMessages();
+ assertEquals("[]", HandlerTracker.getListMessages());
+ assertEquals("[]", trackerPort.getListMessages());
+ }
+
+ /**
+ * All handlers return true
+ */
+ public void testHandleMessageTrue() throws Exception
+ {
+ System.out.println("FIXME: [JBWS-1579] @EndpointConfig ignored on SEI");
+
+ String testResponse = port.runTest(getName());
+
+ String trackerMessages = HandlerTracker.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:PostConstruct");
+ expMessages.add("ClientHandler2:PostConstruct");
+ expMessages.add("ClientHandler3:PostConstruct");
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:InBound");
+ expMessages.add("ClientHandler2:Message:InBound");
+ expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = trackerPort.getListMessages();
+ expMessages = new ArrayList<String>();
+
+ // Handler construction
+ expMessages.add("PreServerHandler1:PostConstruct");
+ expMessages.add("PreServerHandler2:PostConstruct");
+ expMessages.add("ServerHandler1:PostConstruct");
+ expMessages.add("ServerHandler2:PostConstruct");
+ expMessages.add("ServerHandler3:PostConstruct");
+ expMessages.add("PostServerHandler1:PostConstruct");
+ expMessages.add("PostServerHandler2:PostConstruct");
+
+ // Inbound server message
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound");
+ expMessages.add("ServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler2:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:InBound");
+
+ // Pre/Post handler are defined in the context of outbound
+ expMessages.add("PreServerHandler1:Message:OutBound");
+ expMessages.add("PreServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler1:Message:OutBound");
+ expMessages.add("ServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler3:Message:OutBound");
+ expMessages.add("PostServerHandler1:Message:OutBound");
+ expMessages.add("PostServerHandler2:Message:OutBound");
+
+ // Handler closing
+ expMessages.add("PreServerHandler1:Close");
+ expMessages.add("PreServerHandler2:Close");
+ expMessages.add("ServerHandler1:Close");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ assertEquals(getName() + "Response", testResponse);
+ }
+
+ /**
+ * ClientHandler2 returns false on outbound
+ */
+ public void testClientOutboundHandleMessageFalse() throws Exception
+ {
+ String testResponse = port.runTest(getName());
+
+ String trackerMessages = HandlerTracker.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound:false");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = trackerPort.getListMessages();
+ expMessages = new ArrayList<String>();
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ assertNull(testResponse);
+ }
+
+ /**
+ * ClientHandler2 throws a RuntimeException on outbound
+ */
+ public void testClientOutboundHandleMessageThrowsRuntimeException() throws Exception
+ {
+ String testResponse;
+ try
{
- 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);
+ testResponse = port.runTest(getName());
+ fail("RuntimeException expected, but got: " + testResponse);
}
+ catch (WebServiceException ex)
+ {
+ testResponse = ex.getMessage();
+ }
+
+ String trackerMessages = HandlerTracker.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+
expMessages.add("ClientHandler2:Message:OutBound:ErrorInClientHandler2");
+ expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = trackerPort.getListMessages();
+ expMessages = new ArrayList<String>();
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ assertEquals("ErrorInClientHandler2", testResponse);
}
-
- public void testClientAccess() throws Exception
+
+ /**
+ * ServerHandler2 returns false on inbound
+ */
+ public void testServerInboundHandleMessageFalse() throws Exception
{
- Map<String, Object> reqContext =
((BindingProvider)port).getRequestContext();
- Map<String, Object> resContext =
((BindingProvider)port).getResponseContext();
- reqContext.put("client-req-prop", Boolean.TRUE);
+ String testResponse = port.runTest(getName());
+
+ String trackerMessages = trackerPort.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound:false");
+ expMessages.add("ServerHandler3:Message:OutBound");
+ expMessages.add("PostServerHandler1:Message:OutBound");
+ expMessages.add("PostServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = HandlerTracker.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:InBound");
+ expMessages.add("ClientHandler2:Message:InBound");
+ expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
- String retStr = port.echo("hello");
- assertEquals("hello", retStr);
+ assertEquals("testServerHandler2Response", testResponse);
+ }
+
+ /**
+ * ServerHandler2 trows a RuntimeException on inbound
+ */
+ public void testServerInboundHandleMessageThrowsRuntimeException() throws Exception
+ {
+ String testResponse;
+ try
+ {
+ testResponse = port.runTest(getName());
+ fail("RuntimeException expected, but got: " + testResponse);
+ }
+ catch (WebServiceException ex)
+ {
+ testResponse = ex.getMessage();
+ }
+
+ String trackerMessages = trackerPort.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound:ErrorInServerHandler2");
+ expMessages.add("ServerHandler3:Fault:OutBound");
+ expMessages.add("PostServerHandler1:Fault:OutBound");
+ expMessages.add("PostServerHandler2:Fault:OutBound");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = HandlerTracker.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Fault:InBound");
+ expMessages.add("ClientHandler2:Fault:InBound");
+ expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
- assertNull(resContext.get("client-handler-prop"));
- assertEquals(Boolean.TRUE, resContext.get("client-res-prop"));
+ assertEquals("ErrorInServerHandler2", testResponse);
}
-
- public void testTrackerMessages() throws Exception
+
+ /**
+ * ServerHandler2 returns false on outbound
+ */
+ public void testServerOutboundHandleMessageFalse() throws Exception
{
- String retStr = HandlerTracker.getListMessages();
- assertEquals("[ClientHandler:PostConstruct, ClientHandler:OutBound,
ClientHandler:InBound, ClientHandler:Close]", retStr);
+ String testResponse = port.runTest(getName());
+
+ String trackerMessages = trackerPort.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound");
+ expMessages.add("ServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler2:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:OutBound");
+ expMessages.add("PreServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler1:Message:OutBound");
+ expMessages.add("ServerHandler2:Message:OutBound:false");
+ expMessages.add("PreServerHandler1:Close");
+ expMessages.add("PreServerHandler2:Close");
+ expMessages.add("ServerHandler1:Close");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = HandlerTracker.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:InBound");
+ expMessages.add("ClientHandler2:Message:InBound");
+ expMessages.add("ClientHandler1:Message:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
- retStr = trackerPort.getListMessages();
- assertEquals("[ServerHandler:PostConstruct, ServerHandler:InBound,
ServerHandler:OutBound, ServerHandler:Close]", retStr);
-
+ assertEquals(getName() + "Response", testResponse);
}
- public void testClearTrackerData() throws Exception
+ /**
+ * ServerHandler2 trows a RuntimeException on outbound
+ */
+ public void testServerOutboundHandleMessageThrowsRuntimeException() throws Exception
{
- HandlerTracker.clearListMessages();
- trackerPort.clearListMessages();
+ String testResponse;
+ try
+ {
+ testResponse = port.runTest(getName());
+ fail("RuntimeException expected, but got: " + testResponse);
+ }
+ catch (WebServiceException ex)
+ {
+ testResponse = ex.getMessage();
+ }
+
+ String trackerMessages = trackerPort.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound");
+ expMessages.add("ServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler2:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:OutBound");
+ expMessages.add("PreServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler1:Message:OutBound");
+
expMessages.add("ServerHandler2:Message:OutBound:ErrorInServerHandler2");
+ expMessages.add("ServerHandler3:Fault:OutBound");
+ expMessages.add("PostServerHandler1:Fault:OutBound");
+ expMessages.add("PostServerHandler2:Fault:OutBound");
+ expMessages.add("PreServerHandler1:Close");
+ expMessages.add("PreServerHandler2:Close");
+ expMessages.add("ServerHandler1:Close");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = HandlerTracker.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Fault:InBound");
+ expMessages.add("ClientHandler2:Fault:InBound");
+ expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
- assertEquals("[]", HandlerTracker.getListMessages());
- assertEquals("[]", trackerPort.getListMessages());
+ assertEquals("ErrorInServerHandler2", testResponse);
}
+
+ /**
+ * ClientHandler2 returns false on inbound
+ */
+ public void testClientInboundHandleMessageFalse() throws Exception
+ {
+ String testResponse = port.runTest(getName());
+
+ String trackerMessages = HandlerTracker.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:InBound");
+ expMessages.add("ClientHandler2:Message:InBound:false");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = trackerPort.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound");
+ expMessages.add("ServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler2:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:OutBound");
+ expMessages.add("PreServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler1:Message:OutBound");
+ expMessages.add("ServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler3:Message:OutBound");
+ expMessages.add("PostServerHandler1:Message:OutBound");
+ expMessages.add("PostServerHandler2:Message:OutBound");
+ expMessages.add("PreServerHandler1:Close");
+ expMessages.add("PreServerHandler2:Close");
+ expMessages.add("ServerHandler1:Close");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ assertEquals(getName() + "Response", testResponse);
+ }
+
+ /**
+ * ClientHandler2 throws a RuntimeException on intbound
+ */
+ public void testClientInboundHandleMessageThrowsRuntimeException() throws Exception
+ {
+ String testResponse;
+ try
+ {
+ testResponse = port.runTest(getName());
+ fail("RuntimeException expected, but got: " + testResponse);
+ }
+ catch (WebServiceException ex)
+ {
+ testResponse = ex.getMessage();
+ }
+
+ String trackerMessages = HandlerTracker.getListMessages();
+ List<String> expMessages = new ArrayList<String>();
+ expMessages.add("ClientHandler1:Message:OutBound");
+ expMessages.add("ClientHandler2:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:OutBound");
+ expMessages.add("ClientHandler3:Message:InBound");
+ expMessages.add("ClientHandler2:Message:InBound:ErrorInClientHandler2");
+ expMessages.add("ClientHandler1:Fault:InBound");
+ expMessages.add("ClientHandler3:Close");
+ expMessages.add("ClientHandler2:Close");
+ expMessages.add("ClientHandler1:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ trackerMessages = trackerPort.getListMessages();
+ expMessages = new ArrayList<String>();
+ expMessages.add("PostServerHandler2:Message:InBound");
+ expMessages.add("PostServerHandler1:Message:InBound");
+ expMessages.add("ServerHandler3:Message:InBound");
+ expMessages.add("ServerHandler2:Message:InBound");
+ expMessages.add("ServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler2:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:InBound");
+ expMessages.add("PreServerHandler1:Message:OutBound");
+ expMessages.add("PreServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler1:Message:OutBound");
+ expMessages.add("ServerHandler2:Message:OutBound");
+ expMessages.add("ServerHandler3:Message:OutBound");
+ expMessages.add("PostServerHandler1:Message:OutBound");
+ expMessages.add("PostServerHandler2:Message:OutBound");
+ expMessages.add("PreServerHandler1:Close");
+ expMessages.add("PreServerHandler2:Close");
+ expMessages.add("ServerHandler1:Close");
+ expMessages.add("ServerHandler2:Close");
+ expMessages.add("ServerHandler3:Close");
+ expMessages.add("PostServerHandler1:Close");
+ expMessages.add("PostServerHandler2:Close");
+ assertEquals(expMessages.toString(), trackerMessages);
+
+ assertEquals("ErrorInClientHandler2", testResponse);
+ }
+
+ public void testPropertyScoping() throws Exception
+ {
+ Map<String, Object> reqContext =
((BindingProvider)port).getRequestContext();
+ Map<String, Object> resContext =
((BindingProvider)port).getResponseContext();
+ reqContext.put("client-req-prop", Boolean.TRUE);
+
+ String retStr = port.runTest(getName());
+ assertEquals(getName() + "Response", retStr);
+
+ assertNull(resContext.get("client-handler-prop"));
+ assertEquals(Boolean.TRUE, resContext.get("client-res-prop"));
+ }
}
Deleted:
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 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerLifecycleServletTestCase.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -1,75 +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.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);
- }
-}
Modified:
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 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/HandlerTracker.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -44,41 +44,48 @@
public static void reportHandlePostConstruct(Handler handler)
{
String msg = handler + ":PostConstruct";
- log.info(msg + " to vector: " + System.identityHashCode(messages));
+ log.debug(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));
+ log.debug(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));
+ String msg = handler + ":Message:" + direction;
+ log.debug(msg + " to vector: " + System.identityHashCode(messages));
messages.add(msg);
}
+ public static void reportHandleFault(Handler handler, String direction)
+ {
+ String msg = handler + ":Fault:" + direction;
+ log.debug(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));
+ log.debug(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());
+ log.debug("getListMessages from vector: " +
System.identityHashCode(messages));
+ log.debug(messages.toString());
return messages.toString();
}
public static void clearListMessages()
{
- log.info("clearListMessages from vector: " +
System.identityHashCode(messages));
+ log.debug("clearListMessages from vector: " +
System.identityHashCode(messages));
messages.clear();
}
}
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-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/LifecycleHandler.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -21,36 +21,33 @@
*/
package org.jboss.test.ws.jaxws.handlerlifecycle;
+import java.util.HashSet;
+import java.util.Set;
+
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
-public abstract class LifecycleHandler extends GenericSOAPHandler
+public abstract class LifecycleHandler implements SOAPHandler
{
private static Logger log = Logger.getLogger(LifecycleHandler.class);
public LifecycleHandler()
{
- log.info("new LifecycleHandler");
+ log.debug("new " + this);
}
- @Override
- public boolean handleOutbound(MessageContext msgContext)
+ public Set getHeaders()
{
- HandlerTracker.reportHandleMessage(this, "OutBound");
- return true;
+ return new HashSet();
}
- @Override
- public boolean handleInbound(MessageContext msgContext)
- {
- HandlerTracker.reportHandleMessage(this, "InBound");
- return true;
- }
-
@PostConstruct
public void postConstruct()
{
@@ -63,8 +60,159 @@
HandlerTracker.reportHandlePreDestroy(this);
}
+ public boolean handleMessage(MessageContext msgContext)
+ {
+ boolean doNext = isOutbound(msgContext) ? handleOutboundMessageInternal(msgContext)
: handleInboundMessageInternal(msgContext);
+ return doNext;
+ }
+
+ private boolean handleOutboundMessageInternal(MessageContext msgContext)
+ {
+ String trackerMessage = "OutBound";
+
+ boolean doNext;
+ try
+ {
+ doNext = handleOutboundMessage(msgContext);
+ if (doNext == false)
+ trackerMessage += ":false";
+
+ HandlerTracker.reportHandleMessage(this, trackerMessage);
+ }
+ catch (RuntimeException rte)
+ {
+ HandlerTracker.reportHandleMessage(this, trackerMessage + ":" +
rte.getMessage());
+ throw rte;
+ }
+ return doNext;
+ }
+
+ private boolean handleInboundMessageInternal(MessageContext msgContext)
+ {
+ String trackerMessage = "InBound";
+
+ boolean doNext;
+ try
+ {
+ doNext = handleInboundMessage(msgContext);
+ if (doNext == false)
+ trackerMessage += ":false";
+
+ HandlerTracker.reportHandleMessage(this, trackerMessage);
+ }
+ catch (RuntimeException rte)
+ {
+ HandlerTracker.reportHandleMessage(this, trackerMessage + ":" +
rte.getMessage());
+ throw rte;
+ }
+ return doNext;
+ }
+
+ protected boolean handleOutboundMessage(MessageContext msgContext)
+ {
+ return true;
+ }
+
+ protected boolean handleInboundMessage(MessageContext msgContext)
+ {
+ return true;
+ }
+
+ public boolean handleFault(MessageContext msgContext)
+ {
+ boolean doNext = isOutbound(msgContext) ? handleOutboundFaultInternal(msgContext) :
handleInboundFaultInternal(msgContext);
+ return doNext;
+ }
+
+ private boolean handleOutboundFaultInternal(MessageContext msgContext)
+ {
+ String trackerMessage = "OutBound";
+
+ boolean doNext;
+ try
+ {
+ doNext = handleOutboundFault(msgContext);
+ if (doNext == false)
+ trackerMessage += ":false";
+
+ HandlerTracker.reportHandleFault(this, trackerMessage);
+ }
+ catch (RuntimeException rte)
+ {
+ HandlerTracker.reportHandleFault(this, trackerMessage + ":" +
rte.getMessage());
+ throw rte;
+ }
+ return doNext;
+ }
+
+ private boolean handleInboundFaultInternal(MessageContext msgContext)
+ {
+ String trackerMessage = "InBound";
+
+ boolean doNext;
+ try
+ {
+ doNext = handleInboundFault(msgContext);
+ if (doNext == false)
+ trackerMessage += ":false";
+
+ HandlerTracker.reportHandleFault(this, trackerMessage);
+ }
+ catch (RuntimeException rte)
+ {
+ HandlerTracker.reportHandleFault(this, trackerMessage + ":" +
rte.getMessage());
+ throw rte;
+ }
+ return doNext;
+ }
+
+ protected boolean handleOutboundFault(MessageContext msgContext)
+ {
+ return true;
+ }
+
+ protected boolean handleInboundFault(MessageContext msgContext)
+ {
+ return true;
+ }
+
public void close(MessageContext messageContext)
{
HandlerTracker.reportHandleClose(this);
}
+
+ protected String getTestMethod(MessageContext msgContext)
+ {
+ String testMethod;
+ try
+ {
+ SOAPElement soapElement =
(SOAPElement)((SOAPMessageContext)msgContext).getMessage().getSOAPBody().getChildElements().next();
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ testMethod = soapElement.getValue();
+ }
+ catch (SOAPException e)
+ {
+ throw new IllegalStateException("Cannot obtain test method");
+ }
+
+ if (testMethod.startsWith("test") == false)
+ throw new IllegalStateException("Cannot find test method: " +
testMethod);
+
+ return testMethod;
+ }
+
+ protected Boolean isOutbound(MessageContext msgContext)
+ {
+ Boolean outbound =
(Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ if (outbound == null)
+ throw new IllegalStateException("Cannot find property: " +
MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ return outbound;
+ }
+
+ public String toString()
+ {
+ String handlerName = getClass().getName();
+ return handlerName.substring(handlerName.lastIndexOf(".") + 1);
+ }
}
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler1.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PostClientHandler1 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler1.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PostClientHandler2 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostClientHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler1.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PostServerHandler1 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler1.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PostServerHandler2 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PostServerHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler1.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PreClientHandler1 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler1.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PreClientHandler2 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreClientHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler1.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PreServerHandler1 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler1.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+public class PreServerHandler2 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/PreServerHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpoint.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -27,10 +27,13 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
+import org.jboss.ws.annotation.EndpointConfig;
+
@WebService
@HandlerChain(file = "jaxws-client-handlers.xml")
+@EndpointConfig(configName = "Custom Client Config", configFile =
"META-INF/jaxws-client-config.xml")
public interface SOAPEndpoint
{
@WebMethod
- public String echo(String msg);
+ public String runTest(String testName);
}
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-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/SOAPEndpointBean.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -23,6 +23,9 @@
// $Id$
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import javax.annotation.Resource;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
@@ -33,10 +36,13 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
+import org.jboss.ws.annotation.EndpointConfig;
@WebService(name = "SOAPEndpoint", targetNamespace =
"http://org.jboss.ws/jaxws/handlerlifecycle")
@HandlerChain(file = "jaxws-server-handlers.xml")
@SOAPBinding(style = Style.RPC)
+
+@EndpointConfig(configName = "Custom Server Config", configFile =
"WEB-INF/jaxws-endpoint-config.xml")
public class SOAPEndpointBean
{
private static Logger log = Logger.getLogger(SOAPEndpointBean.class);
@@ -45,17 +51,38 @@
public WebServiceContext wsContext;
@WebMethod
- public String echo(String msg)
+ public String runTest(String testName)
{
- log.info("echo: " + msg);
+ log.info("runTest: " + testName);
+ try
+ {
+ Method method = getClass().getDeclaredMethod(testName, new Class[]{});
+ method.invoke(this, new Object[]{});
+ }
+ catch (NoSuchMethodException ex)
+ {
+ // ignore this
+ }
+ catch (InvocationTargetException ex)
+ {
+ throw new IllegalStateException("Cannot invoke test method: " +
testName, ex.getTargetException());
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot test method: " + testName);
+ }
+
+ return testName + "Response";
+ }
+
+ public void testPropertyScoping()
+ {
MessageContext msgContext = wsContext.getMessageContext();
if (msgContext.get("server-handler-prop") != null)
throw new IllegalStateException("Found server-handler-prop");
if (msgContext.get("server-app-prop") != Boolean.TRUE)
throw new IllegalStateException("Cannot find server-app-prop");
-
- return msg;
}
}
Deleted:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler.java 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -1,53 +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;
-
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-
-public class ServerHandler extends LifecycleHandler
-{
- @Override
- public boolean handleInbound(MessageContext msgContext)
- {
- // set a handler prop
- msgContext.put("server-handler-prop", Boolean.TRUE);
-
- // set a app prop
- msgContext.put("server-app-prop", Boolean.TRUE);
- msgContext.setScope("server-app-prop", Scope.APPLICATION);
-
- return super.handleInbound(msgContext);
- }
-
- @Override
- public boolean handleOutbound(MessageContext msgContext)
- {
- if (msgContext.get("server-handler-prop") != Boolean.TRUE)
- throw new IllegalStateException("Cannot find server-handler-prop");
-
- if (msgContext.get("server-app-prop") != Boolean.TRUE)
- throw new IllegalStateException("Cannot find server-app-prop");
-
- return super.handleOutbound(msgContext);
- }
-}
Copied:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler1.java
(from rev 2628,
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler.java)
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler1.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler1.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+
+public class ServerHandler1 extends LifecycleHandler
+{
+ protected boolean handleOutboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if (doNext &&
getTestMethod(msgContext).startsWith("testPropertyScoping"))
+ {
+ if (msgContext.get("server-handler-prop") != Boolean.TRUE)
+ throw new IllegalStateException("Cannot find
server-handler-prop");
+
+ if (msgContext.get("server-app-prop") != Boolean.TRUE)
+ throw new IllegalStateException("Cannot find server-app-prop");
+ }
+ return doNext;
+ }
+
+ protected boolean handleInboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if (doNext &&
getTestMethod(msgContext).startsWith("testPropertyScoping"))
+ {
+ // set a handler prop
+ msgContext.put("server-handler-prop", Boolean.TRUE);
+
+ // set a app prop
+ msgContext.put("server-app-prop", Boolean.TRUE);
+ msgContext.setScope("server-app-prop", Scope.APPLICATION);
+ }
+ return doNext;
+ }
+}
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler2.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler2.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler2.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,82 @@
+/*
+ * 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;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+public class ServerHandler2 extends LifecycleHandler
+{
+ protected boolean handleInboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if
(getTestMethod(msgContext).startsWith("testServerInboundHandleMessageFalse"))
+ {
+ String resEnv =
+ "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Body>" +
+ " <ns1:runTestResponse
xmlns:ns1='http://org.jboss.ws/jaxws/handlerlifecycle'>" +
+ " <return
xmlns=''>testServerHandler2Response</return>" +
+ " </ns1:runTestResponse>" +
+ " </env:Body>" +
+ "</env:Envelope>";
+
+ try
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage resMessage = factory.createMessage(null, new
ByteArrayInputStream(resEnv.getBytes()));
+ SOAPMessageContext soapContext = (SOAPMessageContext)msgContext;
+ soapContext.setMessage(resMessage);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Cannot attach response message");
+ }
+
+ doNext = false;
+ }
+ else if
(getTestMethod(msgContext).startsWith("testServerInboundHandleMessageThrowsRuntimeException"))
+ {
+ throw new WebServiceException("ErrorIn" + this);
+ }
+ return doNext;
+ }
+
+ protected boolean handleOutboundMessage(MessageContext msgContext)
+ {
+ boolean doNext = true;
+ if
(getTestMethod(msgContext).startsWith("testServerOutboundHandleMessageFalse"))
+ {
+ doNext = false;
+ }
+ else if
(getTestMethod(msgContext).startsWith("testServerOutboundHandleMessageThrowsRuntimeException"))
+ {
+ throw new WebServiceException("ErrorIn" + this);
+ }
+ return doNext;
+ }
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler3.java
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler3.java
(rev 0)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler3.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+
+
+public class ServerHandler3 extends LifecycleHandler
+{
+}
Property changes on:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServerHandler3.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
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 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/ServletClient.java 2007-03-16
19:18:35 UTC (rev 2631)
@@ -1,117 +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.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.WebServiceRef;
-
-import org.jboss.logging.Logger;
-
-public class ServletClient extends HttpServlet
-{
- private static Logger log = Logger.getLogger(ServletClient.class);
-
- @WebServiceRef(wsdlLocation =
"http://localhost:8080/jaxws-handlerlifecycle/soap?wsdl")
- public static SOAPEndpoint port;
-
- @WebServiceRef(wsdlLocation =
"http://localhost:8080/jaxws-handlerlifecycle/tracker?wsdl")
- private TrackerEndpoint trackerPort;
-
- 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 (InvocationTargetException ex)
- {
- log.error(ex.getTargetException());
- message = ex.getTargetException().toString();
- }
- catch (Exception ex)
- {
- log.error(ex);
- message = ex.toString();
- }
-
- res.getWriter().println(message);
- }
-
- public void testClientAccess() throws Exception
- {
- Map<String, Object> reqContext =
((BindingProvider)port).getRequestContext();
- Map<String, Object> resContext =
((BindingProvider)port).getResponseContext();
- reqContext.put("client-req-prop", Boolean.TRUE);
-
- String retStr = port.echo("hello");
- assertEquals("hello", retStr);
-
- assertNull(resContext.get("client-handler-prop"));
- assertEquals(Boolean.TRUE, resContext.get("client-res-prop"));
- }
-
- 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(Object exp, Object was)
- {
- if (exp.equals(was) == false)
- throw new RuntimeException("Expected <" + exp + "> but was
<" + was + ">");
- }
-
- private void assertNull(Object object)
- {
- if (object != null)
- throw new RuntimeException("Expected null");
- }
-}
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-client-handlers.xml
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-client-handlers.xml 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-client-handlers.xml 2007-03-16
19:18:35 UTC (rev 2631)
@@ -7,9 +7,17 @@
<handler-chain>
<handler>
- <handler-name> ClientHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ClientHandler
</handler-class>
+ <handler-name> ClientHandler1 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ClientHandler1
</handler-class>
</handler>
+ <handler>
+ <handler-name> ClientHandler2 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ClientHandler2
</handler-class>
+ </handler>
+ <handler>
+ <handler-name> ClientHandler3 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ClientHandler3
</handler-class>
+ </handler>
</handler-chain>
</handler-chains>
\ No newline at end of file
Modified:
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml
===================================================================
---
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml 2007-03-16
15:12:06 UTC (rev 2630)
+++
trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/handlerlifecycle/jaxws-server-handlers.xml 2007-03-16
19:18:35 UTC (rev 2631)
@@ -7,9 +7,17 @@
<handler-chain>
<handler>
- <handler-name> ServerHandler </handler-name>
- <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ServerHandler
</handler-class>
+ <handler-name> ServerHandler1 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ServerHandler1
</handler-class>
</handler>
+ <handler>
+ <handler-name> ServerHandler2 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ServerHandler2
</handler-class>
+ </handler>
+ <handler>
+ <handler-name> ServerHandler3 </handler-name>
+ <handler-class> org.jboss.test.ws.jaxws.handlerlifecycle.ServerHandler3
</handler-class>
+ </handler>
</handler-chain>
</handler-chains>
\ No newline at end of file
Added:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/jaxws-client-config.xml
===================================================================
---
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/jaxws-client-config.xml
(rev 0)
+++
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/jaxws-client-config.xml 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jaxws-config:2.0
jaxws-config_2_0.xsd">
+
+ <client-config>
+ <config-name> Custom Client Config </config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name> PreClientHandler1
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PreClientHandler1</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name> PreClientHandler2
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PreClientHandler2</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ <post-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name> PostClientHandler1
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PostClientHandler1</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name> PostClientHandler2
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PostClientHandler2</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </client-config>
+
+</jaxws-config>
\ No newline at end of file
Property changes on:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/META-INF/jaxws-client-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/jaxws-endpoint-config.xml
===================================================================
---
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/jaxws-endpoint-config.xml
(rev 0)
+++
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/jaxws-endpoint-config.xml 2007-03-16
19:18:35 UTC (rev 2631)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
+ xsi:schemaLocation="urn:jboss:jaxws-config:2.0
jaxws-config_2_0.xsd">
+
+ <client-config>
+ <config-name> Custom Server Config </config-name>
+ <pre-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name> PreServerHandler1
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PreServerHandler1</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name> PreServerHandler2
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PreServerHandler2</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </pre-handler-chains>
+ <post-handler-chains>
+ <javaee:handler-chain>
+ <javaee:handler>
+ <javaee:handler-name> PostServerHandler1
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PostServerHandler1</javaee:handler-class>
+ </javaee:handler>
+ <javaee:handler>
+ <javaee:handler-name> PostServerHandler2
</javaee:handler-name>
+
<javaee:handler-class>org.jboss.test.ws.jaxws.handlerlifecycle.PostServerHandler2</javaee:handler-class>
+ </javaee:handler>
+ </javaee:handler-chain>
+ </post-handler-chains>
+ </client-config>
+
+</jaxws-config>
\ No newline at end of file
Property changes on:
trunk/jbossws-tests/src/resources/jaxws/handlerlifecycle/WEB-INF/jaxws-endpoint-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF