KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > entity > F_EtypeOsqltsEC2


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: F_EtypeOsqltsEC2.java,v 1.2 2004/03/19 11:57:15 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.entity;
27
28 import java.sql.Timestamp JavaDoc;
29
30 import javax.naming.NamingException JavaDoc;
31 import javax.rmi.PortableRemoteObject JavaDoc;
32
33 import junit.framework.Test;
34 import junit.framework.TestSuite;
35
36 import org.objectweb.jonas.jtests.beans.etype.osqlts.OsqltsHome;
37
38 /**
39  * This is a test suite about java.sql.Timestamp field of entity bean CMP version 2.
40  * Beans used: etype/osqlts
41  * @author Jerome Camilleri
42  */

43
44 public class F_EtypeOsqltsEC2 extends A_EtypeOsqlts {
45
46     private static String JavaDoc 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 JavaDoc 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 JavaDoc e) {
65         fail("Cannot get bean home: "+BEAN_HOME);
66         }
67         // init here tables if CMP2
68
try {
69         home.create("pk1", new Timestamp JavaDoc(ONE_DAY));
70         home.create("pk2", new Timestamp JavaDoc(2*ONE_DAY));
71         home.create("pk3", new Timestamp JavaDoc(3*ONE_DAY));
72         home.create("pk4", new Timestamp JavaDoc(4*ONE_DAY));
73         home.create("pk5", new Timestamp JavaDoc(5*ONE_DAY));
74         home.create("pk5bis", new Timestamp JavaDoc(5*ONE_DAY));
75         home.create("pktoremove", new Timestamp JavaDoc(12*ONE_DAY));
76         home.create("pknull", (Timestamp JavaDoc) null);
77         home.create("pkchangenull", new Timestamp JavaDoc(12*ONE_DAY));
78         } catch (Exception JavaDoc 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 JavaDoc args[]) {
89     String JavaDoc testtorun = null;
90     // Get args
91
for (int argn = 0; argn < args.length; argn++) {
92         String JavaDoc s_arg = args[argn];
93         Integer JavaDoc 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