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