Author: asoldano
Date: 2015-01-13 05:19:04 -0500 (Tue, 13 Jan 2015)
New Revision: 19367
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
Log:
Properly deal with client classpath setup
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2015-01-13
09:08:01 UTC (rev 19366)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2015-01-13
10:19:04 UTC (rev 19367)
@@ -23,7 +23,6 @@
import java.io.File;
import java.net.URL;
-import java.net.URLClassLoader;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
@@ -32,13 +31,11 @@
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.junit.After;
-import org.junit.Before;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,26 +51,6 @@
@ArquillianResource
private URL baseURL;
- private ClassLoader originalClassLoader = null;
-
-
- @Before
- public void setupClientClassPath() throws Exception {
- originalClassLoader = Thread.currentThread().getContextClassLoader();
-
- URLClassLoader cl = new URLClassLoader(new URL[] { createClientJar() },
- originalClassLoader);
- Thread.currentThread().setContextClassLoader(cl);
-
- }
-
-
- @After
- public void restoreClassPath() {
- Thread.currentThread().setContextClassLoader(originalClassLoader);
- }
-
-
@Deployment(name = "jaxws-clientConfig-inContainer-client", order = 1,
testable = false)
public static WebArchive createDeployment() {
WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-clientConfig-inContainer-client.war");
@@ -132,6 +109,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFile());
}
@@ -139,6 +117,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationOnDispatchFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationOnDispatchFromFile());
}
@@ -160,6 +139,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFileUsingFeature() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFileUsingFeature());
}
@@ -167,6 +147,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFileUsingFeatureOnDispatch() throws
Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFileUsingFeatureOnDispatch());
}
@@ -193,6 +174,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testConfigurationChange() throws Exception {
assertTrue(getHelper().testConfigurationChange());
}
@@ -201,6 +183,7 @@
@Test
@RunAsClient
@OperateOnDeployment("jaxws-clientConfig")
+ @WrapThreadContextClassLoader
public void testConfigurationChangeOnDispatch() throws Exception {
assertTrue(getHelper().testConfigurationChangeOnDispatch());
}
@@ -219,17 +202,16 @@
assertEquals("1",
runTestInContainer("testConfigurationChangeOnDispatch"));
}
- private URL createClientJar() throws Exception {
- String clientJarName = "jaxws-clientConfig-client.jar";
- JavaArchive archive = ShrinkWrap.create(JavaArchive.class, clientJarName);
- archive
- .addManifest()
-
.addAsResource("org/jboss/test/ws/jaxws/clientConfig/jaxws-client-config.xml",
"jaxws-client-config.xml")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/clientConfig/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
- JBossWSTestHelper.writeToFile(archive);
- return JBossWSTest.getArchiveURL(clientJarName);
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-clientConfig-client.jar") { {
+ archive
+ .addManifest()
+
.addAsResource("org/jboss/test/ws/jaxws/clientConfig/jaxws-client-config.xml",
"jaxws-client-config.xml")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/clientConfig/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
}
-
private Helper getHelper() {
Helper helper = new Helper();
Show replies by date