Author: dwoods
Date: Thu Nov 4 18:10:00 2010
New Revision: 1031116
URL: http://svn.apache.org/viewvc?rev=1031116&view=rev
Log:
another attempt to fix the intermitent datacache test failures as the persist()
is taking 1.2 secs on some test machines
Modified:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java
Modified:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java?rev=1031116&r1=1031115&r2=1031116&view=diff
==============================================================================
---
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java
(original)
+++
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java
Thu Nov 4 18:10:00 2010
@@ -1071,13 +1071,13 @@ public abstract class CacheTest extends
diff = (currentTime.getTime() - startTime.getTime());
diff2 = (currentTime.getTime() - persistTime.getTime());
diff = Math.max(diff, diff2);
- if (sleep >= 0 && diff > 600 && diff < 900) {
+ if (diff > 600 && diff < 900) {
// only h should be dropped
checkCache(cache, ids, new boolean[]{ true, true, true, false
});
} else {
// need to skip the test on slow systems or when using remote
DB connections
- getLog().warn("CacheTest.timeoutsHelper() skipping
checkCache(h=500) because sleep="+sleep+
- " and final diff=" + diff + " and diff2=" + diff2);
+ getLog().warn("CacheTest.timeoutsHelper() skipping
checkCache(h=500) because diff=" + diff +
+ " and diff2=" + diff2);
}
// if this run has a default timeout (set to 1 sec in the test
@@ -1093,7 +1093,10 @@ public abstract class CacheTest extends
diff2 = (currentTime.getTime() - persistTime.getTime());
diff = Math.max(diff, diff2);
sleep = 2000 - diff;
- if (sleep > 10) {
+ if (sleep < 0) {
+ // we already missed the window
+ getLog().warn("CacheTest.timeoutsHelper() skipping sleep for
checkCache(f=000) because sleep="+sleep);
+ } else if (sleep > 10) {
getLog().info("CacheTest.timeoutsHelper() testing f to be
dropped by waiting sleep="+sleep);
Thread.currentThread().sleep(sleep);
Thread.yield();