KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > state > ModuleTest


1 package org.sapia.soto.state;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.soto.SotoContainer;
6 import org.sapia.soto.state.ContextImpl;
7 import org.sapia.soto.state.StateMachineService;
8
9 import java.io.File JavaDoc;
10
11
12 /**
13  * @author Yanick Duchesne
14  *
15  * <dl>
16  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
17  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
18  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
19  * </dl>
20  */

21 public class ModuleTest extends TestCase {
22   public ModuleTest(String JavaDoc name) {
23     super(name);
24   }
25
26   public void testReload() throws Exception JavaDoc {
27     SotoContainer cont = new SotoContainer();
28     File JavaDoc conf;
29     File JavaDoc included;
30     included = new File JavaDoc("etc/stm/included.xml");
31     included.setLastModified(System.currentTimeMillis());
32     System.setProperty("soto.debug", "true");
33     cont.load(conf = new File JavaDoc("etc/stm/config.xml"));
34
35     StateMachineService svc = (StateMachineService) cont.lookup("stateService");
36     svc.execute("test", "test", new ContextImpl());
37
38     /* InputStream is;
39         String config = Utils.textStreamToString(is = new FileInputStream(f));
40         is.close();
41         PrintStream ps = new PrintStream(new FileOutputStream(f));
42         ps.println(config);
43         ps.flush();
44         ps.close();*/

45     included.setLastModified(1);
46     Thread.sleep(500);
47     svc.execute("test", "test", new ContextImpl());
48   }
49 }
50
Popular Tags