You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/06/26 11:03:58 UTC

git commit: WICKET-4619 Windows JRE6 StoredResponsesMapTest#getExpiredValue() falures

Updated Branches:
  refs/heads/master 8e66613d3 -> 54410799a


WICKET-4619 Windows JRE6 StoredResponsesMapTest#getExpiredValue() falures

Sleep for a duration that is twice longer than StoredResponsesMap's timeout duration.


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/54410799
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/54410799
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/54410799

Branch: refs/heads/master
Commit: 54410799a7ddd41cf86fbb33f41be318ffc95ba1
Parents: 8e66613
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Jun 26 12:03:01 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Jun 26 12:03:01 2012 +0300

----------------------------------------------------------------------
 .../protocol/http/StoredResponsesMapTest.java      |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/54410799/wicket-core/src/test/java/org/apache/wicket/protocol/http/StoredResponsesMapTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/protocol/http/StoredResponsesMapTest.java b/wicket-core/src/test/java/org/apache/wicket/protocol/http/StoredResponsesMapTest.java
index 6f1f772..d28bbd9 100644
--- a/wicket-core/src/test/java/org/apache/wicket/protocol/http/StoredResponsesMapTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/protocol/http/StoredResponsesMapTest.java
@@ -24,8 +24,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.wicket.util.SlowTests;
 import org.apache.wicket.util.time.Duration;
+import org.apache.wicket.util.time.Time;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -62,13 +62,15 @@ public class StoredResponsesMapTest extends Assert
 	@Test
 	public void getExpiredValue() throws Exception
 	{
-		StoredResponsesMap map = new StoredResponsesMap(1000, Duration.milliseconds(50));
+		Time start = Time.now();
+		Duration timeout = Duration.milliseconds(50);
+		StoredResponsesMap map = new StoredResponsesMap(1000, timeout);
 		assertEquals(0, map.size());
 		map.put("1", new BufferedWebResponse(null));
 		assertEquals(1, map.size());
-		TimeUnit.MILLISECONDS.sleep(51);
+		TimeUnit.MILLISECONDS.sleep(timeout.getMilliseconds() * 2); // sleep for twice longer than the timeout
+		assertTrue("The timeout has passed.", Time.now().subtract(start).compareTo(timeout) == 1);
 		Object value = map.get("1");
-		// TODO This test sometimes fails on XP and java 1.6 (not reproduceable)
 		assertNull(value);
 	}