Hi,
please find the patch for JIRA JDO-59 attached.
As I pointed out in my previous mail, this patch fixes the
synchronization bug in the 4 tests. However, Derby might throw a
SQLException on some of those tests. The reason is a lock wait timeout
which happens after 60 seconds by default if a lock can not be granted.
I encountered this problem only with datastore identity.
Regards,
Michael
--
-------------------------------------------------------------------
Michael Watzek [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------
Index: test/conf/exclude.list
===================================================================
--- test/conf/exclude.list (revision 190413)
+++ test/conf/exclude.list (working copy)
@@ -1,8 +1,3 @@
jdo.tck.exclude = \
org.apache.jdo.tck.enhancement.FieldAccessModified \
-org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable \
-org.apache.jdo.tck.lifecycle.PMsCanSharePCClassesButNotPCInstances \
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllNoParameterSideEffects
\
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithArraySideEffects
\
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithCollectionSideEffects
\
-org.apache.jdo.tck.api.persistencemanager.cache.RefreshSideEffects
+org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable
Index: test/conf/alltests.list
===================================================================
--- test/conf/alltests.list (revision 190413)
+++ test/conf/alltests.list (working copy)
@@ -125,6 +125,10 @@
org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToEvictHasNoEffect \
org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToRefreshAllThrowsException
\
org.apache.jdo.tck.api.persistencemanager.cache.PassingNullToRefreshHasNoEffect
\
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllNoParameterSideEffects
\
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithArraySideEffects
\
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshAllWithCollectionSideEffects
\
+org.apache.jdo.tck.api.persistencemanager.cache.RefreshSideEffects \
org.apache.jdo.tck.api.persistencemanager.cache.Retrieve \
org.apache.jdo.tck.api.persistencemanager.SameTransactionInstanceForAllCallsToCurrentTransaction
\
org.apache.jdo.tck.api.persistencemanager.flags.SetIgnoreCacheToFalse \
Index:
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
(revision 190413)
+++
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshSideEffects.java
(working copy)
@@ -16,10 +16,13 @@
package org.apache.jdo.tck.api.persistencemanager.cache;
+import javax.jdo.JDOFatalException;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
+import junit.framework.AssertionFailedError;
+
import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.util.BatchTestRunner;
@@ -84,9 +87,9 @@
ThreadExceptionHandler group = new ThreadExceptionHandler();
RefreshThreadT1 thread1 = new RefreshThreadT1(pm1);
- Thread T1 = new Thread(group, thread1);
+ Thread T1 = new Thread(group, thread1, "T1");
RefreshThreadT2 thread2 = new RefreshThreadT2(pm2);
- Thread T2 = new Thread(group, thread2);
+ Thread T2 = new Thread(group, thread2, "T2");
thread1.setOther(thread2);
thread2.setOther(thread1);
@@ -98,21 +101,17 @@
Throwable t1Problem = group.getUncaughtException(T1);
if (t1Problem != null) {
- if (debug) {
- logger.debug("RefreshAllNoParameterSideEffects ThreadT1
results in uncaught exception");
- t1Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT1 results in exception " + t1Problem);
+ if (t1Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t1Problem;
+ else
+ throw new JDOFatalException( "Thread "+T1.getName()+" results
in exception ", t1Problem );
}
Throwable t2Problem = group.getUncaughtException(T2);
if (t2Problem != null) {
- if (debug) {
- logger.debug("RefreshAllNoParameterSideEffects ThreadT2
results in uncaught exception");
- t2Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT2 results in exception " + t2Problem);
+ if (t2Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t2Problem;
+ else
+ throw new JDOFatalException( "Thread "+T2.getName()+" results
in exception ", t2Problem );
}
if (debug) logger.debug ("END RefreshSideEffects");
@@ -171,6 +170,7 @@
" ThreadT1: commit finished.");
}
finally {
+ commitDone = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
@@ -230,6 +230,7 @@
" ThreadT2: commit finished.");
}
finally {
+ done = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
Index:
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
(revision 190413)
+++
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithCollectionSideEffects.java
(working copy)
@@ -19,10 +19,13 @@
import java.util.Collection;
import java.util.HashSet;
+import javax.jdo.JDOFatalException;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
+import junit.framework.AssertionFailedError;
+
import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.util.BatchTestRunner;
@@ -88,9 +91,9 @@
ThreadExceptionHandler group = new ThreadExceptionHandler();
RefreshColThreadT1 thread1 = new RefreshColThreadT1(pm1);
- Thread T1 = new Thread(group, thread1);
+ Thread T1 = new Thread(group, thread1, "T1");
RefreshColThreadT2 thread2 = new RefreshColThreadT2(pm2);
- Thread T2 = new Thread(group, thread2);
+ Thread T2 = new Thread(group, thread2, "T2");
thread1.setOther(thread2);
thread2.setOther(thread1);
@@ -102,21 +105,17 @@
Throwable t1Problem = group.getUncaughtException(T1);
if (t1Problem != null) {
- if (debug) {
- logger.debug("RefreshAllWithCollectionSideEffects ThreadT1
results in uncaught exception");
- t1Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT1 results in exception " + t1Problem);
+ if (t1Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t1Problem;
+ else
+ throw new JDOFatalException( "Thread "+T1.getName()+" results
in exception ", t1Problem );
}
Throwable t2Problem = group.getUncaughtException(T2);
if (t2Problem != null) {
- if (debug) {
- logger.debug("RefreshAllWithCollectionSideEffects ThreadT2
results in uncaught exception");
- t2Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT2 results in exception " + t2Problem);
+ if (t2Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t2Problem;
+ else
+ throw new JDOFatalException( "Thread "+T2.getName()+" results
in exception ", t2Problem );
}
if (debug) logger.debug("END RefreshAllWithCollectionSideEffects");
@@ -181,6 +180,7 @@
" ThreadT1: commit finished.");
}
finally {
+ commitDone = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
@@ -245,6 +245,7 @@
" ThreadT2: commit finished.");
}
finally {
+ done = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
Index:
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
(revision 190413)
+++
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllWithArraySideEffects.java
(working copy)
@@ -19,10 +19,13 @@
import java.util.Collection;
import java.util.HashSet;
+import javax.jdo.JDOFatalException;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
+import junit.framework.AssertionFailedError;
+
import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.util.BatchTestRunner;
@@ -88,9 +91,9 @@
ThreadExceptionHandler group = new ThreadExceptionHandler();
RefreshArrThreadT1 thread1 = new RefreshArrThreadT1(pm1);
- Thread T1 = new Thread(group, thread1);
+ Thread T1 = new Thread(group, thread1, "T1");
RefreshArrThreadT2 thread2 = new RefreshArrThreadT2(pm2);
- Thread T2 = new Thread(group, thread2);
+ Thread T2 = new Thread(group, thread2, "T2");
thread1.setOther(thread2);
thread2.setOther(thread1);
@@ -102,21 +105,17 @@
Throwable t1Problem = group.getUncaughtException(T1);
if (t1Problem != null) {
- if (debug) {
- logger.debug("RefreshAllWithArraySideEffects ThreadT1 results
in uncaught exception");
- t1Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT1 results in exception " + t1Problem);
+ if (t1Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t1Problem;
+ else
+ throw new JDOFatalException( "Thread "+T1.getName()+" results
in exception ", t1Problem );
}
Throwable t2Problem = group.getUncaughtException(T2);
if (t2Problem != null) {
- if (debug) {
- logger.debug("RefreshAllWithArraySideEffects ThreadT2 results
in uncaught exception");
- t2Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT2 results in exception " + t2Problem);
+ if (t2Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t2Problem;
+ else
+ throw new JDOFatalException( "Thread "+T2.getName()+" results
in exception ", t2Problem );
}
if (debug) logger.debug ("END RefreshAllWithArraySideEffects");
@@ -155,11 +154,11 @@
tx.begin();
n1.setX(500);
n2.setX(501);
-
+
Collection col1 = new HashSet();
col1.add(n1);
col1.add(n2);
-
+
pm.makePersistentAll(col1);
pm.refreshAll(col1.toArray());
RefreshAllWithArraySideEffects.this.logger.debug(
@@ -181,6 +180,7 @@
" ThreadT1: commit finished.");
}
finally {
+ commitDone = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
@@ -222,16 +222,18 @@
tx.begin();
p1.setX(200);
p2.setX(201);
-
+
Collection col1 = new HashSet();
col1.add(p1);
col1.add(p2);
+
pm.makePersistentAll(col1);
pm.refreshAll(col1.toArray());
done = true;
-
+
RefreshAllWithArraySideEffects.this.logger.debug(
" ThreadT2: waiting for commit of ThreadT1");
+
while (!other.isCommitDone()) {
try {
Thread.sleep(DELAY);
@@ -246,6 +248,7 @@
" ThreadT2: commit finished.");
}
finally {
+ done = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
Index:
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
(revision 190413)
+++
test/java/org/apache/jdo/tck/api/persistencemanager/cache/RefreshAllNoParameterSideEffects.java
(working copy)
@@ -19,10 +19,13 @@
import java.util.Collection;
import java.util.HashSet;
+import javax.jdo.JDOFatalException;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Transaction;
+import junit.framework.AssertionFailedError;
+
import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.util.BatchTestRunner;
@@ -93,9 +96,9 @@
ThreadExceptionHandler group = new ThreadExceptionHandler();
ThreadT1 thread1 = new ThreadT1(pm1);
- Thread T1 = new Thread(group, thread1);
+ Thread T1 = new Thread(group, thread1, "T1");
ThreadT2 thread2 = new ThreadT2(pm2);
- Thread T2 = new Thread(group, thread2);
+ Thread T2 = new Thread(group, thread2, "T2");
thread1.setOther(thread2);
thread2.setOther(thread1);
@@ -107,21 +110,17 @@
Throwable t1Problem = group.getUncaughtException(T1);
if (t1Problem != null) {
- if (debug) {
- logger.debug("RefreshAllNoParameterSideEffects ThreadT1
results in uncaught exception");
- t1Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT1 results in exception " + t1Problem);
+ if (t1Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t1Problem;
+ else
+ throw new JDOFatalException( "Thread "+T1.getName()+" results
in exception ", t1Problem );
}
Throwable t2Problem = group.getUncaughtException(T2);
if (t2Problem != null) {
- if (debug) {
- logger.debug("RefreshAllNoParameterSideEffects ThreadT2
results in uncaught exception");
- t2Problem.printStackTrace();
- }
- fail(ASSERTION_FAILED,
- "ThreadT2 results in exception " + t2Problem);
+ if (t2Problem instanceof AssertionFailedError)
+ throw (AssertionFailedError)t2Problem;
+ else
+ throw new JDOFatalException( "Thread "+T2.getName()+" results
in exception ", t2Problem );
}
if (debug) logger.debug ("END RefreshAllNoParameterSideEffects");
@@ -187,6 +186,7 @@
" ThreadT1: commit finished.");
}
finally {
+ commitDone = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}
@@ -232,6 +232,7 @@
Collection col1 = new HashSet();
col1.add(p1);
col1.add(p2);
+
pm.makePersistentAll(col1);
pm.refreshAll();
done = true;
@@ -253,6 +254,7 @@
" ThreadT2: commit finished.");
}
finally {
+ done = true;
if ((tx != null) && tx.isActive())
tx.rollback();
}