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_read 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_read(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 manager.createAll(20); 64 threadfail = false; 65 } 66 67 protected void tearDown() throws Exception { 68 super.tearDown(); 69 } 70 71 74 public void readac(int accounts, int loops, int threads) throws Exception { 75 76 A_readthread[] t_thr = new A_readthread[threads]; 78 for (int i = 0; i < threads; i++) { 79 t_thr[i] = new A_readthread(getManagerHomeName(), i, ictx, accounts, loops); 80 t_thr[i].start(); 81 } 82 83 for (int p = 0; p < threads; p++) { 85 t_thr[p].join(); 86 } 87 88 if (threadfail) { 90 fail("Error in a thread"); 91 } 92 } 93 94 public void testBasic() throws Exception { 95 readac(accounts, loops, threads); 96 } 97 98 public void testConc() throws Exception { 99 int accounts = 10; 100 int threads = 12; 101 int loops = 4; 102 readac(accounts, loops, threads); 103 } 104 105 public void testConcL() throws Exception { 106 int accounts = 5; 107 int threads = 12; 108 int loops = 50; 109 readac(accounts, loops, threads); 110 } 111 112 public void testL100() throws Exception { 113 int loops = 100; 114 readac(accounts, loops, threads); 115 } 116 117 public void testL50T2() throws Exception { 118 int loops = 50; 119 int threads = 2; 120 readac(accounts, loops, threads); 121 } 122 123 public void testL20T5() throws Exception { 124 int loops = 20; 125 int threads = 5; 126 readac(accounts, loops, threads); 127 } 128 129 public void testL10T8() throws Exception { 130 int accounts = 1000; 131 int loops = 10; 132 int threads = 8; 133 readac(accounts, loops, threads); 134 } 135 136 } 137 | Popular Tags |