From 739a13dc2b471bcf523bb889d8cbdbe75b05d613 Mon Sep 17 00:00:00 2001 From: "Timothy A. Bish" Date: Mon, 23 Apr 2012 13:50:40 +0000 Subject: [PATCH] Make the test more deterministic to fix test errors on slower machines. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1329240 13f79535-47bb-0310-9956-ffa450edef68 --- .../broker/scheduler/JobSchedulerTest.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java index 5051d83668..8d936af16a 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerTest.java @@ -18,11 +18,13 @@ package org.apache.activemq.broker.scheduler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + import java.io.File; import java.util.Calendar; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; + import org.apache.activemq.util.IOHelper; import org.apache.kahadb.util.ByteSequence; import org.junit.After; @@ -129,17 +131,17 @@ public class JobSchedulerTest { public void testRemoveLong() throws Exception { final int COUNT = 10; - long time = 20000; + long time = 60000; for (int i = 0; i < COUNT; i++) { String str = new String("test" + i); scheduler.schedule("id" + i, new ByteSequence(str.getBytes()), "", time, 1000, -1); } - int size = scheduler.getNextScheduleJobs().size(); + int size = scheduler.getAllJobs().size(); assertEquals(size, COUNT); long removeTime = scheduler.getNextScheduleTime(); scheduler.remove(removeTime); - size = scheduler.getNextScheduleJobs().size(); + size = scheduler.getAllJobs().size(); assertEquals(0, size); } @@ -150,16 +152,16 @@ public class JobSchedulerTest { long time = 20000; for (int i = 0; i < COUNT; i++) { String str = new String("test" + i); - scheduler.schedule("id" + i, new ByteSequence(str.getBytes()), "", time, 10, -1); + scheduler.schedule("id" + i, new ByteSequence(str.getBytes()), "", time, 1000, -1); if (i == COUNT / 2) { - scheduler.schedule(test, new ByteSequence(test.getBytes()), "", time, 10, -1); + scheduler.schedule(test, new ByteSequence(test.getBytes()), "", time, 1000, -1); } } - int size = scheduler.getNextScheduleJobs().size(); + int size = scheduler.getAllJobs().size(); assertEquals(size, COUNT + 1); scheduler.remove(test); - size = scheduler.getNextScheduleJobs().size(); + size = scheduler.getAllJobs().size(); assertEquals(size, COUNT); }