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_mnu_CS_EC2.java 7421 2005-09-26 15:50:07Z durieuxp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.entity;
027:
028: import java.util.ArrayList;
029: import java.util.Collection;
030: import java.util.Enumeration;
031: import java.util.Hashtable;
032:
033: import javax.naming.NamingException;
034: import javax.rmi.PortableRemoteObject;
035:
036: import junit.framework.Test;
037: import junit.framework.TestSuite;
038:
039: import org.objectweb.jonas.jtests.beans.relation.mnu.AHomeRemote;
040: import org.objectweb.jonas.jtests.beans.relation.mnu.ARemote;
041: import org.objectweb.jonas.jtests.beans.relation.mnu.BHomeRemote;
042: import org.objectweb.jonas.jtests.beans.relation.mnu.BRemote;
043:
044: /**
045: * For testing many-to-many unidirectional relationships
046: * @author Ph Durieux
047: **/
048: public class F_mnu_CS_EC2 extends A_mnu {
049:
050: private static String BEAN_HOME_A = "relation_mnu_AHome";
051: protected static AHomeRemote ahome = null;
052: private static String BEAN_HOME_B = "relation_mnu_BHome";
053: protected static BHomeRemote bhome = null;
054:
055: public F_mnu_CS_EC2(String name) {
056: super (name);
057: }
058:
059: public AHomeRemote getAHome() {
060: if (ahome == null) {
061: try {
062: ahome = (AHomeRemote) PortableRemoteObject.narrow(ictx
063: .lookup(BEAN_HOME_A), AHomeRemote.class);
064: } catch (NamingException e) {
065: fail("Cannot get bean home: " + e.getMessage());
066: }
067: }
068: return ahome;
069: }
070:
071: public BHomeRemote getBHome() {
072: if (bhome == null) {
073: try {
074: bhome = (BHomeRemote) PortableRemoteObject.narrow(ictx
075: .lookup(BEAN_HOME_B), BHomeRemote.class);
076: } catch (NamingException e) {
077: fail("Cannot get bean home: " + e.getMessage());
078: }
079: }
080: return bhome;
081: }
082:
083: public static Test suite() {
084: return new TestSuite(F_mnu_CS_EC2.class);
085: }
086:
087: public static void main(String args[]) {
088: String testtorun = null;
089: // Get args
090: for (int argn = 0; argn < args.length; argn++) {
091: String s_arg = args[argn];
092: Integer i_arg;
093: if (s_arg.equals("-n")) {
094: testtorun = args[++argn];
095: }
096: }
097: if (testtorun == null) {
098: junit.textui.TestRunner.run(suite());
099: } else {
100: junit.textui.TestRunner.run(new F_mnu_CS_EC2(testtorun));
101: }
102: }
103:
104: }
|