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 ma...@apache.org on 2012/09/17 17:56:07 UTC
svn commit: r1386677 - in /db/derby/code/branches/10.8: ./
java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
Author: mamta
Date: Mon Sep 17 15:56:06 2012
New Revision: 1386677
URL: http://svn.apache.org/viewvc?rev=1386677&view=rev
Log:
DERBY-5663(Getting NPE when trying to set derby.language.logStatementText property to true inside a junit suite.)
Backporting to 10,8
Modified:
db/derby/code/branches/10.8/ (props changed)
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1309244
Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java?rev=1386677&r1=1386676&r2=1386677&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/largedata/LobLimitsTest.java Mon Sep 17 15:56:06 2012
@@ -36,6 +36,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Properties;
import junit.framework.Test;
@@ -45,6 +46,7 @@ import org.apache.derbyTesting.junit.Sup
import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.derbyTesting.functionTests.util.PrivilegedFileOpsForTests;
import org.apache.derbyTesting.junit.JDBC;
+import org.apache.derbyTesting.junit.SystemPropertyTestSetup;
/**
* This test is part of the "largedata" suite because this test tests data for
@@ -132,6 +134,11 @@ public class LobLimitsTest extends BaseJ
* @return a test suite
*/
static Test baseSuite(final int biggestSize, final int bigSize) {
+ //Run the suite with following properties in case we run into lock
+ // time out issues. It will help debug the problem if timeouts occur.
+ Properties sysprops = new Properties();
+ sysprops.setProperty("derby.locks.deadlockTrace", "true");
+ sysprops.setProperty("derby.locks.monitor", "true");
// Some of the test cases depend on certain other test cases to run
// first, so force the test cases to run in lexicographical order.
Test suite = new CleanDatabaseTestSetup(
@@ -141,6 +148,7 @@ public class LobLimitsTest extends BaseJ
setupTables(s, biggestSize, bigSize);
}
};
+ suite = new SystemPropertyTestSetup(suite,sysprops);
return new SupportFilesSetup(suite);
}
Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java?rev=1386677&r1=1386676&r2=1386677&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java (original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/junit/SystemPropertyTestSetup.java Mon Sep 17 15:56:06 2012
@@ -51,7 +51,6 @@ public class SystemPropertyTestSetup ext
{
super(test);
this.newValues = newValues;
- this.oldValues = new Properties();
this.staticProperties = staticProperties;
}
@@ -67,7 +66,6 @@ public class SystemPropertyTestSetup ext
{
super(test);
this.newValues = newValues;
- this.oldValues = new Properties();
this.staticProperties = false;
}
/**
@@ -77,6 +75,15 @@ public class SystemPropertyTestSetup ext
protected void setUp()
throws java.lang.Exception
{
+ //DERBY-5663 Getting NPE when trying to set
+ // derby.language.logStatementText property to true inside a junit
+ // suite.
+ //The same instance of SystemPropertyTestSetup can be used again
+ // and hence we want to make sure that oldValues is not null as set
+ // in the tearDown() method. If we leave it null, we will run into NPE
+ // during the tearDown of SystemPropertyTestSetup during the
+ // decorator's reuse.
+ this.oldValues = new Properties();
setProperties(newValues);
// shutdown engine so static properties take effect
if (staticProperties)
@@ -102,7 +109,6 @@ public class SystemPropertyTestSetup ext
// shutdown engine to restore any static properties
if (staticProperties)
TestConfiguration.getCurrent().shutdownEngine();
- newValues = null;
oldValues = null;
}