db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1055998 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: tests/i18n/LocalizedAttributeScriptTest.java tests/i18n/LocalizedDisplayScriptTest.java util/IjTestCase.java util/ScriptTestCase.java
Date Thu, 06 Jan 2011 18:36:16 GMT
Author: myrnavl
Date: Thu Jan  6 18:36:15 2011
New Revision: 1055998

URL: http://svn.apache.org/viewvc?rev=1055998&view=rev
Log:
DERBY-4713; Subclasses of ScriptTestCase can not run correctly with the non-English default
locale
  committing patch derby-4713-2.
  patch contributed by Yun Lee (yun dot lee dot bj at gmail dot com)

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.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/i18n/LocalizedAttributeScriptTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java?rev=1055998&r1=1055997&r2=1055998&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedAttributeScriptTest.java
Thu Jan  6 18:36:15 2011
@@ -179,6 +179,7 @@ public final class LocalizedAttributeScr
      * Set up the test environment.
      */
     protected void setUp() {
+        super.setUp();
         LocalizedResource.resetLocalizedResourceCache();
     }
 }
\ No newline at end of file

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java?rev=1055998&r1=1055997&r2=1055998&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/LocalizedDisplayScriptTest.java
Thu Jan  6 18:36:15 2011
@@ -120,6 +120,7 @@ public final class LocalizedDisplayScrip
      * Set up the test environment.
      */
     protected void setUp() {
+        super.setUp();
         // the canon contains time columns, which would display localized -
         // and so cause errors. Thus, run this with timezone PST.
         defaultTimeZone = TimeZone.getDefault(); 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java?rev=1055998&r1=1055997&r2=1055998&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/IjTestCase.java
Thu Jan  6 18:36:15 2011
@@ -54,7 +54,7 @@ public class IjTestCase extends ScriptTe
 		outfile = new File(outfileName);
 	}
 	
-	public void setUp() throws Exception{
+	public void setUp() {
 	    super.setUp();
 		setSystemProperty("ij.outfile", outfileName);
 		setSystemProperty("ij.defaultResourcePackage",

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=1055998&r1=1055997&r2=1055998&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
Thu Jan  6 18:36:15 2011
@@ -21,7 +21,9 @@ package org.apache.derbyTesting.function
 
 import java.io.InputStream;
 import java.net.URL;
+import java.security.AccessController;
 import java.sql.Connection;
+import java.util.Locale;
 
 import org.apache.derbyTesting.junit.Derby;
 
@@ -38,6 +40,7 @@ public abstract class ScriptTestCase ext
 	private final String inputEncoding;
 	private final String user;
     private boolean useSystemProperties = false;
+    private Locale oldLocale;
 
     /**
 	 * Create a ScriptTestCase to run a single test
@@ -197,4 +200,32 @@ public abstract class ScriptTestCase ext
         
         this.compareCanon(canon);
 	}
+    
+    /**
+     * Set up the new locale for the test
+     */
+    protected void setUp() {
+        oldLocale = Locale.getDefault();
+
+        AccessController.doPrivileged(new java.security.PrivilegedAction() {
+            public Object run() {
+                Locale.setDefault(Locale.US);
+                return null;
+            }
+        });
+    }
+
+    /**
+     * Revert the locale back to the old one
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+
+        AccessController.doPrivileged(new java.security.PrivilegedAction() {
+            public Object run() {
+                Locale.setDefault(oldLocale);
+                return null;
+            }
+        });
+    }
 }



Mime
View raw message