KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > session > 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.9 2004/05/20 23:28:49 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.session;
27
28 import javax.rmi.PortableRemoteObject JavaDoc;
29
30 import junit.framework.Test;
31 import junit.framework.TestSuite;
32
33 import org.objectweb.jonas.jtests.beans.local.Target;
34 import org.objectweb.jonas.jtests.beans.local.TargetSLHome;
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 BEAN_HOME = "EJB/localTargetSLHome";
42     protected static TargetSLHome home = null;
43
44     public F_ClientViewSL(String JavaDoc name) {
45     super(name);
46     }
47    
48     /**
49      * test EJBObject.isIdentical on two beans
50      * @see Spec EJB2.0 6.9.2
51      */

52     public void testIsIdenticalOnBeans() throws Exception JavaDoc {
53     Target tr1 = getHome().create();
54         Target tr2 = getHome().create();
55     assertTrue(tr1.isIdentical(tr2));
56     tr1.remove();
57         tr2.remove();
58     }
59
60
61     /**
62      * init environment:
63      * - load beans
64      */

65     protected void setUp() {
66     super.setUp();
67     useBeans("local", false);
68     }
69  
70    public TargetSLHome getHome() throws Exception JavaDoc {
71         if (home == null) {
72             home = (TargetSLHome)PortableRemoteObject.narrow(ictx.lookup(BEAN_HOME), TargetSLHome.class);
73     }
74         assertTrue(home != null);
75         return home;
76     }
77
78     public static Test suite() {
79     return new TestSuite(F_ClientViewSL.class);
80     }
81     
82   
83     public static void main (String JavaDoc args[]) throws Exception JavaDoc {
84     String JavaDoc testtorun = null;
85     // Get args
86
for (int argn = 0; argn < args.length; argn++) {
87         String JavaDoc s_arg = args[argn];
88         Integer JavaDoc i_arg;
89         if (s_arg.equals("-n")) {
90         testtorun = args[++argn];
91         }
92     }
93     if (testtorun == null) {
94         junit.textui.TestRunner.run(suite());
95     } else {
96       
97         junit.textui.TestRunner.run(new F_ClientViewSL(testtorun));
98         
99     }
100     }
101 }
102
Popular Tags