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_EtypeOsqltimeEC2.java 6739 2005-05-11 15:29:07Z ashah $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import java.sql.Time;
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.osqltime.OsqltimeHome;
037:
038: /**
039: * This is a test suite about java.sql.Time field of entity bean CMP version 2.
040: * Beans used: etype/osqltime
041: * @author Helene Joanin
042: */
043:
044: public class F_EtypeOsqltimeEC2 extends A_EtypeOsqltime {
045:
046: private static String BEAN_HOME = "EtypeOsqltimeEC2Home";
047: protected static OsqltimeHome home = null;
048:
049: public F_EtypeOsqltimeEC2(String name) {
050: super (name);
051: }
052:
053: protected void setUp() {
054: super .setUp();
055: }
056:
057: public OsqltimeHome getHome() {
058: if (home == null) {
059: try {
060: home = (OsqltimeHome) PortableRemoteObject.narrow(ictx
061: .lookup(BEAN_HOME), OsqltimeHome.class);
062: } catch (NamingException e) {
063: fail("Cannot get bean home: " + BEAN_HOME);
064: }
065: // init here tables if CMP2
066: try {
067: home.create("pk1", Time.valueOf("01:00:00"));
068: home.create("pk2", Time.valueOf("02:00:00"));
069: home.create("pk3", Time.valueOf("03:00:00"));
070: home.create("pk4", Time.valueOf("04:00:00"));
071: home.create("pk5", Time.valueOf("05:00:00"));
072: home.create("pk5bis", Time.valueOf("05:00:00"));
073: home.create("pktoremove", Time.valueOf("12:00:00"));
074: home.create("pknull", (Time) null);
075: home.create("pkchangenull", Time.valueOf("12:00:00"));
076: } catch (Exception i) {
077: }
078: }
079: return home;
080: }
081:
082: public static Test suite() {
083: return new TestSuite(F_EtypeOsqltimeEC2.class);
084: }
085:
086: public static void main(String args[]) {
087: String testtorun = null;
088: // Get args
089: for (int argn = 0; argn < args.length; argn++) {
090: String s_arg = args[argn];
091: Integer i_arg;
092: if (s_arg.equals("-n")) {
093: testtorun = args[++argn];
094: }
095: }
096: if (testtorun == null) {
097: junit.textui.TestRunner.run(suite());
098: } else {
099: junit.textui.TestRunner.run(new F_EtypeOsqltimeEC2(
100: testtorun));
101: }
102: }
103: }
|