JBossWS SVN: r16416 - in stack/cxf/trunk/modules/server/src: test/java/org/jboss/wsf/stack/cxf and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-20 06:58:57 -0400 (Wed, 20 Jun 2012)
New Revision: 16416
Added:
stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
Log:
[JBWS-3522] Updating JBossWSInvoker to re-use existing Apache CXF Invoker hierarchy and limit the additions over that to the minimum to ease future new features integration
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2012-06-19 09:20:50 UTC (rev 16415)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2012-06-20 10:58:57 UTC (rev 16416)
@@ -39,39 +39,22 @@
*/
package org.jboss.wsf.stack.cxf;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import javax.activation.DataHandler;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-import javax.xml.ws.soap.SOAPFaultException;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.attachment.AttachmentImpl;
-import org.apache.cxf.binding.soap.SoapFault;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.service.invoker.MethodDispatcher;
-import org.apache.cxf.headers.Header;
import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
-import org.apache.cxf.jaxws.context.WrappedMessageContext;
-import org.apache.cxf.message.Attachment;
+import org.apache.cxf.jaxws.JAXWSMethodInvoker;
import org.apache.cxf.message.Exchange;
-import org.apache.cxf.message.FaultMode;
-import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageContentsList;
import org.apache.cxf.service.Service;
+import org.apache.cxf.service.invoker.Factory;
import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.invoker.MethodDispatcher;
import org.apache.cxf.service.model.BindingOperationInfo;
import org.jboss.ws.api.util.ServiceLoader;
import org.jboss.wsf.spi.SPIProvider;
@@ -85,271 +68,120 @@
import org.jboss.wsf.spi.invocation.WebServiceContextFactory;
/**
- * An abstract CXF invoker
+ * A JBossWS extension of the Apache CXF JAXWSMethodInvoker invoker.
*
+ * The invocation flow is as follows:
+ *
+ * ServiceInvokerInterceptor::handleMessage(Message m)
+ * |
+ * v
+ * JBossWSInvoker::invoke(Exchange e, Object o)
+ * |
+ * v
+ * JAXWSMethodInvoker::invoke(Exchange e, Object o, Method m, Object[] o2)
+ * |
+ * v
+ * AbstractJAXSMethodInvoker::invoke(Exchange e, Object o, Method m, Object[] o2)
+ * |
+ * v
+ * FactoryMethodInvoker::invoke(Exchange e, Object o, Method m, Object[] o2)
+ * |
+ * v
+ * AbstractInvoker::invoke(Exchange e, Object o, Method m, Object[] o2)
+ * |
+ * v
+ * JBossWSInvoker::performInvocation(Exchange e, Object o, Method m, Object[] o2)
+ *
+ *
+ * @author alessio.soldano(a)jboss.com
* @author Thomas.Diesler(a)jboss.org
* @author richard.opalka(a)jboss.com
- * @author alessio.soldano(a)jboss.com
*
* @see org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker
*/
-public final class JBossWSInvoker implements Invoker
+public class JBossWSInvoker extends JAXWSMethodInvoker implements Invoker
{
- private static final Object[] NO_ARGS = new Object[]{};
private Object targetBean;
private WebServiceContextFactory contextFactory;
private NamespaceContextSelectorWrapperFactory nsCtxSelectorFactory;
-
+
public JBossWSInvoker() {
+ super((Factory)null); //no need for a factory
ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
nsCtxSelectorFactory = (NamespaceContextSelectorWrapperFactory) ServiceLoader.loadService(
NamespaceContextSelectorWrapperFactory.class.getName(), null, cl);
}
-
- public void setTargetBean(Object targetBean)
- {
+
+ public void setTargetBean(Object targetBean) {
this.targetBean = targetBean;
}
-
+
+ /**
+ * This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBoss AS target bean
+ * and simplifying the business method matching
+ */
+ @Override
public Object invoke(Exchange exchange, Object o)
{
- // set up the webservice request context
- WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);
-
- Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);
-
- WebServiceContextImpl.setMessageContext(ctx);
- setNamespaceContextSelector(exchange);
-
- Object retObj = null;
- try
- {
- retObj = _invokeInternal(exchange, o, ctx);
-
- addHandlerProperties(ctx, handlerScopedStuff);
-
- //update the webservice response context
- updateWebServiceContext(exchange, ctx);
+ BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
+ MethodDispatcher md = (MethodDispatcher) exchange.get(Service.class).get(MethodDispatcher.class.getName());
+ List<Object> params = null;
+ if (o instanceof List) {
+ params = CastUtils.cast((List<?>) o);
+ } else if (o != null) {
+ params = new MessageContentsList(o);
}
- finally
- {
- //clear the WebServiceContextImpl's ThreadLocal variable
- WebServiceContextImpl.clear();
- //also cleanup namespace context selector
- clearNamespaceContextSelector(exchange);
- }
-
- return new MessageContentsList(retObj);
+ return invoke(exchange, targetBean, adjustMethodAndParams(md.getMethod(bop), exchange, params), params);
}
- private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)
+ /**
+ * This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic
+ * to invoke the JBoss AS target bean.
+ */
+ @Override
+ protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray)
+ throws Exception
{
- BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
- MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());
- Method m = md.getMethod(bop);
-
- Object[] params = NO_ARGS;
- List<Object> paramList = null;
- if (m.getParameterTypes().length != 0)
- {
- if (o instanceof List<?>)
- {
- paramList = CastUtils.cast((List<?>)o);
- params = paramList.toArray();
- }
- else
- {
- params = new Object[]{o};
- }
- }
-
Endpoint ep = exchange.get(Endpoint.class);
- InvocationHandler invHandler = ep.getInvocationHandler();
-
- Invocation inv = invHandler.createInvocation();
- InvocationContext invContext = inv.getInvocationContext();
- invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
- invContext.addAttachment(MessageContext.class, ctx);
- invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
- inv.setJavaMethod(m);
- inv.setArgs(params);
-
- Object retObj = null;
+ final InvocationHandler invHandler = ep.getInvocationHandler();
+ final Invocation inv = createInvocation(invHandler, ep, m, paramArray);
+
Bus threadBus = BusFactory.getThreadDefaultBus(false);
- try
- {
- BusFactory.setThreadDefaultBus(null);
+ BusFactory.setThreadDefaultBus(null);
+ setNamespaceContextSelector(exchange);
+
+ try {
invHandler.invoke(ep, inv);
- retObj = inv.getReturnValue();
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t == null) {
- t = e;
- }
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- for (Class<?> cl : m.getExceptionTypes()) {
- if (cl.isInstance(t)) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- }
- }
-
- if (t instanceof Fault) {
- exchange.getInMessage().put(FaultMode.class,
- FaultMode.CHECKED_APPLICATION_FAULT);
- throw (Fault)t;
- }
- throw createFault(t, m, paramList, true);
- } catch (Fault f) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw f;
- } catch (Exception e) {
- exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
- throw createFault(e, m, paramList, false);
- }
- finally
- {
+ return inv.getReturnValue();
+ } finally {
//make sure the right bus is restored after coming back from the endpoint method
BusFactory.setThreadDefaultBus(threadBus);
- // JBWS-2486
- if (ep.getAttachment(Object.class) == null)
- {
+ if (ep.getAttachment(Object.class) == null) { //JBWS-2486
ep.addAttachment(Object.class, inv.getInvocationContext().getTargetBean());
}
+ clearNamespaceContextSelector(exchange);
}
-
- return retObj;
}
- protected SOAPFaultException findSoapFaultException(Throwable ex) {
- if (ex instanceof SOAPFaultException) {
- return (SOAPFaultException)ex;
- }
- if (ex.getCause() != null) {
- return findSoapFaultException(ex.getCause());
- }
- return null;
- }
-
- protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) {
- //map the JAX-WS faults
- SOAPFaultException sfe = findSoapFaultException(ex);
- if (sfe != null) {
- SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
- sfe,
- sfe.getFault().getFaultCodeAsQName());
- fault.setRole(sfe.getFault().getFaultActor());
- fault.setDetail(sfe.getFault().getDetail());
-
- return fault;
- }
-
- return new Fault(ex);
- }
+ private Invocation createInvocation(InvocationHandler invHandler, Endpoint ep, Method m, Object[] paramArray) {
+ Invocation inv = invHandler.createInvocation();
+ InvocationContext invContext = inv.getInvocationContext();
+ WebServiceContext wsCtx = getWebServiceContext(null);
+ invContext.addAttachment(WebServiceContext.class, wsCtx);
+ invContext.addAttachment(MessageContext.class, wsCtx.getMessageContext());
+ invContext.setTargetBean(targetBean != null ? targetBean : ep.getAttachment(Object.class)); //JBWS-2486 - JBWS-3002
+ inv.setJavaMethod(m);
+ inv.setArgs(paramArray);
+ return inv;
+ }
-
protected WebServiceContext getWebServiceContext(MessageContext msgCtx)
{
return getWebServiceContextFactory().newWebServiceContext(msgCtx);
}
- protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx)
+ protected void setNamespaceContextSelector(Exchange exchange)
{
- Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
- Map<String, Object> handlerScopedStuff = new HashMap<String, Object>();
- if (scopes != null)
- {
- for (Map.Entry<String, Scope> scope : scopes.entrySet())
- {
- if (scope.getValue() == Scope.HANDLER)
- {
- handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
- }
- }
- for (String key : handlerScopedStuff.keySet())
- {
- ctx.remove(key);
- }
- }
- return handlerScopedStuff;
- }
-
- protected void updateWebServiceContext(Exchange exchange, MessageContext ctx)
- {
- // Guard against wrong type associated with header list.
- // Need to copy header only if the message is going out.
- if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>)
- {
- List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
- if (list != null && !list.isEmpty()) {
- SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
- if (sm != null)
- {
- Iterator<?> iter = list.iterator();
- while (iter.hasNext())
- {
- sm.getHeaders().add((Header) iter.next());
- }
- }
- }
- }
- if (exchange.getOutMessage() != null)
- {
- Message out = exchange.getOutMessage();
- if (out.containsKey(Message.PROTOCOL_HEADERS))
- {
- Map<String, List<String>> heads = CastUtils
- .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS));
- if (heads.containsKey("Content-Type")) {
- List<String> ct = heads.get("Content-Type");
- exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0));
- heads.remove("Content-Type");
- }
- }
- Map<String, DataHandler> dataHandlers
- = CastUtils.cast((Map<?, ?>)out.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS));
- if (dataHandlers != null && !dataHandlers.isEmpty())
- {
- Collection<Attachment> attachments = out.getAttachments();
- if (attachments == null)
- {
- attachments = new ArrayList<Attachment>();
- out.setAttachments(attachments);
- }
- for (Map.Entry<String, DataHandler> entry : dataHandlers.entrySet())
- {
- Attachment att = new AttachmentImpl(entry.getKey(), entry.getValue());
- attachments.add(att);
- }
- }
- out.remove(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
- }
- }
-
- private Message createResponseMessage(Exchange exchange)
- {
- if (exchange == null) {
- return null;
- }
- Message m = exchange.getOutMessage();
- if (m == null && !exchange.isOneWay())
- {
- org.apache.cxf.endpoint.Endpoint ep = exchange.get(org.apache.cxf.endpoint.Endpoint.class);
- m = ep.getBinding().createMessage();
- exchange.setOutMessage(m);
- }
- return m;
- }
-
- protected void addHandlerProperties(WrappedMessageContext ctx, Map<String, Object> handlerScopedStuff)
- {
- for (Map.Entry<String, Object> key : handlerScopedStuff.entrySet())
- {
- ctx.put(key.getKey(), key.getValue(), Scope.HANDLER);
- }
- }
-
- protected void setNamespaceContextSelector(Exchange exchange) {
if (exchange.isOneWay() && nsCtxSelectorFactory != null)
{
nsCtxSelectorFactory.getWrapper().setCurrentThreadSelector(exchange);
@@ -374,5 +206,4 @@
}
return contextFactory;
}
-
}
Added: stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java
===================================================================
--- stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/test/java/org/jboss/wsf/stack/cxf/JBossWSInvokerTest.java 2012-06-20 10:58:57 UTC (rev 16416)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.xml.ws.WebServiceContext;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.ServiceImpl;
+import org.apache.cxf.service.invoker.MethodDispatcher;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+
+
+/**
+ * A test case for CXF Invoker integration
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 20-Jun-2012
+ *
+ */
+public class JBossWSInvokerTest extends TestCase
+{
+ /**
+ * The JBossWSInvoker internals rely on the Apache CXF side of the Invoker abstraction to properly
+ * set the generated WrappedMessageContext into the WebServiceContextImpl's threadlocal. As a consequence,
+ * the JBossWSInvoker::performInvocation method can build up the JBoss integration WebServiceContext without
+ * needing to pass in a MessageContext, as the properly created one is automatically retrieved internally
+ * using the Apache CXF thread local. This all however assumes the Invoker inheritance tree is not erroneously
+ * changed or the integration is not inadvertently broken in some way.
+ * This test hence verifies the MessageContext instance is available inside the performInvocation method.
+ */
+ public void testMessageContextThreadLocal()
+ {
+ TestInvoker invoker = new TestInvoker();
+ Exchange exchange = getTestExchange();
+ Object obj = invoker.invoke(exchange, null);
+ String res = obj instanceof List<?> ? ((List<?>)obj).get(0).toString() : obj.toString();
+ assertEquals("OK", res);
+ }
+
+ private static class TestInvoker extends JBossWSInvoker
+ {
+ @Override
+ protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray)
+ throws Exception
+ {
+ WebServiceContext wsCtx = getWebServiceContext(null);
+ return wsCtx.getMessageContext() != null ? "OK" : "FAIL";
+ }
+ }
+
+ //build up a fake exchange instance, the minimum required to let the flow proceed till the JBossWSInvoker
+ private Exchange getTestExchange() {
+ Exchange exchange = new ExchangeImpl();
+ Message message = new MessageImpl();
+ message.setExchange(exchange);
+ exchange.setInMessage(message);
+ Service service = new ServiceImpl();
+ MethodDispatcher md = new MethodDispatcher() {
+ @Override
+ public Method getMethod(BindingOperationInfo op) {
+ return this.getClass().getMethods()[0];
+ }
+ @Override
+ public BindingOperationInfo getBindingOperation(Method m, Endpoint endpoint) {
+ return null;
+ }
+ @Override
+ public void bind(OperationInfo o, Method... methods) {
+ }
+ };
+ service.put(MethodDispatcher.class.getName(), md);
+ exchange.put(Service.class, service);
+ return exchange;
+ }
+}
12 years, 6 months
JBossWS SVN: r16415 - in stack/cxf/trunk: modules/server and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-19 05:20:50 -0400 (Tue, 19 Jun 2012)
New Revision: 16415
Modified:
stack/cxf/trunk/modules/server/pom.xml
stack/cxf/trunk/pom.xml
Log:
Use current PicketBox instead of old JBossSX for compiling
Modified: stack/cxf/trunk/modules/server/pom.xml
===================================================================
--- stack/cxf/trunk/modules/server/pom.xml 2012-06-19 08:15:45 UTC (rev 16414)
+++ stack/cxf/trunk/modules/server/pom.xml 2012-06-19 09:20:50 UTC (rev 16415)
@@ -203,14 +203,10 @@
<artifactId>jboss-common-core</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
+ <groupId>org.picketbox</groupId>
+ <artifactId>picketbox</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- </dependency>
- <dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</dependency>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-06-19 08:15:45 UTC (rev 16414)
+++ stack/cxf/trunk/pom.xml 2012-06-19 09:20:50 UTC (rev 16415)
@@ -79,9 +79,8 @@
<fastinfoset.api.version>1.2.9</fastinfoset.api.version>
<jboss.common.core.version>2.2.17.GA</jboss.common.core.version>
<jboss.logging.version>3.1.0.GA</jboss.logging.version>
- <jboss.security.spi.version>2.0.4.SP4</jboss.security.spi.version>
- <jboss.security.sx.version>2.0.4</jboss.security.sx.version>
<jboss.xb.version>2.0.3.GA</jboss.xb.version>
+ <picketbox.version>4.0.9.Final</picketbox.version>
<picketlink.version>2.1.1.Final</picketlink.version>
<jaxws-jboss-httpserver-httpspi.version>1.0.1.GA</jaxws-jboss-httpserver-httpspi.version>
<httpserver.version>1.0.0.Final</httpserver.version>
@@ -1162,18 +1161,12 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jbosssx</artifactId>
- <version>${jboss.security.sx.version}</version>
+ <groupId>org.picketbox</groupId>
+ <artifactId>picketbox</artifactId>
+ <version>${picketbox.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.security</groupId>
- <artifactId>jboss-security-spi</artifactId>
- <version>${jboss.security.spi.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
12 years, 6 months
JBossWS SVN: r16414 - shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-19 04:15:45 -0400 (Tue, 19 Jun 2012)
New Revision: 16414
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
Log:
[JBWS-3335] Removing fixme
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-18 23:13:01 UTC (rev 16413)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2012-06-19 08:15:45 UTC (rev 16414)
@@ -86,11 +86,9 @@
* @throws Exception
*/
public void testDefaultClientConfigurationInContainer() throws Exception {
- if (true) {
- System.out.println("FIXME: [JBWS-3335] Add client-configuration to AS7 domain model");
- return;
+ if (!isTargetJBoss71()) {
+ assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
}
- assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
}
/**
12 years, 6 months
JBossWS SVN: r16413 - shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/smoke/tools.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-18 19:13:01 -0400 (Mon, 18 Jun 2012)
New Revision: 16413
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
Log:
[JBWS-3520] Improving target test to check for jaxws 2.1 code
Modified: shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java
===================================================================
--- shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2012-06-18 23:12:07 UTC (rev 16412)
+++ shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/smoke/tools/WSConsumerPlugin.java 2012-06-18 23:13:01 UTC (rev 16413)
@@ -27,6 +27,7 @@
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.WebServiceFeature;
import java.io.*;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
@@ -319,6 +320,18 @@
Class<?> sei = loader.loadClass("org.jboss.test.ws.tools.testTarget.EndpointInterface");
assertTrue("@XmlSeeAlso expected on SEI (types not referenced by the Port in the wsdl)", sei.isAnnotationPresent(XmlSeeAlso.class));
+
+ boolean featureConstructor = false;
+ for (Constructor<?> c : service.getConstructors()) {
+ for (Class<?> pt : c.getParameterTypes())
+ {
+ if (pt.isArray() && pt.getComponentType().equals(WebServiceFeature.class)) {
+ featureConstructor = true;
+ break;
+ }
+ }
+ }
+ assertFalse("Found JAXWS 2.2 constructor", featureConstructor);
}
/**
12 years, 6 months
JBossWS SVN: r16412 - stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-18 19:12:07 -0400 (Mon, 18 Jun 2012)
New Revision: 16412
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
Log:
[JBWS-3520] WSConsume ignores target 2.1 option
Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java 2012-06-15 14:49:05 UTC (rev 16411)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java 2012-06-18 23:12:07 UTC (rev 16412)
@@ -139,6 +139,29 @@
public void consume(URL wsdl)
{
List<String> args = new ArrayList<String>();
+
+ PrintStream stream = messageStream;
+ boolean verbose = false;
+ if (stream != null)
+ {
+ verbose = true;
+ }
+ else
+ {
+ stream = NullPrintStream.getInstance();
+ }
+
+ // Always set the target
+ if ("2.1".equals(target))
+ {
+ args.add("-frontend");
+ args.add("jaxws21");
+ }
+ else if (target != null && !target.equals("2.2"))
+ {
+ stream.println("Unsupported target, using default value '2.2'");
+ }
+
if (bindingFiles != null)
{
for (File file : bindingFiles)
@@ -189,15 +212,9 @@
args.add(wsdlLocation);
}
- PrintStream stream = messageStream;
- if (stream != null)
- {
+ if (verbose) {
args.add("-verbose");
}
- else
- {
- stream = NullPrintStream.getInstance();
- }
if (extension)
{
@@ -219,13 +236,6 @@
args.add(outputDir.getAbsolutePath());
}
- // Always set the target
- if (target != null)
- {
- stream.println("WSConsume (CXF) does not allow to setup the JAX-WS specification target, using the currently " +
- "configured JAX-WS version (check your JVM version and/or endorsed libs)");
- }
-
//Always generate wrapped style for reference element:CXF-1079
args.add("-allowElementReferences");
12 years, 6 months
JBossWS SVN: r16411 - in stack/cxf/trunk: modules/server/src/main/java/org/jboss/wsf/stack/cxf and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-15 10:49:05 -0400 (Fri, 15 Jun 2012)
New Revision: 16411
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/testsuite/pom.xml
stack/cxf/trunk/pom.xml
Log:
[JBWS-3517] Moving to Apache CXF 2.7.0-SNAPSHOT
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-06-15 08:55:40 UTC (rev 16410)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2012-06-15 14:49:05 UTC (rev 16411)
@@ -23,9 +23,12 @@
import java.io.IOException;
+import javax.servlet.FilterChain;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -134,4 +137,12 @@
{
this.service(request, response);
}
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
+ ServletException
+ {
+ // filtering not supported, move on
+ chain.doFilter(request, response);
+ }
}
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2012-06-15 08:55:40 UTC (rev 16410)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2012-06-15 14:49:05 UTC (rev 16411)
@@ -108,6 +108,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache-core</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-06-15 08:55:40 UTC (rev 16410)
+++ stack/cxf/trunk/pom.xml 2012-06-15 14:49:05 UTC (rev 16411)
@@ -73,7 +73,7 @@
<jboss712.version>7.1.2.Final</jboss712.version>
<jboss720.version>7.2.0.Alpha1-SNAPSHOT</jboss720.version>
<ejb.api.version>1.0.1.Final</ejb.api.version>
- <cxf.version>2.6.1</cxf.version>
+ <cxf.version>2.7.0-SNAPSHOT</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
<cxf.xjcplugins.version>2.6.0</cxf.xjcplugins.version>
<fastinfoset.api.version>1.2.9</fastinfoset.api.version>
12 years, 6 months
JBossWS SVN: r16410 - stack/cxf/trunk.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-15 04:55:40 -0400 (Fri, 15 Jun 2012)
New Revision: 16410
Modified:
stack/cxf/trunk/pom.xml
Log:
svn merge -r 16406:16405 https://svn.jboss.org/repos/jbossws/stack/cxf/trunk
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2012-06-14 12:46:10 UTC (rev 16409)
+++ stack/cxf/trunk/pom.xml 2012-06-15 08:55:40 UTC (rev 16410)
@@ -73,7 +73,7 @@
<jboss712.version>7.1.2.Final</jboss712.version>
<jboss720.version>7.2.0.Alpha1-SNAPSHOT</jboss720.version>
<ejb.api.version>1.0.1.Final</ejb.api.version>
- <cxf.version>2.7.0-SNAPSHOT</cxf.version>
+ <cxf.version>2.6.1</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
<cxf.xjcplugins.version>2.6.0</cxf.xjcplugins.version>
<fastinfoset.api.version>1.2.9</fastinfoset.api.version>
12 years, 6 months
JBossWS SVN: r16409 - common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/test.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-14 08:46:10 -0400 (Thu, 14 Jun 2012)
New Revision: 16409
Modified:
common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
Log:
Allowing SOA-P 5.3 version
Modified: common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2012-06-13 14:32:04 UTC (rev 16408)
+++ common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2012-06-14 12:46:10 UTC (rev 16409)
@@ -219,7 +219,9 @@
if (jbossVersion == null)
throw new IllegalStateException("Cannot obtain jboss version");
- if (jbossVersion.startsWith("5.2"))
+ if (jbossVersion.startsWith("5.3"))
+ jbossVersion = "jboss51"; // SOA-P is in version 5.3, but it's based on AS 5.1.0
+ else if (jbossVersion.startsWith("5.2"))
jbossVersion = "jboss51"; // EAP is in version 5.2, but it's based on AS 5.1.0
else if (jbossVersion.startsWith("5.1"))
jbossVersion = "jboss51";
12 years, 6 months
JBossWS SVN: r16408 - in stack/cxf/trunk/modules/testsuite: cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497 and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-13 10:32:04 -0400 (Wed, 13 Jun 2012)
New Revision: 16408
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointImpl.java
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/bus/WEB-INF/web.xml
Log:
[JBWS-3513] Adding testcase + fixing existing one to avoid assuming the thread bus is the deployment one
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2012-06-13 14:27:55 UTC (rev 16407)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml 2012-06-13 14:32:04 UTC (rev 16408)
@@ -128,7 +128,7 @@
<include name="cxf.xml"/>
</zipfileset>
<manifest>
- <attribute name="Dependencies" value="org.apache.cxf"/>
+ <attribute name="Dependencies" value="org.apache.cxf,org.jboss.ws.cxf.jbossws-cxf-server"/>
</manifest>
</war>
Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java 2012-06-13 14:27:55 UTC (rev 16407)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java 2012-06-13 14:32:04 UTC (rev 16408)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -29,10 +29,11 @@
import javax.jws.soap.SOAPBinding;
import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.apache.cxf.workqueue.AutomaticWorkQueue;
import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
@WebService(name = "EndpointOne", targetNamespace = "http://org.jboss.ws.jaxws.cxf/jbws3497", serviceName = "ServiceOne")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@@ -43,10 +44,10 @@
@WebMethod
public String echo(String input)
{
- Bus bus = BusFactory.getThreadDefaultBus(false);
+ //this is just a verification of a workaround, so going the dirty way...
+ Bus bus = EndpointAssociation.getEndpoint().getService().getDeployment().getAttachment(BusHolder.class).getBus();
ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
AutomaticWorkQueue queue = locator.getBeanOfType("cxf.default.workqueue", AutomaticWorkQueue.class);
- //this is just a verification of a workaround, so going the dirty way...
Long qs = null;
try
{
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-06-13 14:27:55 UTC (rev 16407)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2012-06-13 14:32:04 UTC (rev 16408)
@@ -41,9 +41,14 @@
<!-- jaxws-cxf-bus -->
<war warfile="${tests.output.dir}/test-libs/jaxws-cxf-bus.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/bus/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/cxf/bus/ClientEndpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointImpl.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/bus/Endpoint.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/bus/EndpointImpl.class"/>
</classes>
+ <manifest>
+ <attribute name="Dependencies" value="org.apache.cxf"/>
+ </manifest>
</war>
<!-- jaxws-cxf-bus-ejb3-client -->
<jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-bus-ejb3-client.jar">
@@ -203,7 +208,7 @@
<include name="**/*" />
</metainf>
<manifest>
- <attribute name="Dependencies" value="org.apache.cxf"/>
+ <attribute name="Dependencies" value="org.apache.cxf,org.jboss.ws.cxf.jbossws-cxf-server"/>
</manifest>
</jar>
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpoint.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpoint.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpoint.java 2012-06-13 14:32:04 UTC (rev 16408)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.bus;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(name = "Endpoint", targetNamespace = "http://org.jboss.ws/bus")
+public interface ClientEndpoint
+{
+ @WebMethod
+ public String testClient(String input, String host) throws Exception;
+
+ @WebMethod
+ public String testCachedPort(String input, String host) throws Exception;
+
+ @WebMethod
+ public String testCachedService(String input, String host) throws Exception;
+
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java 2012-06-13 14:32:04 UTC (rev 16408)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.bus;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * A test case that verifies a client running inside and endpoint business method
+ * does not use the deployment bus.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-Jun-2012
+ *
+ */
+public class ClientEndpointBusTestCase extends JBossWSTest
+{
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-cxf-bus/ClientEndpointService/ClientEndpoint";
+
+ public static Test suite()
+ {
+ return new JBossWSCXFTestSetup(ClientEndpointBusTestCase.class, "jaxws-cxf-bus.war");
+ }
+
+ public void testClient() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testClient("Foo", getServerHost()));
+ }
+
+ public void testCachedPort() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedPort("Foo", getServerHost()));
+ }
+
+ public void testCachedService() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedService("Foo", getServerHost()));
+ }
+
+ private ClientEndpoint getPort() throws Exception {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/bus", "ClientEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ QName portQName = new QName("http://org.jboss.ws/bus", "ClientEndpointPort");
+ return (ClientEndpoint) service.getPort(portQName, ClientEndpoint.class);
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointImpl.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointImpl.java 2012-06-13 14:32:04 UTC (rev 16408)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.cxf.bus;
+
+import java.net.URL;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.BusFactory;
+
+@WebService(name = "ClientEndpoint", serviceName = "ClientEndpointService", targetNamespace = "http://org.jboss.ws/bus")
+public class ClientEndpointImpl
+{
+ @WebMethod
+ public String testClient(String input, String host) throws Exception
+ {
+ if (BusFactory.getThreadDefaultBus(false) != null) {
+ throw new Exception("Expected null thread default bus, but got " + BusFactory.getThreadDefaultBus(false));
+ }
+ Endpoint endpoint = getPort(getWsdlURL(host));
+ return endpoint.echo(input);
+ }
+
+ @WebMethod
+ public String testCachedPort(String input, String host) throws Exception
+ {
+ if (BusFactory.getThreadDefaultBus(false) != null) {
+ throw new Exception("Expected null thread default bus, but got " + BusFactory.getThreadDefaultBus(false));
+ }
+ Endpoint port = getPort(getWsdlURL(host));
+ BusFactory.setThreadDefaultBus(null);
+ return port.echo(input);
+ }
+
+ @WebMethod
+ public String testCachedService(String input, String host) throws Exception
+ {
+ if (BusFactory.getThreadDefaultBus(false) != null) {
+ throw new Exception("Expected null thread default bus, but got " + BusFactory.getThreadDefaultBus(false));
+ }
+ Service service = getService(getWsdlURL(host));
+ BusFactory.setThreadDefaultBus(null);
+ Endpoint port = getPort(service);
+ return port.echo(input);
+ }
+
+ private static URL getWsdlURL(String host) throws Exception
+ {
+ return new URL("http://" + host + ":8080/jaxws-cxf-bus/EndpointService/Endpoint?wsdl");
+ }
+
+ private static Endpoint getPort(URL wsdlURL)
+ {
+ Service service = getService(wsdlURL);
+ return getPort(service);
+ }
+
+ private static Endpoint getPort(Service service)
+ {
+ QName portQName = new QName("http://org.jboss.ws/bus", "EndpointPort");
+ return (Endpoint) service.getPort(portQName, Endpoint.class);
+ }
+
+ private static Service getService(URL wsdlURL)
+ {
+ QName serviceName = new QName("http://org.jboss.ws/bus", "EndpointService");
+ return Service.create(wsdlURL, serviceName);
+ }
+}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java 2012-06-13 14:27:55 UTC (rev 16407)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3497/EndpointOneImpl.java 2012-06-13 14:32:04 UTC (rev 16408)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,17 +23,20 @@
import java.util.concurrent.atomic.AtomicInteger;
+import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
import org.apache.cxf.workqueue.AutomaticWorkQueue;
import org.apache.cxf.workqueue.WorkQueueManager;
import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.invocation.EndpointAssociation;
+import org.jboss.wsf.stack.cxf.configuration.BusHolder;
@WebService(name = "EndpointOne", targetNamespace = "http://org.jboss.ws.jaxws.cxf/jbws3497", serviceName = "ServiceOne")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@@ -42,12 +45,15 @@
{
private static AtomicInteger count = new AtomicInteger(0);
+ @Resource
+ WebServiceContext ctx;
+
@WebMethod
public String echo(String input)
{
- Bus bus = BusFactory.getThreadDefaultBus(false);
+ //this is just a verification, so going the dirty way...
+ Bus bus = EndpointAssociation.getEndpoint().getService().getDeployment().getAttachment(BusHolder.class).getBus();
AutomaticWorkQueue queue = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue();
- //this is just a verification, so going the dirty way...
Long qs = null;
Integer it = null;
try
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/bus/WEB-INF/web.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/bus/WEB-INF/web.xml 2012-06-13 14:27:55 UTC (rev 16407)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/bus/WEB-INF/web.xml 2012-06-13 14:32:04 UTC (rev 16408)
@@ -9,8 +9,18 @@
<servlet-class>org.jboss.test.ws.jaxws.cxf.bus.EndpointImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>Ep2Servlet</servlet-name>
+ <servlet-class>org.jboss.test.ws.jaxws.cxf.bus.ClientEndpointImpl</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>EpServlet</servlet-name>
<url-pattern>/EndpointService/Endpoint</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Ep2Servlet</servlet-name>
+ <url-pattern>/ClientEndpointService/ClientEndpoint</url-pattern>
+ </servlet-mapping>
</web-app>
\ No newline at end of file
12 years, 6 months
JBossWS SVN: r16407 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2012-06-13 10:27:55 -0400 (Wed, 13 Jun 2012)
New Revision: 16407
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
Log:
[JBWS-3513] Clean-up thread default bus before handing control over to ws endpoint business methods
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2012-06-10 06:50:44 UTC (rev 16406)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2012-06-13 14:27:55 UTC (rev 16407)
@@ -178,6 +178,7 @@
Bus threadBus = BusFactory.getThreadDefaultBus(false);
try
{
+ BusFactory.setThreadDefaultBus(null);
invHandler.invoke(ep, inv);
retObj = inv.getReturnValue();
} catch (InvocationTargetException e) {
12 years, 6 months