01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundationpkg; either
09: * 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: B_ClientView.java 4066 2004-01-21 14:51:28Z legrasi $
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.jtests.clients.session;
27:
28: import java.rmi.NoSuchObjectException;
29: import javax.rmi.PortableRemoteObject;
30: import java.rmi.RemoteException;
31: import javax.ejb.RemoveException;
32: import javax.ejb.EJBException;
33: import javax.ejb.EJBMetaData;
34: import javax.ejb.Handle;
35: import javax.ejb.HomeHandle;
36:
37: import javax.ejb.NoSuchObjectLocalException;
38: import org.objectweb.jonas.jtests.beans.flocal.Target;
39: import org.objectweb.jonas.jtests.beans.flocal.TargetSLHome;
40: import org.objectweb.jonas.jtests.util.JTestCase;
41:
42: /**
43: * This Class defines perf Test cases that can be run either SF or SL bean.
44: * These tests are related to the "Client View of a Session Bean"
45: * A session bean that supports both Local & Remote interface is used
46: * (TargetSL oe TargetSF in beans/local)
47: * But here are testcases that can be run via a non remote suite.
48: *
49: * @see EJB2.0 specification Chapter 6.
50: * @author Ph Coq, Ph Durieux
51: */
52:
53: public abstract class B_ClientView extends JTestCase {
54:
55: public B_ClientView(String name) {
56: super (name);
57: }
58:
59: /**
60: * @return TargetSLHome, that can be either SF or SL bean.
61: */
62: public abstract TargetSLHome getHome() throws Exception;
63:
64: /**
65: * This test verify we can create, access to the bean via
66: * its remote interface and remove it
67: * It verifies we cannot access to the bean after remove
68: */
69: public void testCreateAccessRemoteRemove() throws Exception {
70: Target tr = getHome().create();
71: System.out.println("create");
72:
73: assertEquals(10, tr.getTen());
74: System.out.println("getten");
75:
76: tr.remove();
77: System.out
78: .println("create, access to the bean via its remote interface and remove it");
79: try {
80: tr.method2("Bye");
81: // fail("NoSuchObjectException must be raised");
82: } catch (NoSuchObjectException e) {
83:
84: System.out
85: .println("verify no access allowable after remove");
86: }
87: }
88:
89: }
|