Added a unit test for shutting down intervals when the omgr shuts down.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5885 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-07-21 00:29:56 +00:00
parent 9d93ea7a90
commit 5985d4086a
@@ -0,0 +1,42 @@
//
// $Id$
package com.threerings.presents.server;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Tests our handling of auto-canceling intervals created by the omgr if they expire after it has
* shutdown.
*/
public class OMgrIntervalTest extends PresentsTestBase
{
@Test public void testIntervals ()
{
final PresentsDObjectMgr omgr = getInstance(PresentsDObjectMgr.class);
omgr.newInterval(new Runnable () {
public void run () {
if (++_count > 1) {
omgr.harshShutdown();
}
}
}).schedule(100, true);
omgr.run();
try {
Thread.sleep(500);
} catch (Exception e) {
}
assertTrue(_count == 2);
}
protected int _count;
}