KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > local > F_ClientViewSL


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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_ClientViewSL.java,v 1.4 2004/03/19 11:57:18 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.local;
27
28 import junit.framework.Test;
29 import junit.framework.TestSuite;
30
31 import org.objectweb.jonas.jtests.beans.local.TargetLocal;
32 import org.objectweb.jonas.jtests.beans.local.TargetSLLocalHome;
33 import org.objectweb.jonas.jtests.beans.remoterunner.RSuite;
34 import org.objectweb.jonas.jtests.beans.remoterunner.RemoteRunner;
35
36 /**
37  * testcases specifics for stateless session beans must be here
38  */

39 public class F_ClientViewSL extends A_ClientView {
40   
41     protected static String JavaDoc REMOTE_RUNNER_HOME = "EntrySLHome";
42     protected static String JavaDoc BEAN_LOCALHOME = "localTargetSLHome_L";
43     protected static TargetSLLocalHome lhome = null;
44
45     public F_ClientViewSL(String JavaDoc name) {
46     super(name);
47     }
48
49
50    /**
51      * test EJBLocalObject.isIdentical on the same bean
52      */

53     public void testLocalIsIdenticalOnSameBean() throws Exception JavaDoc {
54     TargetLocal tl = getLocalHome().create();
55     assertTrue(tl.isIdentical(tl));
56     tl.remove();
57     }
58
59
60     /**
61      * init environment:
62      * - load beans
63      *
64      */

65     protected void setUp() {
66     super.setUp();
67
68     }
69  
70     public TargetSLLocalHome getLocalHome() throws Exception JavaDoc {
71         if (lhome == null) {
72         useBeans("local", false);
73             lhome = (TargetSLLocalHome)ictx.lookup(BEAN_LOCALHOME);
74     }
75         assertTrue(lhome != null);
76         return lhome;
77     }
78  
79
80     public static Test suite() {
81     return new TestSuite(F_ClientViewSL.class);
82     }
83
84     public static void main (String JavaDoc args[]) {
85         RSuite rs = new RSuite("unused");
86         rs.setRunnerHomeName(REMOTE_RUNNER_HOME);
87         rs.useBeans("local", false);
88         String JavaDoc rtesttorun = null;
89         // Get args
90
for (int argn = 0; argn < args.length; argn++) {
91         String JavaDoc s_arg = args[argn];
92         Integer JavaDoc i_arg;
93             if (s_arg.equals("-n")) {
94         rtesttorun = args[++argn];
95         }
96     }
97
98         try {
99             RemoteRunner tr = rs.getRemoteRunner();
100             String JavaDoc Result = null;
101             if (rtesttorun == null) {
102                 Result = tr.run(F_ClientViewSL.class);
103             } else {
104                 Result = tr.run(F_ClientViewSL.class, rtesttorun);
105             }
106             System.out.println(Result);
107             
108         } catch(Exception JavaDoc e) {
109             e.printStackTrace();
110             System.exit(2);
111         }
112
113             
114     }
115 }
116
Popular Tags