1 25 26 package org.objectweb.jonas.jtests.clients.entity; 27 28 import javax.naming.NamingException ; 29 import javax.rmi.PortableRemoteObject ; 30 import junit.framework.Test; 31 import junit.framework.TestSuite; 32 import org.objectweb.jonas.jtests.beans.fbasic.SimpleHome; 33 import org.objectweb.jonas.jtests.beans.fbasic.Simple; 34 import org.objectweb.jonas.jtests.util.JTestCase; 35 import java.util.Enumeration ; 36 37 42 public class G_BasicHomeInterfaceEC2 extends B_BasicHomeInterfaceEC { 43 44 private static String BEAN_HOME = "fbasicSimpleEC2Home"; 45 46 public G_BasicHomeInterfaceEC2(String name) { 47 super(name); 48 } 49 50 public void testEmpty() throws Exception { 51 getHome(); 52 } 53 54 public SimpleHome getHome() { 55 if (home == null) { 56 try { 57 home = (SimpleHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), SimpleHome.class); 58 } catch (NamingException e) { 59 fail("Cannot get bean home"); 60 } 61 try { 63 home.findByPrimaryKey("pk1"); 64 } catch (Exception e) { 65 try { 67 home.create("pk1", 10, 4); 68 home.create("pk2", 10, 4); 69 home.create("pk3", 10, 4); 70 home.create("pk4", 40, 8); 71 home.create("pk5", 50, 8); 72 home.create("pk6", 60, 8); 73 home.create("pk7", 70, 8); 74 home.create("pk8", 45, 20); 75 home.create("pk9", 55, 30); 76 home.create("pk10",80, 80); 77 home.create("pk11",80, 80); 78 home.create("pk12",90, 90); 79 home.create("pk13",100, 90); 80 home.create("pk14",110, 90); 81 for (int i = 0; i < 1000; i++) { 83 home.create(Integer.toString(i), 0, 0); 84 } 85 86 } catch (Exception i) { 87 fail ("cannot create elements of table"); 88 } 89 } 90 } 91 return home; 92 } 93 94 97 public static Test suite() { 98 return new TestSuite(G_BasicHomeInterfaceEC2.class); 99 } 100 101 public static void main (String args[]) throws Exception { 102 103 String testtorun = null; 104 for (int argn = 0; argn < args.length; argn++) { 106 String s_arg = args[argn]; 107 Integer i_arg; 108 if (s_arg.equals("-n")) { 109 testtorun = args[++argn]; 110 } 111 } 112 if (testtorun == null) { 113 junit.textui.TestRunner.run(suite()); 114 } else { 115 116 junit.textui.TestRunner.run(new G_BasicHomeInterfaceEC2(testtorun)); 117 118 } 119 } 120 } 121 | Popular Tags |