1 25 26 package org.objectweb.jonas.jtests.clients.entity; 27 28 import java.sql.Timestamp ; 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.osqlts.OsqltsHome; 37 38 43 44 public class F_EtypeOsqltsEC2 extends A_EtypeOsqlts { 45 46 private static String BEAN_HOME = "EtypeOsqltsEC2Home"; 47 protected static OsqltsHome 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_EtypeOsqltsEC2(String name) { 52 super(name); 53 } 54 55 protected void setUp() { 56 super.setUp(); 57 } 58 59 public OsqltsHome getHome() { 60 if (home == null) { 61 try { 62 home = (OsqltsHome) PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), 63 OsqltsHome.class); 64 } catch (NamingException e) { 65 fail("Cannot get bean home: "+BEAN_HOME); 66 } 67 try { 69 home.create("pk1", new Timestamp (ONE_DAY)); 70 home.create("pk2", new Timestamp (2*ONE_DAY)); 71 home.create("pk3", new Timestamp (3*ONE_DAY)); 72 home.create("pk4", new Timestamp (4*ONE_DAY)); 73 home.create("pk5", new Timestamp (5*ONE_DAY)); 74 home.create("pk5bis", new Timestamp (5*ONE_DAY)); 75 home.create("pktoremove", new Timestamp (12*ONE_DAY)); 76 home.create("pknull", (Timestamp ) null); 77 home.create("pkchangenull", new Timestamp (12*ONE_DAY)); 78 } catch (Exception i) { 79 } 80 } 81 return home; 82 } 83 84 public static Test suite() { 85 return new TestSuite(F_EtypeOsqltsEC2.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_EtypeOsqltsEC2(testtorun)); 102 } 103 } 104 } 105 | Popular Tags |