1 22 package org.jboss.test.txtimer.test; 23 24 import javax.naming.InitialContext ; 25 26 import org.jboss.test.JBossTestCase; 27 import org.jboss.test.txtimer.interfaces.TimerSession; 28 import org.jboss.test.txtimer.interfaces.TimerSessionHome; 29 import org.jboss.test.txtimer.support.SimpleInfo; 30 31 37 public class PersistentTimerTestCase extends JBossTestCase 38 { 39 public PersistentTimerTestCase(String name) 40 { 41 super(name); 42 } 43 44 48 public void testTimerRestoredForSessionBean() throws Exception 49 { 50 try 51 { 52 super.deploy("ejb-txtimer.jar"); 53 54 InitialContext iniCtx = getInitialContext(); 55 TimerSessionHome home = (TimerSessionHome)iniCtx.lookup(TimerSessionHome.JNDI_NAME); 56 TimerSession session = home.create(); 57 session.resetCallCount(); 58 59 session.createTimer(2000, 0, new SimpleInfo("NonScoped")); 61 62 assertEquals("unexpected call count", 0, session.getGlobalCallCount()); 64 65 super.undeploy("ejb-txtimer.jar"); 67 68 sleep(3000); 70 71 super.deploy("ejb-txtimer.jar"); 73 74 sleep(1000); 76 77 assertEquals("unexpected call count", 1, session.getGlobalCallCount()); 79 } 80 finally 81 { 82 super.undeploy("ejb-txtimer.jar"); 84 } 85 } 86 } 87 | Popular Tags |