Author: alessio.soldano(a)jboss.com
Date: 2011-05-11 15:53:20 -0400 (Wed, 11 May 2011)
New Revision: 14379
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java
Log:
Properly reset ClassLoader extension in client test bus; see CXF-3497
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java 2011-05-11
16:58:40 UTC (rev 14378)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java 2011-05-11
19:53:20 UTC (rev 14379)
@@ -51,10 +51,33 @@
protected void setUp() throws Exception {
defaultBus = BusFactory.getDefaultBus(false);
super.setUp();
+ Bus threadBus = BusFactory.getThreadDefaultBus(false);
+ if (threadBus != null)
+ {
+ ClassLoader busLoader = threadBus.getExtension(ClassLoader.class);
+ ClassLoader origLoader = this.getOriginalClassLoader();
+ //overwrite the ClassLoader extension with the new TCCL, to allow CXF seeing the
client side archives
+ if (busLoader != null && busLoader == origLoader)
+ {
+ threadBus.setExtension(Thread.currentThread().getContextClassLoader(),
ClassLoader.class);
+ }
+ }
}
@Override
protected void tearDown() throws Exception {
+ Bus threadBus = BusFactory.getThreadDefaultBus(false);
+ if (threadBus != null)
+ {
+ ClassLoader busLoader = threadBus.getExtension(ClassLoader.class);
+ ClassLoader origLoader = this.getOriginalClassLoader();
+ //restore the ClassLoader extension to the orig loader
+ if (busLoader != null && busLoader ==
Thread.currentThread().getContextClassLoader())
+ {
+ threadBus.setExtension(origLoader, ClassLoader.class);
+ }
+ }
+
try
{
Bus afterTestsDefaultBus = BusFactory.getDefaultBus(false);
Show replies by date