You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by bp...@apache.org on 2011/07/29 22:54:52 UTC

svn commit: r1152371 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/util/ScriptTestCase.java junit/SystemPropertyTestSetup.java

Author: bpendleton
Date: Fri Jul 29 20:54:51 2011
New Revision: 1152371

URL: http://svn.apache.org/viewvc?rev=1152371&view=rev
Log:
DERBY-5342: make ScriptTestCase support ij properties.

This patch was contributed by Houx Zhang (houxzhang at gmail dot com)

This patch fixes a bug in SystemPropertyTestSetup. In
SystemPropertyTestSetup.setUp() setProperties() is called, but a property
won't be added into oldValues if the old value equals the new one, yet then
the property will be removed in tearDown() later. 

The patch revises the behavior so that the property is not removed in this
case.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/ScriptTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java

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=1152371&r1=1152370&r2=1152371&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 Fri Jul 29 20:54:51 2011
@@ -96,7 +96,8 @@ public abstract class ScriptTestCase ext
             String inputEnc, String outputEnc, String user)
     {
         super(script, outputEnc);
-
+        setSystemProperty("ij.showNoConnectionsAtStart", "true");
+        setSystemProperty("ij.showNoCountForSelect", "true");
         inputEncoding = (inputEnc == null) ? DEFAULT_ENCODING : inputEnc;
 
 		this.user = user;
@@ -207,8 +208,6 @@ public abstract class ScriptTestCase ext
      * Set up the new locale for the test
      */
     protected void setUp() {
-        BaseTestCase.setSystemProperty("ij.showNoConnectionsAtStart", "true");
-        BaseTestCase.setSystemProperty("ij.showNoCountForSelect", "true");
         oldLocale = Locale.getDefault();
 
         AccessController.doPrivileged(new java.security.PrivilegedAction() {

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java?rev=1152371&r1=1152370&r2=1152371&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java Fri Jul 29 20:54:51 2011
@@ -121,9 +121,8 @@ public class SystemPropertyTestSetup ext
                 // set, might need to be changed.
                 change = !old.equals(value);
                 
-                // If we are not processing the oldValues
-                // then store in the oldValues. Reference equality is ok here.
-    			if (change && (values != oldValues))
+                //Reference equality is ok here.
+    			if (values != oldValues)
     			   oldValues.setProperty(key, old);
     		}
     		else {