1 25 26 package org.objectweb.jonas.stests.manac; 27 28 import javax.rmi.PortableRemoteObject ; 29 import org.objectweb.jonas.stests.util.JTestCase; 30 31 34 public abstract class A_remove extends JTestCase { 35 36 static final int initialValue = 1000; 37 protected static ManagerHome home = null; 38 protected static Manager manager = null; 39 40 int accounts = 100; 41 int loops = 1; 42 int threads = 1; 43 44 public static boolean threadfail; 45 46 public A_remove(String name) { 47 super(name); 48 } 49 50 public abstract String getManagerHomeName(); 51 52 protected void setUp() throws Exception { 53 super.setUp(); 54 if (home == null) { 55 useBeans("manac"); 56 home = (ManagerHome) PortableRemoteObject.narrow(ictx.lookup(getManagerHomeName()), 57 ManagerHome.class); 58 } 59 if (manager == null) { 60 manager = home.create(initialValue); 61 } 62 threadfail = false; 63 } 64 65 protected void tearDown() throws Exception { 66 super.tearDown(); 67 } 68 69 72 public void remac(int accounts, int loops, int threads) throws Exception { 73 74 A_remthread[] t_thr = new A_remthread[threads]; 76 for (int i = 0; i < threads; i++) { 77 t_thr[i] = new A_remthread(getManagerHomeName(), i, ictx, accounts, loops); 78 t_thr[i].start(); 79 } 80 81 for (int p = 0; p < threads; p++) { 83 t_thr[p].join(); 84 } 85 86 if (threadfail) { 88 fail("Error in a thread"); 89 } 90 } 91 92 public void testBasic() throws Exception { 93 remac(accounts, loops, threads); 94 } 95 96 public void testConc() throws Exception { 97 int accounts = 10; 98 int threads = 12; 99 int loops = 4; 100 remac(accounts, loops, threads); 101 } 102 103 public void testL100() throws Exception { 104 int loops = 100; 105 remac(accounts, loops, threads); 106 } 107 108 public void testL50T2() throws Exception { 109 int loops = 50; 110 int threads = 2; 111 remac(accounts, loops, threads); 112 } 113 114 public void testL20T5() throws Exception { 115 int loops = 20; 116 int threads = 5; 117 remac(accounts, loops, threads); 118 } 119 120 public void testL10T8() throws Exception { 121 int accounts = 1000; 122 int loops = 10; 123 int threads = 8; 124 remac(accounts, loops, threads); 125 } 126 127 } 128 | Popular Tags |