01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: F_oob_CS_EC2.java 7424 2005-09-27 07:34:03Z durieuxp $
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.jtests.clients.entity;
27:
28: import javax.ejb.ObjectNotFoundException;
29: import javax.naming.NamingException;
30: import javax.rmi.PortableRemoteObject;
31: import junit.framework.Test;
32: import junit.framework.TestSuite;
33: import org.objectweb.jonas.jtests.beans.relation.oob.ARemote;
34: import org.objectweb.jonas.jtests.beans.relation.oob.AHomeRemote;
35: import org.objectweb.jonas.jtests.beans.relation.oob.BRemote;
36: import org.objectweb.jonas.jtests.beans.relation.oob.BHomeRemote;
37:
38: /**
39: * This is an advanced test suite for home interface on entity bean CMP2.
40: * Beans used: oob
41: * @author Ph. Durieux
42: */
43: public class F_oob_CS_EC2 extends A_oob {
44:
45: private static String BEAN_HOME_A = "relation_oob_AHome";
46: private static String BEAN_HOME_B = "relation_oob_BHome";
47: protected static AHomeRemote ahome = null;
48: protected static BHomeRemote bhome = null;
49:
50: public F_oob_CS_EC2(String name) {
51: super (name);
52: }
53:
54: public AHomeRemote getAHome() {
55: if (ahome == null) {
56: try {
57: ahome = (AHomeRemote) PortableRemoteObject.narrow(ictx
58: .lookup(BEAN_HOME_A), AHomeRemote.class);
59: } catch (NamingException e) {
60: fail("Cannot get bean home: " + e.getMessage());
61: }
62: }
63: return ahome;
64: }
65:
66: public BHomeRemote getBHome() {
67: if (bhome == null) {
68: try {
69: bhome = (BHomeRemote) PortableRemoteObject.narrow(ictx
70: .lookup(BEAN_HOME_B), BHomeRemote.class);
71: } catch (NamingException e) {
72: fail("Cannot get bean home: " + e.getMessage());
73: }
74: }
75: return bhome;
76: }
77:
78: public static Test suite() {
79: return new TestSuite(F_oob_CS_EC2.class);
80: }
81:
82: public static void main(String args[]) {
83: String testtorun = null;
84: // Get args
85: for (int argn = 0; argn < args.length; argn++) {
86: String s_arg = args[argn];
87: Integer i_arg;
88: if (s_arg.equals("-n")) {
89: testtorun = args[++argn];
90: }
91: }
92: if (testtorun == null) {
93: junit.textui.TestRunner.run(suite());
94: } else {
95: junit.textui.TestRunner.run(new F_oob_CS_EC2(testtorun));
96: }
97: }
98: }
|