KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > SchedulerModuleTest


1 /*
2  * Created on Oct 18, 2004
3  */

4 package com.openedit.modules;
5
6 import com.openedit.BaseTestCase;
7 import com.openedit.modules.scheduler.Action;
8 import com.openedit.modules.scheduler.SchedulerModule;
9 import com.openedit.modules.scheduler.TestModule;
10
11 /**
12  * @author Matthew Avery, mavery@einnovation.com
13  */

14 public class SchedulerModuleTest extends BaseTestCase
15 {
16
17     public SchedulerModuleTest( String JavaDoc arg0 )
18     {
19         super( arg0 );
20         String JavaDoc base = System.getProperty("basedir");
21         if ( base == null)
22         {
23             System.setProperty("basedir","resources/test");
24         }
25     }
26     
27     public void testScheduler() throws Exception JavaDoc
28     {
29         SchedulerModule scheduler = (SchedulerModule) getModule( "Scheduler" );
30         assertNotNull( scheduler );
31         scheduler.startTask( new Action("/testmod.html", 0,1000) );
32         
33         TestModule testModule = ( TestModule ) getModule( "TestModule" );
34         assertNotNull( testModule );
35         Thread.sleep( 1400 );
36         assertTrue( testModule.getCount() > 0 );
37     }
38     /* (non-Javadoc)
39      * @see junit.framework.TestCase#tearDown()
40      */

41     protected void tearDown() throws Exception JavaDoc {
42         // TODO Auto-generated method stub
43
super.tearDown();
44         
45         SchedulerModule scheduler = (SchedulerModule) getModule( "Scheduler" );
46         scheduler.shutdown();
47     }
48 }
49
Popular Tags