1 25 26 package org.objectweb.jonas.jtests.clients.timer; 27 28 29 import org.objectweb.jonas.jtests.beans.transacted.Simple; 30 31 35 public abstract class A_TimerSession extends A_Timer { 36 37 41 public A_TimerSession(String name) { 42 super(name); 43 } 44 45 48 public void testTimer2() throws Exception { 49 int duration = 4; 50 int intervalduration = 3; 51 Simple s = getSimple(10); 52 int expected = s.getTimerCount(); 53 int id = s.setTimer(duration, intervalduration); 54 try { 55 assertEquals("timer expired too quickly", expected, s.getTimerCount()); 56 sleep(1000 * duration + 1500); 57 expected++; 58 assertEquals("timer did not expire first", expected, s.getTimerCount()); 59 for (int i = 0; i < 3; i++) { 60 sleep(1000 * intervalduration); 61 expected++; 62 assertEquals("timer did not expired at " + i, expected, s.getTimerCount()); 63 } 64 } finally { 65 s.cancelTimer(id); s.remove(); 67 } 68 } 69 70 } 71 | Popular Tags |