1 25 26 package org.objectweb.jonas.stests.manac; 27 28 import junit.framework.Test; 29 import junit.framework.TestSuite; 30 import javax.rmi.PortableRemoteObject ; 31 32 35 public class F_mono extends A_mono { 36 37 protected static ManagerHome home = null; 38 protected static Manager manager = null; 39 protected static boolean initialized = false; 40 41 public F_mono(String name) { 42 super(name); 43 } 44 45 protected void setUp() throws Exception { 46 super.setUp(); 47 if (home == null) { 48 useBeans("manac"); 49 home = (ManagerHome) PortableRemoteObject.narrow(ictx.lookup(getManagerHomeName()), 50 ManagerHome.class); 51 } 52 if (manager == null) { 53 manager = home.create(initialValue); 54 } 55 if (!initialized) { 56 System.out.println("creating "+accounts+" accounts"); 58 getManager().createAll(accounts); 59 initialized = true; 60 } 61 threadfail = false; 62 } 63 64 protected void tearDown() throws Exception { 65 super.tearDown(); 66 if (threadfail) { 67 initialized = false; 68 } 69 if (manager != null) { 70 manager.reinitAll(); 71 manager.remove(); 72 manager = null; 73 } 74 } 75 76 public Manager getManager(){ 77 return manager; 78 } 79 80 public String getManagerHomeName() { 81 return "manacManagerHome"; 82 } 83 84 public static Test suite() { 85 return new TestSuite(F_mono.class); 86 } 87 88 public static void main (String args[]) { 89 String testtorun = null; 90 for (int argn = 0; argn < args.length; argn++) { 92 String sarg = args[argn]; 93 if (sarg.equals("-n")) { 94 testtorun = args[++argn]; 95 } 96 } 97 if (testtorun == null) { 98 junit.textui.TestRunner.run(suite()); 99 } else { 100 junit.textui.TestRunner.run(new F_mono(testtorun)); 101 } 102 } 103 104 } 105 | Popular Tags |