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 dj...@apache.org on 2006/10/27 02:31:26 UTC
svn commit: r468209 - in
/db/derby/code/trunk/java/testing/org/apache/derbyTesting:
functionTests/tests/jdbcapi/BlobClob4BlobTest.java
junit/DatabasePropertyTestSetup.java
Author: djd
Date: Thu Oct 26 17:31:25 2006
New Revision: 468209
URL: http://svn.apache.org/viewvc?view=rev&rev=468209
Log:
DERBY-2003 Add a utility method to allow setting the lock timeouts as a decorator building off DatabasePropertyTestSetup.
Use this decorator in BlobClob4Blob to reduce the wait time.
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java?view=diff&rev=468209&r1=468208&r2=468209
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java Thu Oct 26 17:31:25 2006
@@ -32,6 +32,8 @@
import org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader;
import org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetStream;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
+import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
+import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
import junit.framework.*;
import java.sql.*;
@@ -2758,7 +2760,8 @@
suite.addTest(TestConfiguration.clientServerDecorator(
derbynetExclude("BlobClob4BlobTest:client")));
- return suite;
+ return new CleanDatabaseTestSetup(
+ DatabasePropertyTestSetup.setLockTimeouts(suite, 2, 4));
}
private static Test derbynetExclude(String name) {
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java?view=diff&rev=468209&r1=468208&r2=468209
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/DatabasePropertyTestSetup.java Thu Oct 26 17:31:25 2006
@@ -40,6 +40,38 @@
private Properties newValues;
private Properties oldValues;
+
+ /**
+ * Decorator to change the lock time outs.
+ * If either time is less than zero then that property is
+ * not modified by this decorator.
+ * The change is implemented by an instanceof DatabasePropertyTestSetup
+ * and thus is reset by the tearDown method.
+ *
+ * @param test Test to decorate
+ * @param deadlockTime Time in seconds for derby.locks.deadlockTimeout.
+ * @param waitTime Time in seconds for derby.locks.waitTimeout
+ * @return
+ */
+ public static Test setLockTimeouts(Test test, int deadlockTime, int waitTime)
+ {
+ final Properties properties = new Properties();
+ if (deadlockTime >= 0)
+ {
+ properties.setProperty("derby.locks.deadlockTimeout",
+ Integer.toString(deadlockTime));
+ }
+ if (waitTime >= 0) {
+ properties.setProperty("derby.locks.waitTimeout",
+ Integer.toString(waitTime));
+ }
+
+ // No change, no point to the decorator.
+ if (properties.isEmpty())
+ return test;
+
+ return new DatabasePropertyTestSetup(test, properties);
+ }
/**
* Create a test decorator that sets and restores the passed