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 Foundation; 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: G_TxAttributeSY.java 3485 2003-10-08 08:16:58Z legrasi $
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.jtests.clients.transaction;
27:
28: import javax.naming.NamingException;
29: import javax.rmi.PortableRemoteObject;
30: import junit.framework.Test;
31: import junit.framework.TestSuite;
32:
33: import org.objectweb.jonas.jtests.beans.transacted.Simple;
34: import org.objectweb.jonas.jtests.beans.transacted.SimpleSHome;
35:
36: /**
37: * TxAttribute tests on session bean
38: */
39:
40: public class G_TxAttributeSY extends B_TxAttribute {
41:
42: private static String BEAN_HOME = "transactedSimpleSYHome";
43: protected static SimpleSHome home = null;
44:
45: public G_TxAttributeSY(String name) {
46: super (name);
47: }
48:
49: public void testEmpty() throws Exception {
50: }
51:
52: /**
53: * Create a bean and return it.
54: */
55: public Simple getSimple(int i) throws Exception {
56: return home.create();
57: }
58:
59: /**
60: * init environment:
61: * - load beans
62: * - create/init database for entities.
63: */
64: protected void setUp() {
65: super .setUp();
66: if (home == null) {
67: try {
68: home = (SimpleSHome) PortableRemoteObject.narrow(ictx
69: .lookup(BEAN_HOME), SimpleSHome.class);
70: } catch (NamingException e) {
71: fail("Cannot get Home:" + e);
72: }
73: }
74: }
75:
76: /**
77: * This suite is all BMP test cases
78: */
79: public static Test suite() {
80: return new TestSuite(G_TxAttributeSY.class);
81: }
82:
83: public static void main(String args[]) {
84: String testtorun = null;
85: // Get args
86: for (int argn = 0; argn < args.length; argn++) {
87: String sarg = args[argn];
88: if (sarg.equals("-n")) {
89: testtorun = args[++argn];
90: }
91: }
92: if (testtorun == null) {
93: junit.textui.TestRunner.run(suite());
94: } else {
95: junit.textui.TestRunner.run(new G_TxAttributeSY(testtorun));
96: }
97: }
98: }
|