1 25 26 package org.objectweb.jonas.jtests.clients.entity; 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.annuaire.PersonneHome; 35 36 42 public class F_AdvancedHomeEC2 extends A_AdvancedHomeEC { 43 44 private static String BEAN_HOME = "annuairePersonneEC2Home"; 45 private static PersonneHome ehome = null; 46 47 public F_AdvancedHomeEC2(String name) { 48 super(name); 49 } 50 51 protected static boolean isInit = false; 52 53 protected void setUp() { 54 super.setUp(); 55 if (!isInit) { 56 useBeans("annuaire", false); 57 getHome(); 58 isInit = true; 59 } 60 } 61 62 public PersonneHome getHome() { 63 if (ehome == null) { 64 try { 65 ehome = (PersonneHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), PersonneHome.class); 66 } catch (NamingException e) { 67 fail("Cannot get bean home"); 68 } 69 try { 71 ehome.findByPrimaryKey("Philippe Durieux"); 72 } catch (Exception e) { 73 try { 75 utx.begin(); 76 ehome.create("Philippe Durieux", "638"); 77 ehome.create("Philippe Coq", "1235456"); 78 ehome.create("Adriana Danes", "1233456"); 79 ehome.create("Helene Joanin", "1230456"); 80 ehome.create("Gerard Vandome", "1232456"); 81 ehome.create("Francois Exertier", "1323456"); 82 ehome.create("Emmanuel Facarde", "1234356"); 83 ehome.create("Charly Mingus", "1238456"); 84 ehome.create("Thelonious Monk", "1239456"); 85 ehome.create("Jean-Luc Richard", "1203456"); 86 } catch (Exception i) { 87 debug("Cannote create bean" + i); 88 } finally { 89 try { 90 utx.commit(); 91 } catch (Exception e3) { 92 } 93 } 94 } 95 } 96 return ehome; 97 } 98 99 public static Test suite() { 100 return new TestSuite(F_AdvancedHomeEC2.class); 101 } 102 103 public static void main (String args[]) { 104 String testtorun = null; 105 for (int argn = 0; argn < args.length; argn++) { 107 String s_arg = args[argn]; 108 Integer i_arg; 109 if (s_arg.equals("-n")) { 110 testtorun = args[++argn]; 111 } 112 } 113 if (testtorun == null) { 114 junit.textui.TestRunner.run(suite()); 115 } else { 116 junit.textui.TestRunner.run(new F_AdvancedHomeEC2(testtorun)); 117 } 118 } 119 } 120 | Popular Tags |