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_EtypeOsqldateEC2.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.Date;
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.osqldate.OsqldateHome;
037:
038: /**
039: * This is a test suite about java.sql.Date field of entity bean CMP version 2.
040: * Beans used: etype/osqldate
041: * @author Jerome Camilleri
042: */
043:
044: public class F_EtypeOsqldateEC2 extends A_EtypeOsqldate {
045:
046: private static String BEAN_HOME = "EtypeOsqldateEC2Home";
047: protected static OsqldateHome home = null;
048:
049: public F_EtypeOsqldateEC2(String name) {
050: super (name);
051: }
052:
053: protected void setUp() {
054: super .setUp();
055: }
056:
057: public OsqldateHome getHome() {
058: if (home == null) {
059: try {
060: home = (OsqldateHome) PortableRemoteObject.narrow(ictx
061: .lookup(BEAN_HOME), OsqldateHome.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", Date.valueOf("1970-01-01"));
068: home.create("pk2", Date.valueOf("1970-01-02"));
069: home.create("pk3", Date.valueOf("1970-01-03"));
070: home.create("pk4", Date.valueOf("1970-01-04"));
071: home.create("pk5", Date.valueOf("1970-01-05"));
072: home.create("pk5bis", Date.valueOf("1970-01-05"));
073: home.create("pktoremove", Date.valueOf("1970-01-12"));
074: home.create("pknull", (Date) null);
075: home.create("pkchangenull", Date.valueOf("1970-01-12"));
076: } catch (Exception i) {
077: }
078: }
079: return home;
080: }
081:
082: public static Test suite() {
083: return new TestSuite(F_EtypeOsqldateEC2.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_EtypeOsqldateEC2(
100: testtorun));
101: }
102: }
103: }
|