001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: F_EtypeOsqltsEC2.java 4406 2004-03-19 11:57:20Z benoitf $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import java.sql.Timestamp;
029:
030: import javax.naming.NamingException;
031: import javax.rmi.PortableRemoteObject;
032:
033: import junit.framework.Test;
034: import junit.framework.TestSuite;
035:
036: import org.objectweb.jonas.jtests.beans.etype.osqlts.OsqltsHome;
037:
038: /**
039: * This is a test suite about java.sql.Timestamp field of entity bean CMP version 2.
040: * Beans used: etype/osqlts
041: * @author Jerome Camilleri
042: */
043:
044: public class F_EtypeOsqltsEC2 extends A_EtypeOsqlts {
045:
046: private static String BEAN_HOME = "EtypeOsqltsEC2Home";
047: protected static OsqltsHome home = null;
048: private static final long ONE_HOUR = 60L * 60L * 1000L;
049: private static final long ONE_DAY = 24L * ONE_HOUR;
050:
051: public F_EtypeOsqltsEC2(String name) {
052: super (name);
053: }
054:
055: protected void setUp() {
056: super .setUp();
057: }
058:
059: public OsqltsHome getHome() {
060: if (home == null) {
061: try {
062: home = (OsqltsHome) PortableRemoteObject.narrow(ictx
063: .lookup(BEAN_HOME), OsqltsHome.class);
064: } catch (NamingException e) {
065: fail("Cannot get bean home: " + BEAN_HOME);
066: }
067: // init here tables if CMP2
068: try {
069: home.create("pk1", new Timestamp(ONE_DAY));
070: home.create("pk2", new Timestamp(2 * ONE_DAY));
071: home.create("pk3", new Timestamp(3 * ONE_DAY));
072: home.create("pk4", new Timestamp(4 * ONE_DAY));
073: home.create("pk5", new Timestamp(5 * ONE_DAY));
074: home.create("pk5bis", new Timestamp(5 * ONE_DAY));
075: home.create("pktoremove", new Timestamp(12 * ONE_DAY));
076: home.create("pknull", (Timestamp) null);
077: home
078: .create("pkchangenull", new Timestamp(
079: 12 * ONE_DAY));
080: } catch (Exception i) {
081: }
082: }
083: return home;
084: }
085:
086: public static Test suite() {
087: return new TestSuite(F_EtypeOsqltsEC2.class);
088: }
089:
090: public static void main(String args[]) {
091: String testtorun = null;
092: // Get args
093: for (int argn = 0; argn < args.length; argn++) {
094: String s_arg = args[argn];
095: Integer i_arg;
096: if (s_arg.equals("-n")) {
097: testtorun = args[++argn];
098: }
099: }
100: if (testtorun == null) {
101: junit.textui.TestRunner.run(suite());
102: } else {
103: junit.textui.TestRunner
104: .run(new F_EtypeOsqltsEC2(testtorun));
105: }
106: }
107: }
|