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: G_AdvancedHomeEC2.java 4066 2004-01-21 14:51:28Z legrasi $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import java.rmi.RemoteException;
029: import java.util.Enumeration;
030: import javax.ejb.CreateException;
031: import javax.ejb.DuplicateKeyException;
032: import javax.ejb.FinderException;
033: import javax.ejb.RemoveException;
034: import javax.naming.NamingException;
035: import javax.rmi.PortableRemoteObject;
036: import junit.framework.Test;
037: import junit.framework.TestSuite;
038:
039: import org.objectweb.jonas.jtests.beans.fannuaire.Personne;
040: import org.objectweb.jonas.jtests.beans.fannuaire.PersonneHome;
041: import org.objectweb.jonas.jtests.util.JTestCase;
042:
043: /**
044: * This is an advanced test suite for home interface on entity bean CMP v2.
045: * * All tests common to CMP v1 and CMP v2 are in the inherited class A_AdvancedHomeEC.
046: * Beans used: annuaire
047: * @author Philippe Coq, Philippe Durieux, Helene Joanin (jonas team)
048: */
049: public class G_AdvancedHomeEC2 extends B_AdvancedHomeEC {
050:
051: private static String BEAN_HOME = "fannuairePersonneEC2Home";
052: private static PersonneHome ehome = null;
053:
054: public G_AdvancedHomeEC2(String name) {
055: super (name);
056: }
057:
058: public void testEmpty() throws Exception {
059: }
060:
061: public PersonneHome getHome() {
062: if (ehome == null) {
063: try {
064: ehome = (PersonneHome) PortableRemoteObject.narrow(ictx
065: .lookup(BEAN_HOME), PersonneHome.class);
066: } catch (NamingException e) {
067: fail("Cannot get bean home");
068: }
069: // init here tables if CMP2
070: try {
071: ehome.create("Philippe Coq", "1235456");
072: ehome.create("Philippe Durieux", "638");
073: ehome.create("Adriana Danes", "1233456");
074: ehome.create("Helene Joanin", "1230456");
075: ehome.create("Gerard Vandome", "1232456");
076: ehome.create("Francois Exertier", "1323456");
077: ehome.create("Emmanuel Facarde", "1234356");
078: ehome.create("Charly Mingus", "1238456");
079: ehome.create("Thelonious Monk", "1239456");
080: ehome.create("Jean-Luc Richard", "1203456");
081: } catch (Exception i) {
082: }
083: }
084: return ehome;
085: }
086:
087: public static Test suite() {
088: return new TestSuite(G_AdvancedHomeEC2.class);
089: }
090:
091: public static void main(String args[]) {
092: String testtorun = null;
093: // Get args
094: for (int argn = 0; argn < args.length; argn++) {
095: String s_arg = args[argn];
096: Integer i_arg;
097: if (s_arg.equals("-n")) {
098: testtorun = args[++argn];
099: }
100: }
101: if (testtorun == null) {
102: junit.textui.TestRunner.run(suite());
103: } else {
104: junit.textui.TestRunner
105: .run(new G_AdvancedHomeEC2(testtorun));
106: }
107: }
108: }
|