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_EtypeOlongEC2.java 4406 2004-03-19 11:57:20Z benoitf $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import javax.naming.NamingException;
029: import javax.rmi.PortableRemoteObject;
030:
031: import junit.framework.Test;
032: import junit.framework.TestSuite;
033:
034: import org.objectweb.jonas.jtests.beans.etype.olong.OlongHome;
035:
036: /**
037: * This is a test suite about java.lang.Long field of entity bean CMP version 2.
038: * Beans used: etype/olong
039: * @author Helene Joanin
040: */
041:
042: public class F_EtypeOlongEC2 extends A_EtypeOlong {
043:
044: private static String BEAN_HOME = "EtypeOlongEC2Home";
045: protected static OlongHome home = null;
046:
047: public F_EtypeOlongEC2(String name) {
048: super (name);
049: }
050:
051: protected void setUp() {
052: super .setUp();
053: }
054:
055: public OlongHome getHome() {
056: if (home == null) {
057: try {
058: home = (OlongHome) PortableRemoteObject.narrow(ictx
059: .lookup(BEAN_HOME), OlongHome.class);
060: } catch (NamingException e) {
061: fail("Cannot get bean home: " + BEAN_HOME);
062: }
063: // init here tables if CMP2
064: try {
065: home.create("pk1", new Long(1));
066: home.create("pk2", new Long(2));
067: home.create("pk3", new Long(3));
068: home.create("pk4", new Long(4));
069: home.create("pk5", new Long(5));
070: home.create("pk5bis", new Long(5));
071: home.create("pktoremove", new Long(10000));
072: home.create("pknull", (Long) null);
073: home.create("pkchangenull", new Long(10000));
074: } catch (Exception i) {
075: }
076: }
077: return home;
078: }
079:
080: public static Test suite() {
081: return new TestSuite(F_EtypeOlongEC2.class);
082: }
083:
084: public static void main(String args[]) {
085: String testtorun = null;
086: // Get args
087: for (int argn = 0; argn < args.length; argn++) {
088: String s_arg = args[argn];
089: Integer i_arg;
090: if (s_arg.equals("-n")) {
091: testtorun = args[++argn];
092: }
093: }
094: if (testtorun == null) {
095: junit.textui.TestRunner.run(suite());
096: } else {
097: junit.textui.TestRunner.run(new F_EtypeOlongEC2(testtorun));
098: }
099: }
100: }
|