From 33c8d872b456b9633ca3c2b3529fddbaf91fc31e Mon Sep 17 00:00:00 2001 From: Donald Woods Date: Thu, 4 Nov 2010 18:10:00 +0000 Subject: [PATCH] another attempt to fix the intermitent datacache test failures as the persist() is taking 1.2 secs on some test machines git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1031116 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/persistence/datacache/CacheTest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java index 34d1686e2..92152309c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/CacheTest.java @@ -1071,13 +1071,13 @@ public abstract class CacheTest extends AbstractTestCase { 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 AbstractTestCase { 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();