Repository: cayenne
Updated Branches:
  refs/heads/master a7d680574 -> 98a32fd77


fix tests path


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/98a32fd7
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/98a32fd7
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/98a32fd7

Branch: refs/heads/master
Commit: 98a32fd77d732da16598d037cbcf941988691df0
Parents: a7d6805
Author: alexkolonitsky <alex.kolonit...@gmail.com>
Authored: Thu Nov 27 20:50:00 2014 +0300
Committer: aadamchik <aadamc...@apache.org>
Committed: Fri Nov 28 09:32:28 2014 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/access/DbLoader.java     |  4 +-
 .../cayenne/access/loader/filters/DbPath.java   |  3 +-
 .../access/loader/filters/EntityFilters.java    |  2 -
 .../access/loader/filters/ExcludeFilter.java    |  1 -
 .../cayenne/access/loader/filters/Filter.java   |  3 +-
 .../access/loader/filters/FiltersConfig.java    |  3 +-
 .../access/loader/filters/IncludeFilter.java    |  3 +-
 .../access/loader/filters/ListFilter.java       |  3 +-
 .../cayenne/access/loader/mapper/DbType.java    |  3 +-
 .../cayenne/tools/DbImporterTaskTest.java       | 41 ++++++++++++++++++--
 10 files changed, 44 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java 
b/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
index 8e81483..3a103e1 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/access/DbLoader.java
@@ -794,9 +794,7 @@ public class DbLoader {
      * </p>
      * 
      * @since 1.1
-     * @deprecated since 4.0 use
-     *             {@link #loadProcedures(DataMap, String, String, String)} 
that
-     *             supports "catalog" pattern.
+     * @deprecated since 4.0 use loadProcedures(DataMap, String, String, 
String) that supports "catalog" pattern.
      */
     @Deprecated
     public void loadProceduresFromDB(String schemaPattern, String namePattern, 
DataMap dataMap) throws SQLException {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/DbPath.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/DbPath.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/DbPath.java
index b9db92d..813ce94 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/DbPath.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/DbPath.java
@@ -21,8 +21,7 @@ package org.apache.cayenne.access.loader.filters;
 import java.util.regex.Pattern;
 
 /**
-* @since 3.2.
-* @Immutable
+* @since 4.0.
 */
 public class DbPath implements Comparable<DbPath> {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/EntityFilters.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/EntityFilters.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/EntityFilters.java
index acfa38c..42321e2 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/EntityFilters.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/EntityFilters.java
@@ -31,7 +31,6 @@ import static org.apache.commons.lang.StringUtils.isBlank;
 
 /**
  * @since 3.2.
- * @Immutable
  */
 public class EntityFilters {
 
@@ -151,7 +150,6 @@ public class EntityFilters {
     }
 
     /**
-     * @Immutable
      * @param <T>
      */
     private abstract static class EntityFilter<T> implements Filter<T> {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ExcludeFilter.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ExcludeFilter.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ExcludeFilter.java
index 932531f..3db193e 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ExcludeFilter.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ExcludeFilter.java
@@ -22,7 +22,6 @@ import java.util.regex.Pattern;
 
 /**
  * @since 4.0
- * @Immutable
  */
 public class ExcludeFilter extends IncludeFilter {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/Filter.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/Filter.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/Filter.java
index c499276..bee1d1d 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/Filter.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/Filter.java
@@ -19,8 +19,7 @@
 package org.apache.cayenne.access.loader.filters;
 
 /**
- * @since 3.2.
- * @Immutable
+ * @since 4.0
  */
 public interface Filter<T> {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/FiltersConfig.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/FiltersConfig.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/FiltersConfig.java
index 4e79811..c59da15 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/FiltersConfig.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/FiltersConfig.java
@@ -27,8 +27,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * @since 3.2.
- * @Immutable
+ * @since 4.0
  */
 public class FiltersConfig {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/IncludeFilter.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/IncludeFilter.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/IncludeFilter.java
index eeb90dc..98fa87c 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/IncludeFilter.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/IncludeFilter.java
@@ -21,8 +21,7 @@ package org.apache.cayenne.access.loader.filters;
 import java.util.regex.Pattern;
 
 /**
- * @since 3.2.
- * @Immutable
+ * @since 4.0
  */
 public class IncludeFilter implements Filter<String> {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ListFilter.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ListFilter.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ListFilter.java
index 49fdb38..7703dfb 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ListFilter.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/filters/ListFilter.java
@@ -28,8 +28,7 @@ import static 
org.apache.cayenne.access.loader.filters.FilterFactory.NULL;
 import static org.apache.cayenne.access.loader.filters.FilterFactory.TRUE;
 
 /**
- * @since 3.2.
- * @Immutable
+ * @since 4.0
  */
 public class ListFilter<T> implements Filter<T> {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-server/src/main/java/org/apache/cayenne/access/loader/mapper/DbType.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/mapper/DbType.java
 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/mapper/DbType.java
index 731f824..806b437 100644
--- 
a/cayenne-server/src/main/java/org/apache/cayenne/access/loader/mapper/DbType.java
+++ 
b/cayenne-server/src/main/java/org/apache/cayenne/access/loader/mapper/DbType.java
@@ -27,8 +27,7 @@ import org.apache.commons.logging.LogFactory;
 import static org.apache.commons.lang.StringUtils.isBlank;
 
 /**
- * @since 3.2.
- * @Immutable
+ * @since 4.0
  */
 public class DbType implements Comparable<DbType> {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/98a32fd7/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
----------------------------------------------------------------------
diff --git 
a/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java 
b/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
index 647b66d..c17cf40 100644
--- 
a/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
+++ 
b/cayenne-tools/src/test/java/org/apache/cayenne/tools/DbImporterTaskTest.java
@@ -19,6 +19,8 @@
 
 package org.apache.cayenne.tools;
 
+import org.apache.cayenne.test.file.FileUtil;
+import org.apache.cayenne.test.resource.ResourceUtil;
 import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
@@ -34,6 +36,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
@@ -42,6 +45,7 @@ import java.sql.Statement;
 
 import static 
org.apache.cayenne.tools.dbimport.config.DefaultReverseEngineeringLoaderTest.*;
 import static org.apache.commons.lang.StringUtils.isBlank;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 public class DbImporterTaskTest {
@@ -78,7 +82,10 @@ public class DbImporterTaskTest {
 
     private DbImporterTask getCdbImport(String buildFile) {
         Project project = new Project();
-        ProjectHelper.configureProject(project, new File(getPackagePath() + 
"/" + buildFile));
+
+        File map = distDir(buildFile);
+        ResourceUtil.copyResourceToFile(getPackagePath() + "/" + buildFile, 
map);
+        ProjectHelper.configureProject(project, map);
 
         UnknownElement task = (UnknownElement) 
project.getTargets().get("dist").getTasks()[0];
         task.maybeConfigure();
@@ -86,14 +93,35 @@ public class DbImporterTaskTest {
         return (DbImporterTask) task.getRealThing();
     }
 
+    private static File distDir(String name) {
+        File distDir = new File(FileUtil.baseTestDirectory(), "cdbImport");
+        File file = new File(distDir, name);
+        distDir = file.getParentFile();
+        // prepare destination directory
+        if (!distDir.exists()) {
+            assertTrue(distDir.mkdirs());
+        }
+        return file;
+    }
+
     private String getPackagePath() {
-        return 
getClass().getClassLoader().getResource(getClass().getPackage().getName().replace('.',
 '/')).getPath();
+        return getClass().getPackage().getName().replace('.', '/');
     }
 
     private void test(String name) throws Exception {
         DbImporterTask cdbImport = getCdbImport("dbimport/" + name);
         File mapFile = cdbImport.getMap();
-        File mapFileCopy = new File(mapFile.getParentFile(), "copy-" + 
mapFile.getName());
+        URL mapUrl = this.getClass().getResource("dbimport/" + 
mapFile.getName());
+        if (mapUrl != null && new File(mapUrl.toURI()).exists()) {
+            ResourceUtil.copyResourceToFile(mapUrl, mapFile);
+        }
+
+        URL mapUrlRes = this.getClass().getResource("dbimport/" + 
mapFile.getName() + "-result");
+        if (mapUrlRes != null && new File(mapUrlRes.toURI()).exists()) {
+            ResourceUtil.copyResourceToFile(mapUrlRes, new 
File(mapFile.getParentFile(), mapFile.getName() + "-result"));
+        }
+
+        File mapFileCopy = distDir("copy-" + mapFile.getName());
         if (mapFile.exists()) {
             FileUtils.getFileUtils().copyFile(mapFile, mapFileCopy);
             cdbImport.setMap(mapFileCopy);
@@ -160,7 +188,12 @@ public class DbImporterTaskTest {
         // Get a connection
         Statement stmt = 
DriverManager.getConnection(dbImportConfiguration.getUrl()).createStatement();
 
-        for (String sql : FileUtils.readFully(new FileReader(getPackagePath() 
+ "/dbimport/" + sqlFile + ".sql")).split(";")) {
+
+        String name = "dbimport/" + sqlFile + ".sql";
+        File file = distDir(name);
+        ResourceUtil.copyResourceToFile(getPackagePath() + "/" + name, file);
+
+        for (String sql : FileUtils.readFully(new 
FileReader(file)).split(";")) {
             stmt.execute(sql);
         }
     }

Reply via email to