db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1491005 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/i18n/UrlLocaleTest.java junit/SupportFilesSetup.java
Date Sat, 08 Jun 2013 15:53:29 GMT
Author: kmarsden
Date: Sat Jun  8 15:53:29 2013
New Revision: 1491005

URL: http://svn.apache.org/r1491005
Log:
DERBY-6246 convert i18n/urlLocale.sql  to JUnit

Correct extinout path resolution. Files were not getting deleted.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java?rev=1491005&r1=1491004&r2=1491005&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/UrlLocaleTest.java
Sat Jun  8 15:53:29 2013
@@ -68,8 +68,7 @@ public class UrlLocaleTest extends BaseJ
         s.executeUpdate("call checkRDefaultLoc()");
         
             // create a swiss database
-        String url = TestConfiguration.getCurrent().
-                getJDBCUrl(SupportFilesSetup.getReadWrite("swissdb").getPath());
+        String url = getReadWriteJDBCURL("swissdb");
         url += ";create=true;territory=fr_CH";
         Connection locConn = DriverManager.getConnection(url);
         createLocaleProcedures(locConn);
@@ -80,8 +79,7 @@ public class UrlLocaleTest extends BaseJ
         
         //-- create a Hindi in India database (hi_IN)
         
-        url = TestConfiguration.getCurrent().getJDBCUrl(
-                SupportFilesSetup.getReadWrite("hindi").getPath());
+        url = getReadWriteJDBCURL("hindi");
         url += ";create=true;territory=hi_IN";
         locConn = DriverManager.getConnection(url);
         createLocaleProcedures(locConn);
@@ -91,8 +89,7 @@ public class UrlLocaleTest extends BaseJ
         locConn.close();
        //- now try one with a variant
        // -- create a English in Israel database for JavaOS en_IL_JavaOS
-        url = TestConfiguration.getCurrent().
-                getJDBCUrl(SupportFilesSetup.getReadWrite("Israel").getPath());
+        url = getReadWriteJDBCURL("Israel");
         url += ";create=true;territory=en_IL_JavaOS";
         locConn = DriverManager.getConnection(url);
         createLocaleProcedures(locConn);
@@ -103,8 +100,7 @@ public class UrlLocaleTest extends BaseJ
         
         // now try with just a language - we support this
         // as some vms do.
-        url = TestConfiguration.getCurrent().
-                getJDBCUrl(SupportFilesSetup.getReadWrite("bacon").getPath());
+        url = getReadWriteJDBCURL("bacon");
         url += ";create=true;territory=da";
         locConn = DriverManager.getConnection(url);
         createLocaleProcedures(locConn);
@@ -152,6 +148,16 @@ public class UrlLocaleTest extends BaseJ
         }
     }
     
+    /**
+     * Get JDBC URL for database to be accessed in the read-write directory
+     * @param dbname short database name to be created 
+     * @return
+     */
+    private static String getReadWriteJDBCURL(String dbname)
+   {
+        return TestConfiguration.getCurrent().
+        getJDBCUrl(SupportFilesSetup.getReadWriteFileName(dbname));
+    }
     
     /**
      * Create procedures to test current territory value

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java?rev=1491005&r1=1491004&r2=1491005&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
Sat Jun  8 15:53:29 2013
@@ -242,6 +242,22 @@ public class SupportFilesSetup extends T
             }
         });
     }
+    
+    /**
+     * Get the full name of the file.
+     * @param name short name of file
+     * @return absolute path of file in EXTINOUT
+     */
+    public static String getReadWriteFileName(final String name)
+    {
+        return AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+            public String run() {
+                return getReadWrite(name).getAbsolutePath();
+            }
+        });
+    }
+    
     /**
      * Obtain a File for the local copy of a read-write resource.
      * @param name Base name for the resouce.



Mime
View raw message