1 25 26 package org.objectweb.jonas.jtests.clients.timer; 27 28 29 import javax.naming.NamingException ; 30 import javax.rmi.PortableRemoteObject ; 31 32 import junit.framework.Test; 33 import junit.framework.TestSuite; 34 35 import org.objectweb.jonas.jtests.beans.folder.Folder; 36 import org.objectweb.jonas.jtests.beans.folder.FolderHome; 37 import org.objectweb.jonas.jtests.util.JTestCase; 38 39 43 public class F_TimerFromSF extends JTestCase { 44 45 protected static FolderHome fhome = null; 46 protected Folder folder = null; 47 48 52 public F_TimerFromSF(String name) { 53 super(name); 54 } 55 56 61 protected void setUp() { 62 super.setUp(); 63 if (fhome == null) { 64 useBeans("folder", true); 65 try { 66 fhome = (FolderHome) PortableRemoteObject.narrow(ictx.lookup("FolderSYHome"), FolderHome.class); 67 assertNotNull(fhome); 68 } catch (NamingException e) { 69 fail("Cannot get bean home"); 70 } 71 } 72 if (folder == null) { 73 try { 74 folder = fhome.create(); 75 assertNotNull(folder); 76 } catch (Exception e) { 77 fail("Cannot create folder session " + e); 78 } 79 } 80 } 81 82 public void testAccessRemovedTimer() throws Exception { 83 boolean ok = folder.testTimerRemoved("timerfile"); 84 assertTrue("Timer Still Accessed after bean remove", ok); 85 } 86 87 public void testAccessCanceledTimer() throws Exception { 88 boolean ok = folder.testTimerCancel("timerfile2"); 89 assertTrue("Timer Still Accessed after cancel", ok); 90 } 91 92 public static Test suite() { 93 return new TestSuite(F_TimerFromSF.class); 94 } 95 96 public static void main (String args[]) { 97 String testtorun = null; 98 for (int argn = 0; argn < args.length; argn++) { 100 String sarg = args[argn]; 101 if (sarg.equals("-n")) { 102 testtorun = args[++argn]; 103 } 104 } 105 if (testtorun == null) { 106 junit.textui.TestRunner.run(suite()); 107 } else { 108 junit.textui.TestRunner.run(new F_TimerFromSF(testtorun)); 109 } 110 } 111 } 112 113 | Popular Tags |