package bitronix.tm.timer;

import bitronix.tm.recovery.Recoverer;
import junit.framework.TestCase;

import java.util.Date;


public class TaskSchedulerTest extends TestCase {
    
    public void testRecoveryTask() throws Exception {
        TaskScheduler ts = new TaskScheduler();
        ts.start();

        Recoverer recoverer = new Recoverer();
        ts.scheduleRecovery(recoverer, new Date());
        assertEquals(1, ts.countTasksQueued());
        Thread.sleep(1000);
        assertEquals(1, ts.countTasksQueued());

        ts.cancelRecovery(recoverer);
        assertEquals(0, ts.countTasksQueued());
        Thread.sleep(1000);
        assertEquals(0, ts.countTasksQueued());

        ts.setActive(false);
        ts.join();
    }

}

@@ -475,33 +475,33 @@
   Thread.sleep(1
-0
+1
 00);%0D%0A        as
@@ -651,17 +651,17 @@
 .sleep(1
-0
+1
 00);%0D%0A  

test was sometimes failing due to wait times being too short