This is an automated email from the ASF dual-hosted git repository. reta pushed a commit to branch 3.4.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 5e7f4103b84fd0ddde45e8959294b35c96db8e8d Author: Alexey Markevich <[email protected]> AuthorDate: Mon Nov 16 11:35:26 2020 +0300 cxf-tools-common: remove ProcessorTestBase.getClassPath --- .../apache/cxf/tools/common/ProcessorTestBase.java | 46 ---------------------- .../java2js/processor/JavaToJSProcessorTest.java | 18 --------- .../generator/wsdl11/WrapperBeanGeneratorTest.java | 2 - .../java2wsdl/processor/JavaToProcessorTest.java | 12 +----- 4 files changed, 1 insertion(+), 77 deletions(-) diff --git a/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java b/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java index a8e4a7e..653488b 100644 --- a/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java +++ b/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java @@ -22,10 +22,7 @@ package org.apache.cxf.tools.common; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.net.URI; import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -36,8 +33,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; -import java.util.jar.Attributes; -import java.util.jar.JarFile; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -108,47 +103,6 @@ public class ProcessorTestBase { } } - protected String getClassPath() throws URISyntaxException, IOException { - ClassLoader loader = getClass().getClassLoader(); - StringBuilder classPath = new StringBuilder(); - if (loader instanceof URLClassLoader) { - for (URL url : ((URLClassLoader)loader).getURLs()) { - File file = new File(url.toURI()); - String filename = file.getAbsolutePath(); - if (filename.indexOf("junit") == -1) { - classPath.append(filename); - classPath.append(System.getProperty("path.separator")); - } - if (filename.indexOf("surefirebooter") != -1) { - //surefire 2.4 uses a MANIFEST classpath that javac doesn't like - try (JarFile jar = new JarFile(filename)) { - Attributes attr = jar.getManifest().getMainAttributes(); - if (attr != null) { - String cp = attr.getValue("Class-Path"); - while (cp != null) { - String fileName = cp; - int idx = fileName.indexOf(' '); - if (idx != -1) { - fileName = fileName.substring(0, idx); - cp = cp.substring(idx + 1).trim(); - } else { - cp = null; - } - URI uri = new URI(fileName); - File f2 = new File(uri); - if (f2.exists()) { - classPath.append(f2.getAbsolutePath()); - classPath.append(System.getProperty("path.separator")); - } - } - } - } - } - } - } - return classPath.toString(); - } - protected String getLocation(String wsdlFile) throws URISyntaxException { return getClass().getResource(wsdlFile).toURI().toString(); } diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessorTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessorTest.java index 7dfeb89..c753313 100755 --- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessorTest.java +++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2js/processor/JavaToJSProcessorTest.java @@ -24,36 +24,18 @@ import java.io.File; import org.apache.cxf.helpers.JavaUtils; import org.apache.cxf.tools.common.ProcessorTestBase; import org.apache.cxf.tools.common.ToolConstants; -import org.apache.cxf.tools.common.ToolContext; import org.apache.cxf.tools.java2js.JavaToJS; import org.apache.cxf.tools.wsdlto.core.DataBindingProfile; import org.apache.cxf.tools.wsdlto.core.FrontEndProfile; import org.apache.cxf.tools.wsdlto.core.PluginLoader; import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertTrue; public class JavaToJSProcessorTest extends ProcessorTestBase { JavaToJSProcessor processor = new JavaToJSProcessor(); - String classPath = ""; - - @Before - public void startUp() throws Exception { - env = new ToolContext(); - classPath = System.getProperty("java.class.path"); - System.setProperty("java.class.path", getClassPath()); - } - - @After - public void tearDown() { - super.tearDown(); - System.setProperty("java.class.path", classPath); - } - @Test public void testSimpleClass() throws Exception { diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java index 5c31d4e..32d9989 100644 --- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java +++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java @@ -49,8 +49,6 @@ public class WrapperBeanGeneratorTest extends ProcessorTestBase { @Rule public ExternalResource envRule = new ExternalResource() { protected void before() throws Throwable { - System.setProperty("java.class.path", getClassPath() + tmpDir.getRoot().getCanonicalPath() - + File.separatorChar); classLoader = new URLClassLoader(new URL[] {tmpDir.getRoot().toURI().toURL()}, Thread.currentThread().getContextClassLoader()); } diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java index 6d79af8..62308c2 100644 --- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java +++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java @@ -64,7 +64,6 @@ import org.apache.cxf.tools.wsdlto.core.PluginLoader; import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer; import org.apache.cxf.wsdl.WSDLConstants; -import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -77,19 +76,10 @@ import static org.junit.Assert.fail; public class JavaToProcessorTest extends ProcessorTestBase { JavaToWSDLProcessor processor = new JavaToWSDLProcessor(); - String classPath = ""; + @Before public void startUp() throws Exception { - env = new ToolContext(); env.put(ToolConstants.CFG_WSDL, ToolConstants.CFG_WSDL); - - classPath = System.getProperty("java.class.path"); - System.setProperty("java.class.path", getClassPath()); - } - @After - public void tearDown() { - super.tearDown(); - System.setProperty("java.class.path", classPath); } @Test
