1 25 26 package org.objectweb.jonas.jtests.clients.distribution; 27 28 import javax.naming.NamingException ; 29 import javax.rmi.PortableRemoteObject ; 30 31 import junit.framework.Test; 32 import junit.framework.TestSuite; 33 34 import org.objectweb.jonas.jtests.beans.folder.Folder; 35 import org.objectweb.jonas.jtests.beans.folder.FolderHome; 36 import org.objectweb.jonas.jtests.util.JTestCase; 37 38 43 public class G_Frontal extends JTestCase { 44 45 protected static FolderHome fhome = null; 46 protected Folder folder = null; 47 48 public G_Frontal(String name) { 49 super(name); 50 } 51 52 protected void setUp() { 53 super.setUp(); 54 if (fhome == null) { 55 useBeans("folder", true); 56 try { 57 fhome = (FolderHome) PortableRemoteObject.narrow(ictx.lookup("FolderSYHome"), FolderHome.class); 58 assertNotNull(fhome); 59 } catch (NamingException e) { 60 fail("Cannot get bean home"); 61 } 62 } 63 if (folder == null) { 64 try { 65 folder = fhome.create(); 66 assertNotNull(folder); 67 } catch (Exception e) { 68 fail("Cannot create folder session " + e); 69 } 70 } 71 } 72 73 74 77 public void testSendRef() throws Exception { 78 for (int i = 0; i < 100; i++) { 79 folder.sendRef(folder); 80 } 81 } 82 83 86 public void testSendInt() throws Exception { 87 for (int i = 0; i < 100; i++) { 88 folder.sendInt(1); 89 } 90 } 91 92 95 public void testGetRef() throws Exception { 96 for (int i = 0; i < 100; i++) { 97 folder.getRef(folder); 98 } 99 } 100 101 104 public void testGetInt() throws Exception { 105 for (int i = 0; i < 100; i++) { 106 folder.getInt(1); 107 } 108 } 109 110 113 public void testSendRefTS() throws Exception { 114 for (int i = 0; i < 100; i++) { 115 folder.sendRefTS(folder); 116 } 117 } 118 119 122 public void testSendIntTS() throws Exception { 123 for (int i = 0; i < 100; i++) { 124 folder.sendIntTS(1); 125 } 126 } 127 128 131 public void testGetRefTS() throws Exception { 132 for (int i = 0; i < 100; i++) { 133 folder.getRefTS(folder); 134 } 135 } 136 137 140 public void testGetIntTS() throws Exception { 141 for (int i = 0; i < 100; i++) { 142 folder.getIntTS(1); 143 } 144 } 145 146 149 public void testGetArray() throws Exception { 150 for (int i = 0; i < 100; i++) { 151 long[] arr = folder.getArray(); 152 } 153 } 154 public void testSendArray() throws Exception { 155 for (int i = 0; i < 100; i++) { 156 long[] arr; 157 arr = new long[100]; 158 for (int j = 0; j < 100; j++) { 159 arr[j] = j; 160 } 161 folder.sendArray(arr); 162 163 } 164 } 165 public static Test suite() { 166 return new TestSuite(G_Frontal.class); 167 } 168 169 public static void main (String args[]) { 170 String testtorun = null; 171 for (int argn = 0; argn < args.length; argn++) { 173 String s_arg = args[argn]; 174 Integer i_arg; 175 if (s_arg.equals("-n")) { 176 testtorun = args[++argn]; 177 } 178 } 179 if (testtorun == null) { 180 junit.textui.TestRunner.run(suite()); 181 } else { 182 junit.textui.TestRunner.run(new G_Frontal(testtorun)); 183 } 184 } 185 } 186 | Popular Tags |