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 7540 2005-10-20 13:15:22Z durieuxp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.jtests.clients.local;
027:
028: import junit.framework.Test;
029: import junit.framework.TestSuite;
030:
031: import org.objectweb.jonas.jtests.beans.local.TargetLocal;
032: import org.objectweb.jonas.jtests.beans.local.TargetSLLocalHome;
033: import org.objectweb.jonas.jtests.beans.remoterunner.RSuite;
034: import org.objectweb.jonas.jtests.beans.remoterunner.RemoteRunner;
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 REMOTE_RUNNER_HOME = "EntrySLHome";
042: protected static String BEAN_LOCALHOME = "localTargetSLHome_L";
043: protected static TargetSLLocalHome lhome = null;
044:
045: public F_ClientViewSL(String name) {
046: super (name);
047: }
048:
049: /**
050: * test EJBLocalObject.isIdentical on the same bean
051: */
052: public void testLocalIsIdenticalOnSameBean() throws Exception {
053: TargetLocal tl = getLocalHome().create();
054: assertTrue(tl.isIdentical(tl));
055: tl.remove();
056: }
057:
058: /**
059: * init environment:
060: * - load beans
061: *
062: */
063: protected void setUp() {
064: super .setUp();
065:
066: }
067:
068: public TargetSLLocalHome getLocalHome() throws Exception {
069: if (lhome == null) {
070: useBeans("local", false);
071: lhome = (TargetSLLocalHome) ictx.lookup(BEAN_LOCALHOME);
072: }
073: assertTrue(lhome != null);
074: return lhome;
075: }
076:
077: public static Test suite() {
078: return new TestSuite(F_ClientViewSL.class);
079: }
080:
081: public static void main(String args[]) {
082: RSuite rs = new RSuite("unused");
083: rs.setRunnerHomeName(REMOTE_RUNNER_HOME);
084: rs.useBeans("local", false);
085: String rtesttorun = null;
086: // Get args
087: for (int argn = 0; argn < args.length; argn++) {
088: String s_arg = args[argn];
089: Integer i_arg;
090: if (s_arg.equals("-n")) {
091: rtesttorun = args[++argn];
092: }
093: }
094:
095: try {
096: RemoteRunner tr = rs.getRemoteRunner();
097: String Result = null;
098: if (rtesttorun == null) {
099: Result = tr.run(F_ClientViewSL.class);
100: } else {
101: Result = tr.run(F_ClientViewSL.class, rtesttorun);
102: }
103: System.out.println(Result);
104:
105: } catch (Exception e) {
106: e.printStackTrace();
107: System.exit(2);
108: }
109:
110: }
111: }
|