Author: alessio.soldano(a)jboss.com
Date: 2011-04-05 09:23:53 -0400 (Tue, 05 Apr 2011)
New Revision: 14008
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/AbstractClient.java
Log:
[JBWS-3260] Adding testcase for checking the default bus is not used when doing jaxws
client usage in-container with the current thread not being associated with a bus yet
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/AbstractClient.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/AbstractClient.java 2011-04-05
13:18:00 UTC (rev 14007)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/AbstractClient.java 2011-04-05
13:23:53 UTC (rev 14008)
@@ -96,6 +96,26 @@
Bus initialDefaultBus = BusFactory.getDefaultBus(false);
performInvocation(getEndpointURL(host));
checkDefaultBus(initialDefaultBus);
+ //check client usage does not rely on default bus when no thread bus is set
+ Bus threadBus = BusFactory.getThreadDefaultBus(false);
+ try
+ {
+ BusFactory.setThreadDefaultBus(null);
+ performInvocation(getEndpointURL(host));
+ Bus newThreadBus = BusFactory.getThreadDefaultBus(false);
+ if (newThreadBus == initialDefaultBus)
+ {
+ throw new BusTestException("Thread bus set to former default bus "
+ initialDefaultBus + " instead of a new bus!");
+ }
+ else if (newThreadBus == threadBus)
+ {
+ throw new BusTestException("Thread bus set to former thread bus " +
threadBus + " (which is also default) instead of a new bus!");
+ }
+ }
+ finally
+ {
+ BusFactory.setThreadDefaultBus(threadBus);
+ }
}
protected static String getEndpointURL(String host)
@@ -110,7 +130,7 @@
SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
SOAPMessage msg = msgFac.createMessage();
SOAPConnection con = conFac.createConnection();
- QName echo = new QName("http://org.jboss.ws.jaxws.cxf/bus",
"echo");
+ QName echo = new QName("http://org.jboss.ws/bus", "echo");
SOAPElement element = soapFac.createElement(echo);
element.addTextNode("John");
msg.getSOAPBody().addChildElement(element);
Show replies by date