You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2010/08/23 14:07:33 UTC

svn commit: r988096 - in /cayenne/main/trunk: build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/ build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ framework/cayenne-jdk1.5-unpublished/src/mai...

Author: aadamchik
Date: Mon Aug 23 12:07:32 2010
New Revision: 988096

URL: http://svn.apache.org/viewvc?rev=988096&view=rev
Log:
deprecating some general purpose utility methods in Util class

(they are unused by Cayenne)

Modified:
    cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java
    cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ResourceUtil.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ZipUtilTest.java
    cayenne/main/trunk/framework/cayenne-modeler/pom.xml
    cayenne/main/trunk/framework/cayenne-project-unpublished/pom.xml
    cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/unit/Project2Case.java
    cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/upgrade/v6/ProjectUpgrader_V6Test.java
    cayenne/main/trunk/framework/cayenne-wocompat-unpublished/pom.xml
    cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/unit/WOCompatCase.java

Modified: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/file/FileUtil.java Mon Aug 23 12:07:32 2010
@@ -56,7 +56,7 @@ public final class FileUtil {
         return baseTestDirectory;
     }
 
-    private static boolean delete(String filePath, boolean recursive) {
+    public static boolean delete(String filePath, boolean recursive) {
         File file = new File(filePath);
         if (!file.exists()) {
             return true;

Modified: cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ResourceUtil.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ResourceUtil.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ResourceUtil.java (original)
+++ cayenne/main/trunk/build-tools/cayenne-test-utilities/src/main/java/org/apache/cayenne/test/resource/ResourceUtil.java Mon Aug 23 12:07:32 2010
@@ -36,7 +36,7 @@ public class ResourceUtil {
     public static void copyResourceToFile(String resourceName, File file) {
         URL in = getResource(resourceName);
 
-        if (!copy(in, file)) {
+        if (!copyResourceToFile(in, file)) {
             throw new RuntimeException("Error copying resource to file : " + file);
         }
     }
@@ -63,7 +63,7 @@ public class ResourceUtil {
         return in;
     }
 
-    private static boolean copy(URL from, File to) {
+    public static boolean copyResourceToFile(URL from, File to) {
         BufferedInputStream urlin = null;
         BufferedOutputStream fout = null;
         try {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/Util.java Mon Aug 23 12:07:32 2010
@@ -120,6 +120,8 @@ public class Util {
     /**
      * Copies file contents from source to destination. Makes up for the lack of file
      * copying utilities in Java
+     * 
+     * @deprecated since 3.1 this method is not used by Cayenne
      */
     public static boolean copy(File source, File destination) {
         BufferedInputStream fin = null;
@@ -157,6 +159,8 @@ public class Util {
 
     /**
      * Save URL contents to a file.
+     * 
+     * @deprecated since 3.1 this method is not used by Cayenne.
      */
     public static boolean copy(URL from, File to) {
         BufferedInputStream urlin = null;
@@ -198,10 +202,7 @@ public class Util {
      * Reads data from the input and writes it to the output, until the end of the input
      * stream.
      * 
-     * @param in
-     * @param out
-     * @param bufSizeHint
-     * @throws IOException
+     * @deprecated since 3.1 this method is unused by Cayenne.
      */
     public static void copyPipe(InputStream in, OutputStream out, int bufSizeHint)
             throws IOException {
@@ -216,6 +217,8 @@ public class Util {
     /**
      * Deletes a file or directory, allowing recursive directory deletion. This is an
      * improved version of File.delete() method.
+     * 
+     * @deprecated since 3.1 this method is unused by Cayenne.
      */
     public static boolean delete(String filePath, boolean recursive) {
         File file = new File(filePath);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ZipUtilTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ZipUtilTest.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ZipUtilTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ZipUtilTest.java Mon Aug 23 12:07:32 2010
@@ -25,6 +25,7 @@ import java.net.URL;
 import junit.framework.TestCase;
 
 import org.apache.cayenne.test.file.FileUtil;
+import org.apache.cayenne.test.resource.ResourceUtil;
 
 /**
  * @deprecated since 3.1
@@ -39,7 +40,7 @@ public class ZipUtilTest extends TestCas
         File jarCopy = new File(
                 FileUtil.baseTestDirectory(),
                 "jar-test.jar");
-        Util.copy(jarResource, jarCopy);
+        ResourceUtil.copyResourceToFile(jarResource, jarCopy);
 
         File unjarDir = FileUtil.baseTestDirectory();
         File unjarRootDir = new File(unjarDir, "jar-test");
@@ -59,8 +60,8 @@ public class ZipUtilTest extends TestCas
             assertTrue(manifest.isFile());
         }
         finally {
-            Util.delete(unjarRootDir.getPath(), true);
-            Util.delete(new File(unjarDir, "META-INF").getPath(), true);
+            FileUtil.delete(unjarRootDir.getPath(), true);
+            FileUtil.delete(new File(unjarDir, "META-INF").getPath(), true);
         }
     }
 
@@ -70,7 +71,7 @@ public class ZipUtilTest extends TestCas
         File jarCopy = new File(
                 FileUtil.baseTestDirectory(),
                 "jar-test.jar");
-        Util.copy(jarResource, jarCopy);
+        ResourceUtil.copyResourceToFile(jarResource, jarCopy);
 
         File unjarDir = FileUtil.baseTestDirectory();
         File unjarRootDir = new File(unjarDir, "jar-test");
@@ -91,14 +92,14 @@ public class ZipUtilTest extends TestCas
             // assertEquals(jar.length(), newJarFile.length());
 
             // try unzipping it again
-            Util.delete(unjarRootDir.getPath(), true);
-            Util.delete(new File(unjarDir, "META-INF").getPath(), true);
+            FileUtil.delete(unjarRootDir.getPath(), true);
+            FileUtil.delete(new File(unjarDir, "META-INF").getPath(), true);
             ZipUtil.unzip(newJarFile, unjarDir);
 
         }
         finally {
-            Util.delete(unjarRootDir.getPath(), true);
-            Util.delete(new File(unjarDir, "META-INF").getPath(), true);
+            FileUtil.delete(unjarRootDir.getPath(), true);
+            FileUtil.delete(new File(unjarDir, "META-INF").getPath(), true);
             newJarFile.delete();
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-modeler/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/pom.xml?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/pom.xml (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/pom.xml Mon Aug 23 12:07:32 2010
@@ -35,7 +35,7 @@
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
 		</dependency>
-
+	
 		<dependency>
 			<groupId>commons-collections</groupId>
 			<artifactId>commons-collections</artifactId>

Modified: cayenne/main/trunk/framework/cayenne-project-unpublished/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-project-unpublished/pom.xml?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-project-unpublished/pom.xml (original)
+++ cayenne/main/trunk/framework/cayenne-project-unpublished/pom.xml Mon Aug 23 12:07:32 2010
@@ -38,6 +38,13 @@
 		</dependency>
 
 		<dependency>
+			<groupId>org.apache.cayenne.build-tools</groupId>
+			<artifactId>cayenne-test-utilities</artifactId>
+			<version>${version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
 			<groupId>org.apache.cayenne.unpublished</groupId>
 			<artifactId>cayenne-di-unpublished</artifactId>
 			<version>${version}</version>

Modified: cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/unit/Project2Case.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/unit/Project2Case.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/unit/Project2Case.java (original)
+++ cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/unit/Project2Case.java Mon Aug 23 12:07:32 2010
@@ -28,7 +28,7 @@ import javax.xml.parsers.ParserConfigura
 import junit.framework.TestCase;
 
 import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.util.Util;
+import org.apache.cayenne.test.file.FileUtil;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -67,7 +67,7 @@ public class Project2Case extends TestCa
 
         // delete old tests
         if (testDirectory.exists()) {
-            if (!Util.delete(location, true)) {
+            if (!FileUtil.delete(location, true)) {
                 throw new CayenneRuntimeException(
                         "Error deleting test directory '%s'",
                         location);

Modified: cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/upgrade/v6/ProjectUpgrader_V6Test.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/upgrade/v6/ProjectUpgrader_V6Test.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/upgrade/v6/ProjectUpgrader_V6Test.java (original)
+++ cayenne/main/trunk/framework/cayenne-project-unpublished/src/test/java/org/apache/cayenne/project2/upgrade/v6/ProjectUpgrader_V6Test.java Mon Aug 23 12:07:32 2010
@@ -44,6 +44,7 @@ import org.apache.cayenne.project2.upgra
 import org.apache.cayenne.project2.upgrade.UpgradeType;
 import org.apache.cayenne.resource.Resource;
 import org.apache.cayenne.resource.URLResource;
+import org.apache.cayenne.test.resource.ResourceUtil;
 import org.apache.cayenne.util.Util;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -171,7 +172,7 @@ public class ProjectUpgrader_V6Test exte
             URL url = getClass().getClassLoader().getResource(sourceUrl + source);
             File target = new File(testFolder, source);
             assertNotNull(source);
-            Util.copy(url, target);
+            ResourceUtil.copyResourceToFile(url, target);
             targetsBefore.add(target);
         }
 

Modified: cayenne/main/trunk/framework/cayenne-wocompat-unpublished/pom.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-wocompat-unpublished/pom.xml?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-wocompat-unpublished/pom.xml (original)
+++ cayenne/main/trunk/framework/cayenne-wocompat-unpublished/pom.xml Mon Aug 23 12:07:32 2010
@@ -36,6 +36,13 @@
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
 		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.cayenne.build-tools</groupId>
+			<artifactId>cayenne-test-utilities</artifactId>
+			<version>${version}</version>
+			<scope>test</scope>
+		</dependency>
 
 		<dependency>
 			<groupId>org.apache.cayenne.unpublished</groupId>

Modified: cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/unit/WOCompatCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/unit/WOCompatCase.java?rev=988096&r1=988095&r2=988096&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/unit/WOCompatCase.java (original)
+++ cayenne/main/trunk/framework/cayenne-wocompat-unpublished/src/test/java/org/apache/cayenne/wocompat/unit/WOCompatCase.java Mon Aug 23 12:07:32 2010
@@ -20,11 +20,11 @@ package org.apache.cayenne.wocompat.unit
 
 import java.io.File;
 
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.util.Util;
-
 import junit.framework.TestCase;
 
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.test.file.FileUtil;
+
 public class WOCompatCase extends TestCase {
 
     protected File setupTestDirectory(String subfolder) {
@@ -34,7 +34,7 @@ public class WOCompatCase extends TestCa
 
         // delete old tests
         if (testDirectory.exists()) {
-            if (!Util.delete(location, true)) {
+            if (!FileUtil.delete(location, true)) {
                 throw new CayenneRuntimeException(
                         "Error deleting test directory '%s'",
                         location);