1 25 26 package org.objectweb.jonas.jtests.clients.entity; 27 28 import java.util.Date ; 29 30 import javax.naming.NamingException ; 31 import javax.rmi.PortableRemoteObject ; 32 33 import junit.framework.Test; 34 import junit.framework.TestSuite; 35 36 import org.objectweb.jonas.jtests.beans.etype.outildate.OutildateHome; 37 38 43 44 public class F_EtypeOutildateEC2 extends A_EtypeOutildate { 45 46 private static String BEAN_HOME = "EtypeOutildateEC2Home"; 47 protected static OutildateHome home = null; 48 private static final long ONE_HOUR = 60L*60L*1000L; 49 private static final long ONE_DAY = 24L*ONE_HOUR; 50 51 public F_EtypeOutildateEC2(String name) { 52 super(name); 53 } 54 55 protected void setUp() { 56 super.setUp(); 57 } 58 59 public OutildateHome getHome() { 60 if (home == null) { 61 try { 62 home = (OutildateHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), 63 OutildateHome.class); 64 } catch (NamingException e) { 65 fail("Cannot get bean home: "+BEAN_HOME); 66 } 67 try { 69 home.create("pk1", new Date (ONE_DAY)); 70 home.create("pk2", new Date (2*ONE_DAY)); 71 home.create("pk3", new Date (3*ONE_DAY)); 72 home.create("pk4", new Date (4*ONE_DAY)); 73 home.create("pk5", new Date (5*ONE_DAY)); 74 home.create("pk5bis", new Date (5*ONE_DAY)); 75 home.create("pktoremove", new Date (12*ONE_DAY)); 76 home.create("pknull", (Date ) null); 77 home.create("pkchangenull", new Date (12*ONE_DAY)); 78 } catch (Exception i) { 79 } 80 } 81 return home; 82 } 83 84 public static Test suite() { 85 return new TestSuite(F_EtypeOutildateEC2.class); 86 } 87 88 public static void main (String args[]) { 89 String testtorun = null; 90 for (int argn = 0; argn < args.length; argn++) { 92 String s_arg = args[argn]; 93 Integer i_arg; 94 if (s_arg.equals("-n")) { 95 testtorun = args[++argn]; 96 } 97 } 98 if (testtorun == null) { 99 junit.textui.TestRunner.run(suite()); 100 } else { 101 junit.textui.TestRunner.run(new F_EtypeOutildateEC2(testtorun)); 102 } 103 } 104 } 105 | Popular Tags |