db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1137213 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/tools/ImportExportIJTest.java util/ScriptTestCase.java
Date Sat, 18 Jun 2011 16:55:08 GMT
Author: kahatlen
Date: Sat Jun 18 16:55:08 2011
New Revision: 1137213

URL: http://svn.apache.org/viewvc?rev=1137213&view=rev
Log:
DERBY-5217: make ImportExportIJTest pass in non-English locale

- Reset IJ's locale between each ScriptTestCase

- Create fresh database for ImportExportIJTest to make it pick up
  the new locale

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java?rev=1137213&r1=1137212&r2=1137213&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportIJTest.java
Sat Jun 18 16:55:08 2011
@@ -20,12 +20,16 @@
 
 package org.apache.derbyTesting.functionTests.tests.tools;
 
+import java.util.Locale;
+
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.derbyTesting.functionTests.util.ScriptTestCase;
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.LocaleTestSetup;
 import org.apache.derbyTesting.junit.SupportFilesSetup;
+import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  *	Test that runs the importExportThruIJ.sql script and compares the output 
@@ -39,7 +43,7 @@ public final class ImportExportIJTest ex
 	 * @param script - the name of the script
 	 */
 	private ImportExportIJTest(String script) {
-		super(script);
+		super(script, true);
 	}
 
 	
@@ -73,7 +77,12 @@ public final class ImportExportIJTest ex
             "functionTests/testData/ImportExport/derby-2193-linenumber.txt"
             }
         );
-        return tst;
-//		return suite;
+
+        // This test should run in English locale since it compares error
+        // messages against a canon based on the English message text. Also,
+        // run the test in a fresh database, since the language of the message
+        // text is determined when the database is created.
+        tst = TestConfiguration.singleUseDatabaseDecorator(tst);
+        return new LocaleTestSetup(tst, Locale.ENGLISH);
 	}
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java?rev=1137213&r1=1137212&r2=1137213&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
Sat Jun 18 16:55:08 2011
@@ -25,6 +25,7 @@ import java.security.AccessController;
 import java.sql.Connection;
 import java.util.Locale;
 
+import org.apache.derby.iapi.tools.i18n.LocalizedResource;
 import org.apache.derbyTesting.junit.Derby;
 
 import junit.framework.Test;
@@ -213,6 +214,10 @@ public abstract class ScriptTestCase ext
                 return null;
             }
         });
+
+        // Reset IJ's locale to allow it to pick up the new locale from
+        // the environment.
+        LocalizedResource.resetLocalizedResourceCache();
     }
 
     /**
@@ -227,5 +232,8 @@ public abstract class ScriptTestCase ext
                 return null;
             }
         });
+
+        // Forget the locale used by this test.
+        LocalizedResource.resetLocalizedResourceCache();
     }
 }



Mime
View raw message