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_EtypeObigdecimalEC2.java 4406 2004-03-19 11:57:20Z benoitf $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import java.math.BigDecimal;
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.obigd.ObigdecimalHome;
037:
038: /**
039: * This is a test suite about java.lang.Long field of entity bean CMP version 2.
040: * Beans used: etype/obigd
041: * @author Helene Joanin
042: */
043:
044: public class F_EtypeObigdecimalEC2 extends A_EtypeObigdecimal {
045:
046: private static String BEAN_HOME = "EtypeObigdecimalEC2Home";
047: protected static ObigdecimalHome home = null;
048:
049: public F_EtypeObigdecimalEC2(String name) {
050: super (name);
051: }
052:
053: protected void setUp() {
054: super .setUp();
055: }
056:
057: public ObigdecimalHome getHome() {
058: if (home == null) {
059: try {
060: home = (ObigdecimalHome) PortableRemoteObject.narrow(
061: ictx.lookup(BEAN_HOME), ObigdecimalHome.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", new BigDecimal(1));
068: home.create("pk2", new BigDecimal(2));
069: home.create("pk3", new BigDecimal(3));
070: home.create("pk4", new BigDecimal(4));
071: home.create("pk5", new BigDecimal(5));
072: home.create("pk5bis", new BigDecimal(5));
073: home.create("pktoremove", new BigDecimal(10000));
074: home.create("pknull", (BigDecimal) null);
075: home.create("pkchangenull", new BigDecimal(10000));
076: } catch (Exception i) {
077: }
078: }
079: return home;
080: }
081:
082: public static Test suite() {
083: return new TestSuite(F_EtypeObigdecimalEC2.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_EtypeObigdecimalEC2(
100: testtorun));
101: }
102: }
103: }
|