[cxf] branch master updated: FileUtils: move test specific getStringFromFile; remove extra space

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch master updated: FileUtils: move test specific getStringFromFile; remove extra space

buhhunyx
This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 7689d88  FileUtils: move test specific getStringFromFile; remove extra space
7689d88 is described below

commit 7689d884a64db0352cdb1ac9ee0628a26491f35a
Author: amarkevich <[hidden email]>
AuthorDate: Thu Feb 21 16:08:04 2019 +0300

    FileUtils: move test specific getStringFromFile; remove extra space
---
 .../java/org/apache/cxf/helpers/FileUtils.java     | 51 ---------------
 tools/common/pom.xml                               | 37 +++++++----
 .../apache/cxf/tools/common/ProcessorTestBase.java | 19 ++----
 .../org/apache/cxf/tools/common/TestFileUtils.java | 74 +++++++++++++++++++++
 .../org/apache/cxf/tools/common/ToolTestBase.java  |  0
 tools/corba/pom.xml                                | 18 +++--
 tools/javato/ws/pom.xml                            | 35 +++++-----
 .../org/apache/cxf/tools/java2ws/JavaToWSTest.java | 53 +++++++--------
 .../wsdl11/DateTypeCustomGeneratorTest.java        | 15 ++---
 .../generator/wsdl11/FaultBeanGeneratorTest.java   |  7 +-
 .../java2wsdl/processor/JavaToProcessorTest.java   | 58 ++++++++---------
 tools/validator/pom.xml                            | 12 ++--
 tools/wadlto/jaxrs/pom.xml                         | 18 +++--
 tools/wsdlto/core/pom.xml                          | 23 ++++---
 tools/wsdlto/frontend/javascript/pom.xml           | 18 +++--
 tools/wsdlto/frontend/jaxws/pom.xml                | 18 +++--
 tools/wsdlto/misc/pom.xml                          | 23 ++++---
 tools/wsdlto/test/pom.xml                          | 18 +++--
 .../cxf/tools/wsdlto/jaxws/CodeGenBugTest.java     | 76 +++++++++-------------
 .../apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java | 33 +++++-----
 .../cxf/tools/wsdlto/jaxws/JAXWSBindingTest.java   |  6 +-
 21 files changed, 333 insertions(+), 279 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
index b847d5a..4fff905 100644
--- a/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
+++ b/core/src/main/java/org/apache/cxf/helpers/FileUtils.java
@@ -19,11 +19,8 @@
 
 package org.apache.cxf.helpers;
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.security.AccessController;
@@ -288,54 +285,6 @@ public final class FileUtils {
         return result;
     }
 
-    public static String getStringFromFile(File location) {
-        try (InputStream is  = Files.newInputStream(location.toPath())) {
-            return normalizeCRLF(is);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    public static String normalizeCRLF(InputStream instream) {
-        BufferedReader in = new BufferedReader(new InputStreamReader(instream));
-        StringBuilder result = new StringBuilder();
-        String line = null;
-
-        try {
-            line = in.readLine();
-            while (line != null) {
-                String[] tok = line.split("\\s");
-
-                for (int x = 0; x < tok.length; x++) {
-                    String token = tok[x];
-                    result.append("  ").append(token);
-                }
-                line = in.readLine();
-            }
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        String rtn = result.toString();
-
-        rtn = ignoreTokens(rtn, "<!--", "-->");
-        rtn = ignoreTokens(rtn, "/*", "*/");
-        return rtn;
-    }
-
-    private static String ignoreTokens(final String contents,
-                                       final String startToken, final String endToken) {
-        String rtn = contents;
-        int headerIndexStart = rtn.indexOf(startToken);
-        int headerIndexEnd = rtn.indexOf(endToken);
-        if (headerIndexStart != -1 && headerIndexEnd != -1 && headerIndexStart < headerIndexEnd) {
-            rtn = rtn.substring(0, headerIndexStart - 1)
-                + rtn.substring(headerIndexEnd + endToken.length() + 1);
-        }
-        return rtn;
-    }
-
     public static List<File> getFilesUsingSuffix(File dir, final String suffix) {
         return getFilesRecurseUsingSuffix(dir, suffix, false, new ArrayList<>());
     }
diff --git a/tools/common/pom.xml b/tools/common/pom.xml
index c4b2db1..8f27ef3 100644
--- a/tools/common/pom.xml
+++ b/tools/common/pom.xml
@@ -38,17 +38,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>${cxf.asm.groupId}</groupId>
-            <artifactId>${cxf.asm.artifactId}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.velocity</groupId>
             <artifactId>velocity-engine-core</artifactId>
             <exclusions>
@@ -80,12 +69,34 @@
             <artifactId>cxf-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-wsdl</artifactId>
             <version>${project.version}</version>
-            <scope>provided</scope>
-            <optional>true</optional>
+            <scope>test</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>test-jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java b/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java
similarity index 95%
rename from tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
rename to tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java
index 005acb7..a8e4a7e 100644
--- a/tools/common/src/main/java/org/apache/cxf/tools/common/ProcessorTestBase.java
+++ b/tools/common/src/test/java/org/apache/cxf/tools/common/ProcessorTestBase.java
@@ -44,7 +44,6 @@ import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.tools.util.ToolsStaxUtils;
 import org.apache.ws.commons.schema.constants.Constants;
 
@@ -159,13 +158,9 @@ public class ProcessorTestBase {
     }
 
 
-    protected void assertFileEquals(String f1, String f2) {
-        assertFileEquals(new File(f1), new File(f2));
-    }
-
-    protected void assertFileEquals(File location1, File location2) {
-        String str1 = FileUtils.getStringFromFile(location1);
-        String str2 = FileUtils.getStringFromFile(location2);
+    protected void assertFileEquals(String resource, File location) throws IOException {
+        String str1 = TestFileUtils.getStringFromStream(getClass().getResourceAsStream(resource));
+        String str2 = TestFileUtils.getStringFromFile(location);
 
         StringTokenizer st1 = new StringTokenizer(str1, " \t\n\r\f(),");
         StringTokenizer st2 = new StringTokenizer(str2, " \t\n\r\f(),");
@@ -191,8 +186,8 @@ public class ProcessorTestBase {
                 }
                 unmatched.add(tok2);
             }
-            assertEquals("Compare failed " + location1.getAbsolutePath()
-                         + " != " + location2.getAbsolutePath(), tok1, tok2);
+            assertEquals("Compare failed " + resource
+                         + " != " + location.getAbsolutePath(), tok1, tok2);
         }
 
         assertFalse(st1.hasMoreTokens());
@@ -200,10 +195,6 @@ public class ProcessorTestBase {
         assertTrue("Files did not match: " + unmatched, unmatched.isEmpty());
     }
 
-    public String getStringFromFile(File location) {
-        return FileUtils.getStringFromFile(location);
-    }
-
     public boolean assertXmlEquals(final File expected, final File source) throws Exception {
         List<String> attr = Arrays.asList(new String[]{"attributeFormDefault", "elementFormDefault", "form"});
         return assertXmlEquals(expected, source, attr);
diff --git a/tools/common/src/test/java/org/apache/cxf/tools/common/TestFileUtils.java b/tools/common/src/test/java/org/apache/cxf/tools/common/TestFileUtils.java
new file mode 100644
index 0000000..c79e485
--- /dev/null
+++ b/tools/common/src/test/java/org/apache/cxf/tools/common/TestFileUtils.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.tools.common;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+
+public final class TestFileUtils {
+
+    private TestFileUtils() {
+    }
+
+    public static String getStringFromFile(File location) throws IOException {
+        try (InputStream is = Files.newInputStream(location.toPath())) {
+            return getStringFromStream(is);
+        }
+    }
+
+    public static String getStringFromStream(InputStream is) throws IOException {
+        return normalizeCRLF(is);
+    }
+
+    private static String normalizeCRLF(InputStream instream) throws IOException {
+        BufferedReader in = new BufferedReader(new InputStreamReader(instream));
+        StringBuilder result = new StringBuilder();
+        String line = in.readLine();
+        while (line != null) {
+            for (String token : line.split("\\s")) {
+                result.append(' ').append(token);
+            }
+            line = in.readLine();
+        }
+
+        String rtn = result.toString();
+
+        rtn = ignoreTokens(rtn, "<!--", "-->");
+        rtn = ignoreTokens(rtn, "/*", "*/");
+        return rtn;
+    }
+
+    private static String ignoreTokens(final String contents,
+                                       final String startToken, final String endToken) {
+        String rtn = contents;
+        int headerIndexStart = rtn.indexOf(startToken);
+        int headerIndexEnd = rtn.indexOf(endToken);
+        if (headerIndexStart != -1 && headerIndexEnd != -1 && headerIndexStart < headerIndexEnd) {
+            rtn = rtn.substring(0, headerIndexStart - 1)
+                + rtn.substring(headerIndexEnd + endToken.length() + 1);
+        }
+        return rtn;
+    }
+
+}
diff --git a/tools/common/src/main/java/org/apache/cxf/tools/common/ToolTestBase.java b/tools/common/src/test/java/org/apache/cxf/tools/common/ToolTestBase.java
similarity index 100%
rename from tools/common/src/main/java/org/apache/cxf/tools/common/ToolTestBase.java
rename to tools/common/src/test/java/org/apache/cxf/tools/common/ToolTestBase.java
diff --git a/tools/corba/pom.xml b/tools/corba/pom.xml
index 1eee83a..4a4e745 100644
--- a/tools/corba/pom.xml
+++ b/tools/corba/pom.xml
@@ -38,11 +38,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-core</artifactId>
             <version>${project.version}</version>
@@ -74,6 +69,19 @@
             <groupId>wsdl4j</groupId>
             <artifactId>wsdl4j</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/tools/javato/ws/pom.xml b/tools/javato/ws/pom.xml
index 3988cb3..4af74e2 100644
--- a/tools/javato/ws/pom.xml
+++ b/tools/javato/ws/pom.xml
@@ -74,16 +74,6 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${cxf.asm.groupId}</groupId>
-            <artifactId>${cxf.asm.artifactId}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>wsdl4j</groupId>
             <artifactId>wsdl4j</artifactId>
         </dependency>
@@ -109,12 +99,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-rt-transports-http-jetty</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxws</artifactId>
             <version>${project.version}</version>
             <exclusions>
@@ -132,6 +116,18 @@
             <groupId>org.glassfish.jaxb</groupId>
             <artifactId>jaxb-runtime</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-testutils</artifactId>
@@ -148,6 +144,13 @@
             <artifactId>slf4j-jdk14</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
index 2882576..8bf1be3 100644
--- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
+++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
@@ -33,6 +33,7 @@ import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.XPathUtils;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.tools.common.CommandInterfaceUtils;
+import org.apache.cxf.tools.common.TestFileUtils;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolTestBase;
 
@@ -112,11 +113,11 @@ public class JavaToWSTest extends ToolTestBase {
         j2w.run();
 
         File wrapper = outputFile("org/apache/cxf/tools/fortest/cxf2941/jaxws/HelloStringResponse.java");
-        String str = FileUtils.getStringFromFile(wrapper);
+        String str = TestFileUtils.getStringFromFile(wrapper);
         assertTrue("namespace value in annoataion @XmlElement is not correct",
-                   str.indexOf("hello/name") > -1);
+                   str.contains("hello/name"));
         assertTrue("name value in annoataion @XmlElement is not correct",
-                   str.indexOf("\"name\"") > -1);
+                   str.contains("\"name\""));
     }
 
 
@@ -133,9 +134,9 @@ public class JavaToWSTest extends ToolTestBase {
         j2w.run();
 
         File wrapper = outputFile("org/apache/cxf/tools/fortest/cxf2934/jaxws/HelloStringResponse.java");
-        String str = FileUtils.getStringFromFile(wrapper);
+        String str = TestFileUtils.getStringFromFile(wrapper);
         assertTrue("namespace value in annoataion @XmlElement is not correct: " + str,
-                   str.indexOf("helloString/Name") > -1);
+                   str.contains("helloString/Name"));
     }
     @Test
     public void testCXF1450() throws Exception {
@@ -150,7 +151,7 @@ public class JavaToWSTest extends ToolTestBase {
         j2w.run();
 
         File wrapper = outputFile("org/apache/cxf/tools/fortest/cxf1450/jaxws/HelloStringResponse.java");
-        String str = FileUtils.getStringFromFile(wrapper);
+        String str = TestFileUtils.getStringFromFile(wrapper);
         assertTrue("namespace value in annoataion @XmlElement is not correct: " + str,
                    str.indexOf("helloString/Name") > -1);
     }
@@ -174,18 +175,18 @@ public class JavaToWSTest extends ToolTestBase {
 
         //checkStdErr();
         assertTrue("Failed to generate WSDL file", wsdlFile.exists());
-        String str = FileUtils.getStringFromFile(wsdlFile);
+        String str = TestFileUtils.getStringFromFile(wsdlFile);
         assertTrue("Port address in generated wsdl is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
         File client = outputFile("org/apache/hello_world_doc_lit/GreeterClient.java");
-        str = FileUtils.getStringFromFile(client);
+        str = TestFileUtils.getStringFromFile(client);
         assertTrue("Address generated in client side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
 
         File server = outputFile("org/apache/hello_world_doc_lit/GreeterServer.java");
-        str = FileUtils.getStringFromFile(server);
+        str = TestFileUtils.getStringFromFile(server);
         assertTrue("Address generated in server side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
 
         File impl = outputFile("org/apache/hello_world_doc_lit/GreeterImpl.java");
         Compiler compiler = new Compiler();
@@ -207,18 +208,18 @@ public class JavaToWSTest extends ToolTestBase {
 
         //checkStdErr();
         assertTrue("Failed to generate WSDL file", wsdlFile.exists());
-        String str = FileUtils.getStringFromFile(wsdlFile);
+        String str = TestFileUtils.getStringFromFile(wsdlFile);
         assertTrue("Port address in generated wsdl is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
         File client = outputFile("org/apache/hello_world_doc_lit/GreeterClient.java");
-        str = FileUtils.getStringFromFile(client);
+        str = TestFileUtils.getStringFromFile(client);
         assertTrue("Address generated in client side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
 
         File server = outputFile("org/apache/hello_world_doc_lit/GreeterServer.java");
-        str = FileUtils.getStringFromFile(server);
+        str = TestFileUtils.getStringFromFile(server);
         assertTrue("Address generated in server side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
 
         File impl = outputFile("org/apache/hello_world_doc_lit/GreeterImpl.java");
         Compiler compiler = new Compiler();
@@ -248,15 +249,15 @@ public class JavaToWSTest extends ToolTestBase {
         assertTrue("Failed to generate impl file for simple front end ", impl.exists());
         assertTrue("Failed to generate wsdl file for simple front end ", wsdl.exists());
 
-        String str = FileUtils.getStringFromFile(client);
+        String str = TestFileUtils.getStringFromFile(client);
         assertTrue("Address generated in client side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
-        str = FileUtils.getStringFromFile(server);
+                   str.contains("http://localhost:1234/test"));
+        str = TestFileUtils.getStringFromFile(server);
         assertTrue("Address generated in server side code is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
-        str = FileUtils.getStringFromFile(wsdl);
+                   str.contains("http://localhost:1234/test"));
+        str = TestFileUtils.getStringFromFile(wsdl);
         assertTrue("Address generated in wsdl is not correct",
-                   str.indexOf("http://localhost:1234/test") > -1);
+                   str.contains("http://localhost:1234/test"));
 
 
         Compiler compiler = new Compiler();
@@ -345,7 +346,7 @@ public class JavaToWSTest extends ToolTestBase {
         assertTrue("Client was not generated", client.exists());
         assertTrue("Greeter_GreeterPort_Server.java was not generated", server.exists());
         assertTrue("Impl was not generated", impl.exists());
-        String implContent = FileUtils.getStringFromFile(impl);
+        String implContent = TestFileUtils.getStringFromFile(impl);
 
         int idx = implContent.indexOf("serviceName");
         assertFalse("serviceName annotation was not generated", idx == -1);
@@ -485,7 +486,7 @@ public class JavaToWSTest extends ToolTestBase {
         j2w.run();
 
         File file = new File(output.getPath() + "/AddNumbers.wsdl");
-        String str = FileUtils.getStringFromFile(file);
+        String str = TestFileUtils.getStringFromFile(file);
         String swaImport = "http://ws-i.org/profiles/basic/1.1/xsd";
         String schemaLoc = "http://ws-i.org/profiles/basic/1.1/swaref.xsd";
         assertTrue("Java2wsdl did not generate swaRef type element",
diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java
index c311b78..4bddb08 100644
--- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java
+++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/DateTypeCustomGeneratorTest.java
@@ -20,7 +20,6 @@
 package org.apache.cxf.tools.java2wsdl.generator.wsdl11;
 
 import java.io.File;
-import java.net.URI;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Date;
@@ -85,34 +84,30 @@ public class DateTypeCustomGeneratorTest extends ProcessorTestBase {
         gen.setServiceModel(getServiceInfo(EchoDate.class));
         assertEquals(Date.class, gen.getDateType());
 
-        URI expectedFile = getClass().getResource("expected/date_embed.xml").toURI();
-        assertFileEquals(new File(expectedFile), gen.generate(output));
+        assertFileEquals("expected/date_embed.xml", gen.generate(output));
 
         gen.setWSDLName("calendar_embed");
         gen.setServiceModel(getServiceInfo(EchoCalendar.class));
         assertEquals(Calendar.class, gen.getDateType());
 
-        expectedFile = getClass().getResource("expected/calendar_embed.xml").toURI();
-        assertFileEquals(new File(expectedFile), gen.generate(output));
+        assertFileEquals("expected/calendar_embed.xml", gen.generate(output));
     }
 
     @Test
     public void testGenerateExternalStyle() throws Exception {
         gen.setAllowImports(true);
-        gen.addSchemaFiles(Arrays.asList(new String[]{"hello_schema1.xsd", "hello_schema2.xsd"}));
+        gen.addSchemaFiles(Arrays.asList("hello_schema1.xsd", "hello_schema2.xsd"));
 
         gen.setWSDLName("date_external");
         gen.setServiceModel(getServiceInfo(EchoDate.class));
         assertEquals(Date.class, gen.getDateType());
 
-        URI expectedFile = getClass().getResource("expected/date.xjb").toURI();
-        assertFileEquals(new File(expectedFile), gen.generate(output));
+        assertFileEquals("expected/date.xjb", gen.generate(output));
 
         gen.setWSDLName("calendar_external");
         gen.setServiceModel(getServiceInfo(EchoCalendar.class));
         assertEquals(Calendar.class, gen.getDateType());
 
-        expectedFile = getClass().getResource("expected/calendar.xjb").toURI();
-        assertFileEquals(new File(expectedFile), gen.generate(output));
+        assertFileEquals("expected/calendar.xjb", gen.generate(output));
     }
 }
\ No newline at end of file
diff --git a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
index fb51530..617f651 100644
--- a/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
+++ b/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
@@ -21,7 +21,6 @@ package org.apache.cxf.tools.java2wsdl.generator.wsdl11;
 
 import java.io.File;
 import java.lang.reflect.Method;
-import java.net.URI;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -65,8 +64,7 @@ public class FaultBeanGeneratorTest extends ProcessorTestBase {
         File faultBeanClass = new File(output, pkgBase + "/DBServiceFaultBean.java");
         assertTrue(faultBeanClass.exists());
 
-        URI expectedFile = getClass().getResource("expected/DBServiceFaultBean.java.source").toURI();
-        assertFileEquals(new File(expectedFile), faultBeanClass);
+        assertFileEquals("expected/DBServiceFaultBean.java.source", faultBeanClass);
     }
 
     @Test
@@ -85,8 +83,7 @@ public class FaultBeanGeneratorTest extends ProcessorTestBase {
         File faultBeanClass = new File(output, pkgBase + "/FaultDetail.java");
         assertTrue(faultBeanClass.exists());
 
-        URI expectedFile = getClass().getResource("expected/FaultDetail.java.source").toURI();
-        assertFileEquals(new File(expectedFile), faultBeanClass);
+        assertFileEquals("expected/FaultDetail.java.source", faultBeanClass);
     }
 
     @Test
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 755095c..6d79af8 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
@@ -53,6 +53,7 @@ import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.common.TestFileUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.fortest.exception.TransientMessageException;
@@ -531,17 +532,17 @@ public class JavaToProcessorTest extends ProcessorTestBase {
         File wsdlFile = new File(output, "add_numbers.wsdl");
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
         // To test there is wsam:action generated for the
-        String wsdlString = getStringFromFile(wsdlFile);
+        String wsdlString = TestFileUtils.getStringFromFile(wsdlFile);
         assertTrue("The wsam and wsaw action are not both generated", wsdlString
-            .indexOf("wsam:Action=\"http://cxf.apache.org/fault3\"") > -1
-            && wsdlString.indexOf("wsaw:Action=\"http://cxf.apache.org/fault3\"") > -1);
+            .contains("wsam:Action=\"http://cxf.apache.org/fault3\"")
+            && wsdlString.contains("wsaw:Action=\"http://cxf.apache.org/fault3\""));
         assertTrue("The wsaAction is not generated for NOActionAnotation method", wsdlString
-            .indexOf("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Request") > -1);
+            .contains("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Request"));
         assertTrue("The wsaAction is not generated for NOActionAnotation method", wsdlString
-            .indexOf("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Response") > -1);
+            .contains("http://fortest.tools.cxf.apache.org/AddNumbersImpl/addNumbers2Response"));
         assertTrue("The wsaAction computed for empty FaultAction is not correct", wsdlString
-            .indexOf("http://fortest.tools.cxf.apache.org/"
-                     + "AddNumbersImpl/addNumbers4/Fault/AddNumbersException") > -1);
+            .contains("http://fortest.tools.cxf.apache.org/"
+                     + "AddNumbersImpl/addNumbers4/Fault/AddNumbersException"));
         URI expectedFile = getClass().getResource("expected/add_numbers_expected.wsdl").toURI();
         assertWsdlEquals(new File(expectedFile), wsdlFile);
     }
@@ -567,12 +568,12 @@ public class JavaToProcessorTest extends ProcessorTestBase {
         assertTrue(requestWrapperClass.exists());
         assertTrue(responseWrapperClass.exists());
 
-        String req = getStringFromFile(requestWrapperClass);
-        String resp = getStringFromFile(responseWrapperClass);
-        assertTrue(req.indexOf("String  arg0") != -1);
-        assertTrue(req.indexOf("Holder") == -1);
-        assertTrue(resp.indexOf("String  arg0") != -1);
-        assertTrue(resp.indexOf("Holder") == -1);
+        String req = TestFileUtils.getStringFromFile(requestWrapperClass);
+        String resp = TestFileUtils.getStringFromFile(responseWrapperClass);
+        assertTrue(req.contains("String arg0"));
+        assertFalse(req.contains("Holder"));
+        assertTrue(resp.contains("String arg0"));
+        assertFalse(resp.contains("Holder"));
     }
 
     @Test
@@ -591,7 +592,7 @@ public class JavaToProcessorTest extends ProcessorTestBase {
 
         File wsdlFile = new File(output, "inherit.wsdl");
         assertTrue(wsdlFile.exists());
-        assertTrue(getStringFromFile(wsdlFile).indexOf("name=\"bye\"") != -1);
+        assertTrue(TestFileUtils.getStringFromFile(wsdlFile).contains("name=\"bye\""));
     }
 
     @Test
@@ -611,8 +612,8 @@ public class JavaToProcessorTest extends ProcessorTestBase {
         File requestWrapperClass = new File(output, pkgBase + "/AddNumbers.java");
         assertTrue(requestWrapperClass.exists());
 
-        String expectedString = "@XmlElement(name  =  \"number2\",  namespace  =  \"http://example.com\")";
-        assertTrue(getStringFromFile(requestWrapperClass).indexOf(expectedString) != -1);
+        String expectedString = "@XmlElement(name = \"number2\", namespace = \"http://example.com\")";
+        assertTrue(TestFileUtils.getStringFromFile(requestWrapperClass).contains(expectedString));
     }
 
     // Generated schema should use unqualified form in the jaxws case
@@ -631,7 +632,7 @@ public class JavaToProcessorTest extends ProcessorTestBase {
 
         File wsdlFile = new File(output, "action.wsdl");
         assertTrue(wsdlFile.exists());
-        assertTrue(getStringFromFile(wsdlFile).indexOf("elementFormDefault=\"unqualified\"") != -1);
+        assertTrue(TestFileUtils.getStringFromFile(wsdlFile).contains("elementFormDefault=\"unqualified\""));
     }
 
     @Test
@@ -649,8 +650,8 @@ public class JavaToProcessorTest extends ProcessorTestBase {
 
         File wsdlFile = new File(output, "epr_schema1.xsd");
         assertTrue(wsdlFile.exists());
-        String xsd = getStringFromFile(wsdlFile);
-        assertTrue(xsd, xsd.indexOf("ref=") == -1);
+        String xsd = TestFileUtils.getStringFromFile(wsdlFile);
+        assertFalse(xsd, xsd.contains("ref="));
 
     }
 
@@ -718,11 +719,11 @@ public class JavaToProcessorTest extends ProcessorTestBase {
         File wsdlFile = new File(output, "cxf1519.wsdl");
         assertTrue(wsdlFile.exists());
         // schema element
-        String wsdlContent = getStringFromFile(wsdlFile).replaceAll("  ", " ");
-        assertTrue(wsdlContent.indexOf("xmlns:tns=\"http://cxf.apache.org/cxf1519/exceptions\"") != -1);
-        assertTrue(wsdlContent.indexOf("xmlns:tns=\"http://cxf.apache.org/cxf1519/faults\"") != -1);
-        assertTrue(wsdlContent.indexOf("<xsd:complexType name=\"UserException\">") != -1);
-        assertTrue(wsdlContent.indexOf("<xsd:element name=\"UserExceptionFault\"") != -1);
+        String wsdlContent = TestFileUtils.getStringFromFile(wsdlFile);
+        assertTrue(wsdlContent.contains("xmlns:tns=\"http://cxf.apache.org/cxf1519/exceptions\""));
+        assertTrue(wsdlContent.contains("xmlns:tns=\"http://cxf.apache.org/cxf1519/faults\""));
+        assertTrue(wsdlContent.contains("<xsd:complexType name=\"UserException\">"));
+        assertTrue(wsdlContent.contains("<xsd:element name=\"UserExceptionFault\""));
 
     }
 
@@ -740,11 +741,10 @@ public class JavaToProcessorTest extends ProcessorTestBase {
         }
         File wsdlFile = new File(output, "cxf4147.wsdl");
         assertTrue(wsdlFile.exists());
-        String wsdlContent = getStringFromFile(wsdlFile).replaceAll("  ", " ");
-        assertTrue(wsdlContent.indexOf("xsd:element name=\"add\" nillable=\"true\" type=\"xsd:int\"") != -1);
-        assertTrue(wsdlContent.indexOf("xsd:element name=\"add1\" nillable=\"true\" type=\"xsd:string\"")
-                   != -1);
-        assertTrue(wsdlContent.indexOf("wsdl:part name=\"add1\" element=\"tns:add1\"") != -1);
+        String wsdlContent = TestFileUtils.getStringFromFile(wsdlFile);
+        assertTrue(wsdlContent.contains("xsd:element name=\"add\" nillable=\"true\" type=\"xsd:int\""));
+        assertTrue(wsdlContent.contains("xsd:element name=\"add1\" nillable=\"true\" type=\"xsd:string\""));
+        assertTrue(wsdlContent.contains("wsdl:part name=\"add1\" element=\"tns:add1\""));
     }
 
 
diff --git a/tools/validator/pom.xml b/tools/validator/pom.xml
index 316fc7e..71edaf5 100644
--- a/tools/validator/pom.xml
+++ b/tools/validator/pom.xml
@@ -49,11 +49,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>${cxf.asm.groupId}</groupId>
-            <artifactId>${cxf.asm.artifactId}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>wsdl4j</groupId>
             <artifactId>wsdl4j</artifactId>
         </dependency>
@@ -79,6 +74,13 @@
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/tools/wadlto/jaxrs/pom.xml b/tools/wadlto/jaxrs/pom.xml
index f0c6f3f..f89fc69 100644
--- a/tools/wadlto/jaxrs/pom.xml
+++ b/tools/wadlto/jaxrs/pom.xml
@@ -35,11 +35,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-common</artifactId>
             <version>${project.version}</version>
@@ -58,6 +53,12 @@
             <groupId>xml-resolver</groupId>
             <artifactId>xml-resolver</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.jvnet.jaxb2_commons</groupId>
             <artifactId>jaxb2-basics</artifactId>
@@ -69,5 +70,12 @@
             <artifactId>validation-api</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tools/wsdlto/core/pom.xml b/tools/wsdlto/core/pom.xml
index 7467197..75229d5 100644
--- a/tools/wsdlto/core/pom.xml
+++ b/tools/wsdlto/core/pom.xml
@@ -58,16 +58,6 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${cxf.asm.groupId}</groupId>
-            <artifactId>${cxf.asm.artifactId}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>wsdl4j</groupId>
             <artifactId>wsdl4j</artifactId>
         </dependency>
@@ -79,6 +69,19 @@
             <groupId>org.glassfish.jaxb</groupId>
             <artifactId>jaxb-runtime</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/tools/wsdlto/frontend/javascript/pom.xml b/tools/wsdlto/frontend/javascript/pom.xml
index e58aae7..0b6af9f 100644
--- a/tools/wsdlto/frontend/javascript/pom.xml
+++ b/tools/wsdlto/frontend/javascript/pom.xml
@@ -35,11 +35,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-common</artifactId>
             <version>${project.version}</version>
@@ -64,5 +59,18 @@
             <artifactId>cxf-rt-javascript</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tools/wsdlto/frontend/jaxws/pom.xml b/tools/wsdlto/frontend/jaxws/pom.xml
index 9df2241..b77b21a 100644
--- a/tools/wsdlto/frontend/jaxws/pom.xml
+++ b/tools/wsdlto/frontend/jaxws/pom.xml
@@ -39,11 +39,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-common</artifactId>
             <version>${project.version}</version>
@@ -72,5 +67,18 @@
                 </exclusion>
             </exclusions>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tools/wsdlto/misc/pom.xml b/tools/wsdlto/misc/pom.xml
index 12ca327..ff7aa3f 100644
--- a/tools/wsdlto/misc/pom.xml
+++ b/tools/wsdlto/misc/pom.xml
@@ -35,16 +35,6 @@
     </properties>
     <dependencies>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${cxf.asm.groupId}</groupId>
-            <artifactId>${cxf.asm.artifactId}</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>wsdl4j</groupId>
             <artifactId>wsdl4j</artifactId>
         </dependency>
@@ -88,5 +78,18 @@
             <artifactId>cxf-rt-bindings-soap</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tools/wsdlto/test/pom.xml b/tools/wsdlto/test/pom.xml
index 25f001f..ee4cb5c 100644
--- a/tools/wsdlto/test/pom.xml
+++ b/tools/wsdlto/test/pom.xml
@@ -40,11 +40,6 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-wsdlto-core</artifactId>
             <version>${project.version}</version>
@@ -59,6 +54,12 @@
             <artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-bindings-soap</artifactId>
@@ -103,5 +104,12 @@
             <artifactId>jaxb-runtime</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-tools-common</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
index d7b654f..0caf192 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.tools.wsdlto.jaxws;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.lang.reflect.Method;
@@ -42,6 +41,7 @@ import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.tools.common.CommandInterfaceUtils;
+import org.apache.cxf.tools.common.TestFileUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -262,8 +262,8 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         assertFalse("Generated file has been excluded", iona.exists());
 
         File implFile = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java");
-        String str = FileUtils.getStringFromFile(implFile);
-        assertTrue(str.indexOf("com.iona.BareDocumentResponse") > 0);
+        String str = TestFileUtils.getStringFromFile(implFile);
+        assertTrue(str.contains("com.iona.BareDocumentResponse"));
 
         File org = new File(output, "org");
         File apache = new File(org, "apache");
@@ -289,8 +289,8 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         assertFalse("Generated file has been excluded", iona.exists());
 
         File implFile = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java");
-        String str = FileUtils.getStringFromFile(implFile);
-        assertTrue(str.indexOf("com.iona.BareDocumentResponse") > 0);
+        String str = TestFileUtils.getStringFromFile(implFile);
+        assertTrue(str.contains("com.iona.BareDocumentResponse"));
 
         File org = new File(output, "org");
         File apache = new File(org, "apache");
@@ -464,25 +464,10 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
             .getPrivClassAnnotation(clz, WebServiceClient.class);
         assertEquals("http://cxf.apache.org/w2j/hello_world_soap_http/service",
                      webServiceClient.targetNamespace());
-        File file = new File(output,
-                             "org/apache/cxf/w2j/hello_world_soap_http/Greeter_SoapPortTest1_Client.java");
-        FileInputStream fin = new FileInputStream(file);
-        byte[] buffer = new byte[30000];
-        int index = -1;
-        int size = fin.read(buffer);
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-        while (size != -1) {
-            bout.write(buffer, 0, size);
-            index = bout.toString()
-                .indexOf("new QName(\"http://cxf.apache.org/w2j/hello_world_soap_http/service\","
-                             + " \"SOAPService_Test1\")");
-            if (index > 0) {
-                break;
-            }
-            size = fin.read(buffer);
-        }
-        fin.close();
-        assertTrue("Service QName in client is not correct", index > -1);
+        String file = TestFileUtils.getStringFromFile(new File(output,
+                "org/apache/cxf/w2j/hello_world_soap_http/Greeter_SoapPortTest1_Client.java"));
+        assertTrue("Service QName in client is not correct", file.contains(
+                "new QName(\"http://cxf.apache.org/w2j/hello_world_soap_http/service\", \"SOAPService_Test1\")"));
     }
 
     @Test
@@ -607,7 +592,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         String str3 = "org.apache.cxf.mime.Address";
         String str4 = "http://cxf.apache.org/w2j/hello_world_mime/types";
 
-        String file = getStringFromFile(new File(output.getCanonicalPath()
+        String file = TestFileUtils.getStringFromFile(new File(output.getCanonicalPath()
                                                  + "/org/apache/cxf/w2j/hello_world_mime/Hello.java"));
 
         assertTrue(file.contains(str1));
@@ -623,13 +608,12 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         processor.setContext(env);
         processor.execute();
 
-        String results = FileUtils.getStringFromFile(new File(output.getCanonicalPath(),
+        String results = TestFileUtils.getStringFromFile(new File(output.getCanonicalPath(),
                                                               "org/apache/sayhi/SayHi.java"));
-        assertTrue(results.trim().length() > 0);
 
-        assertTrue(results.indexOf("@WebResult(name  =  \"return\",  "
-                                   + "targetNamespace  =  \"http://apache.org/sayHi\")") != -1);
-        assertTrue(results.indexOf("@WebResult(name  =  \"return\",  targetNamespace  =  \"\")") != -1);
+        assertTrue(results.contains("@WebResult(name = \"return\", "
+                                   + "targetNamespace = \"http://apache.org/sayHi\")"));
+        assertTrue(results.contains("@WebResult(name = \"return\", targetNamespace = \"\")"));
     }
 
     @Test
@@ -741,11 +725,11 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
 
         processor.execute();
         File file = new File(output.getCanonicalPath() + "/build.xml");
-        String str = FileUtils.getStringFromFile(file);
-        assertTrue(str.indexOf("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest1_Client") > -1);
-        assertTrue(str.indexOf("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest2_Client") > -1);
-        assertTrue(str.indexOf("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest1_Server") > -1);
-        assertTrue(str.indexOf("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest2_Server") > -1);
+        String str = TestFileUtils.getStringFromFile(file);
+        assertTrue(str.contains("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest1_Client"));
+        assertTrue(str.contains("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest2_Client"));
+        assertTrue(str.contains("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest1_Server"));
+        assertTrue(str.contains("org.apache.cxf.w2j.hello_world_soap_http.Greeter_SoapPortTest2_Server"));
     }
 
     @Test
@@ -816,10 +800,10 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         processor.setContext(env);
         processor.execute();
 
-        String results = FileUtils.getStringFromFile(new File(output,
+        String results = TestFileUtils.getStringFromFile(new File(output,
                                                               "org/tempuri/GreeterRPCLit.java"));
-        assertTrue(results.indexOf("@WebParam(partName  =  \"inInt\",  name  =  \"inInt\")") != -1);
-        assertTrue(results.indexOf("Style.RPC") != -1);
+        assertTrue(results.contains("@WebParam(partName = \"inInt\", name = \"inInt\")"));
+        assertTrue(results.contains("Style.RPC"));
     }
 
     @Test
@@ -847,12 +831,12 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         processor.setContext(env);
         processor.execute();
 
-        String results = FileUtils
+        String results = TestFileUtils
             .getStringFromFile(new File(output.getCanonicalPath(),
                                         "soapinterface/ems/esendex/com/AccountServiceSoap.java"));
-        assertTrue(results.indexOf("public  int  getMessageLimit") != -1);
-        assertTrue(results.indexOf("name  =  \"MessengerHeader") != -1);
-        assertTrue(results.indexOf("header  =  true") != -1);
+        assertTrue(results.contains("public int getMessageLimit"));
+        assertTrue(results.contains("name = \"MessengerHeader"));
+        assertTrue(results.contains("header = true"));
     }
 
     @Test
@@ -1018,14 +1002,14 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         processor.setContext(env);
         processor.execute();
 
-        List<String> results1 = FileUtils.readLines(new File(output.getCanonicalPath(),
+        List<String> results1 = FileUtils.readLines(new File(output,
                                                              "org/mypkg/MyGreeter.java"));
 
         assertTrue(results1.contains(" * this is package javadoc"));
         assertTrue(results1.contains(" * this is class javadoc"));
         assertTrue(results1.contains("     * this is method javadoc"));
 
-        List<String> results2 = FileUtils.readLines(new File(output.getCanonicalPath(),
+        List<String> results2 = FileUtils.readLines(new File(output,
                                                              "org/mypkg/SOAPServiceTest1.java"));
 
         boolean match1 = false;
@@ -1131,7 +1115,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         assertNotNull(output);
         File file = new File(output, "org/cxf/package-info.java");
         assertTrue(file.exists());
-        String str = FileUtils.getStringFromFile(file);
+        String str = TestFileUtils.getStringFromFile(file);
         assertTrue(str.contains("http://child/xsd"));
     }
 
@@ -1146,7 +1130,7 @@ public class CodeGenBugTest extends AbstractCodeGenTest {
         File file = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/types/SayHi.java");
 
         assertTrue(file.exists());
-        String str = FileUtils.getStringFromFile(file);
+        String str = TestFileUtils.getStringFromFile(file);
         assertTrue(str.contains("@XmlLocation"));
         assertTrue(str.contains("synchronized"));
     }
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
index 6434448..20ce0b7 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
@@ -47,6 +47,7 @@ import javax.xml.ws.ResponseWrapper;
 import javax.xml.ws.WebFault;
 
 import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.tools.common.TestFileUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.AnnotationUtil;
@@ -1289,9 +1290,9 @@ public class CodeGenTest extends AbstractCodeGenTest {
 
         File greeter = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java");
         assertTrue(output.exists());
-        String contents = FileUtils.getStringFromFile(greeter);
-        assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
-        assertTrue(contents.indexOf("@ResponseWrapper") == -1);
+        String contents = TestFileUtils.getStringFromFile(greeter);
+        assertTrue(contents.contains("SOAPBinding.ParameterStyle.BARE"));
+        assertFalse(contents.contains("@ResponseWrapper"));
     }
     @Test
     public void testBareFromCommandLine() throws Exception {
@@ -1303,9 +1304,9 @@ public class CodeGenTest extends AbstractCodeGenTest {
 
         File greeter = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java");
         assertTrue(output.exists());
-        String contents = FileUtils.getStringFromFile(greeter);
-        assertTrue(contents.indexOf("SOAPBinding.ParameterStyle.BARE") != -1);
-        assertTrue(contents.indexOf("@ResponseWrapper") == -1);
+        String contents = TestFileUtils.getStringFromFile(greeter);
+        assertTrue(contents.contains("SOAPBinding.ParameterStyle.BARE"));
+        assertFalse(contents.contains("@ResponseWrapper"));
     }
     @Test
     public void testMimeFromCommandLine() throws Exception {
@@ -1319,8 +1320,8 @@ public class CodeGenTest extends AbstractCodeGenTest {
         String str1 = "javax.xml.ws.Holder<java.awt.Image>";
         String str2 = "javax.xml.transform.Source";
 
-        String file = getStringFromFile(new File(output.getCanonicalPath()
-                                        + "/org/apache/cxf/w2j/hello_world_mime/Hello.java"));
+        String file = TestFileUtils.getStringFromFile(new File(output,
+                                        "org/apache/cxf/w2j/hello_world_mime/Hello.java"));
 
         assertTrue(file.contains(str1));
         assertTrue(file.contains(str2));
@@ -1334,8 +1335,8 @@ public class CodeGenTest extends AbstractCodeGenTest {
 
         File sei = new File(output, "type_substitution/server/CarDealer.java");
         assertTrue(output.exists());
-        String contents = FileUtils.getStringFromFile(sei);
-        assertTrue(contents.indexOf("@XmlSeeAlso({ObjectFactory.class})") != -1);
+        String contents = TestFileUtils.getStringFromFile(sei);
+        assertTrue(contents.contains("@XmlSeeAlso({ObjectFactory.class})"));
     }
 
     @Test
@@ -1347,12 +1348,12 @@ public class CodeGenTest extends AbstractCodeGenTest {
 
         File sei = new File(output, "com/example/AddNumbersPortType.java");
         assertTrue(sei.exists());
-        String contents = FileUtils.getStringFromFile(sei).replace("  ", " ");
+        String contents = TestFileUtils.getStringFromFile(sei).replace("  ", " ");
         String expected = "@Action(input = \"3in\", output = \"3out\", "
             + "fault = {@FaultAction(className = AddNumbersFault_Exception.class, value = \"3fault\")})";
-        assertTrue(contents.indexOf("import javax.xml.ws.Action;") != -1);
-        assertTrue(contents.indexOf("import javax.xml.ws.FaultAction;") != -1);
-        assertTrue(contents.indexOf(expected) != -1);
+        assertTrue(contents.contains("import javax.xml.ws.Action;"));
+        assertTrue(contents.contains("import javax.xml.ws.FaultAction;"));
+        assertTrue(contents.contains(expected));
     }
 
     @Test
@@ -1691,13 +1692,13 @@ public class CodeGenTest extends AbstractCodeGenTest {
         processor.setContext(env);
         processor.execute();
 
-        List<String> results1 = FileUtils.readLines(new File(output.getCanonicalPath(),
+        List<String> results1 = FileUtils.readLines(new File(output,
             "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java"));
 
         assertTrue(results1.contains(" * porttype documentation"));
         assertTrue(results1.contains("     * porttype op documentation"));
 
-        List<String> results2 = FileUtils.readLines(new File(output.getCanonicalPath(),
+        List<String> results2 = FileUtils.readLines(new File(output,
             "org/apache/cxf/w2j/hello_world_soap_http/SOAPServiceTest1.java"));
 
         boolean match1 = false;
diff --git a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/JAXWSBindingTest.java b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/JAXWSBindingTest.java
index 7fafb1e..0e3adec 100644
--- a/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/JAXWSBindingTest.java
+++ b/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/JAXWSBindingTest.java
@@ -20,8 +20,8 @@ package org.apache.cxf.tools.wsdlto.jaxws;
 
 import java.io.File;
 
-import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.tools.common.ProcessorTestBase;
+import org.apache.cxf.tools.common.TestFileUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
 import org.apache.cxf.tools.wsdlto.core.FrontEndProfile;
@@ -65,7 +65,7 @@ public class JAXWSBindingTest extends ProcessorTestBase {
         String path = "/org/apache/cxf/tools/fortest/date";
         File sei = new File(output, path + "/EchoDate.java");
         assertTrue(sei.exists());
-        String seiContent = FileUtils.getStringFromFile(sei);
-        assertTrue(seiContent.indexOf("java.util.Date") != -1);
+        String seiContent = TestFileUtils.getStringFromFile(sei);
+        assertTrue(seiContent.contains("java.util.Date"));
     }
 }
\ No newline at end of file