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_ClientViewSL.java 8075 2006-03-01 09:02:22Z durieuxp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.session;
027:
028: import javax.rmi.PortableRemoteObject;
029:
030: import junit.framework.Test;
031: import junit.framework.TestSuite;
032:
033: import org.objectweb.jonas.jtests.beans.local.Target;
034: import org.objectweb.jonas.jtests.beans.local.TargetSLHome;
035:
036: /**
037: * testcases specifics for stateless session beans must be here
038: */
039: public class F_ClientViewSL extends A_ClientView {
040:
041: protected static String BEAN_HOME = "EJB/localTargetSLHome";
042:
043: protected static TargetSLHome home = null;
044:
045: public F_ClientViewSL(String name) {
046: super (name);
047: }
048:
049: /**
050: * test EJBObject.isIdentical on two beans
051: * @see Spec EJB2.0 6.9.2
052: */
053: public void testIsIdenticalOnBeans() throws Exception {
054: Target tr1 = getHome().create();
055: Target tr2 = getHome().create();
056: assertTrue(tr1.isIdentical(tr2));
057: tr1.remove();
058: tr2.remove();
059: }
060:
061: /**
062: * init environment: - load beans
063: */
064: protected void setUp() {
065: super .setUp();
066: useBeans("local", false);
067: }
068:
069: public TargetSLHome getHome() throws Exception {
070: if (home == null) {
071: home = (TargetSLHome) PortableRemoteObject.narrow(ictx
072: .lookup(BEAN_HOME), TargetSLHome.class);
073: }
074: assertTrue(home != null);
075: return home;
076: }
077:
078: public static Test suite() {
079: return new TestSuite(F_ClientViewSL.class);
080: }
081:
082: public static void main(String args[]) throws Exception {
083: String testtorun = null;
084: // Get args
085: for (int argn = 0; argn < args.length; argn++) {
086: String s_arg = args[argn];
087: Integer i_arg;
088: if (s_arg.equals("-n")) {
089: testtorun = args[++argn];
090: }
091: }
092: if (testtorun == null) {
093: junit.textui.TestRunner.run(suite());
094: } else {
095:
096: junit.textui.TestRunner.run(new F_ClientViewSL(testtorun));
097:
098: }
099: }
100: }
|