KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > clients > distribution > A_bankWrite


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: A_bankWrite.java,v 1.10 2005/07/26 15:14:37 durieuxp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.clients.distribution;
27
28 import java.rmi.NoSuchObjectException JavaDoc;
29 import java.rmi.ServerException JavaDoc;
30
31 public abstract class A_bankWrite extends A_bank {
32
33     public A_bankWrite(String JavaDoc name) {
34         super(name);
35     }
36
37     public void testBasicMove() throws Exception JavaDoc {
38         ope(OP_MOVE, 0, 9, 1, 1);
39     }
40
41     public void testBasicMoveNC() throws Exception JavaDoc {
42         ope(OP_MOVE, 0, 9, 1, 1, 5, false);
43     }
44
45     public void testBasicRemove() throws Exception JavaDoc {
46         ope(OP_CREATE, 3000, 4000, 1, 1);
47         ope(OP_REMOVE, 3000, 4000, 1, 1);
48     }
49
50     public void testMultiRemove() throws Exception JavaDoc {
51         ope(OP_CREATE, 3000, 4000, 100, 1);
52         ope(OP_REMOVE, 3000, 4000, 1, 8);
53     }
54     
55     public void testManyRemove() throws Exception JavaDoc {
56         ope(OP_CREATE, 3000, 4000, 300, 1);
57         ope(OP_REMOVE, 3000, 4000, 200, 1);
58     }
59
60     /**
61      * Test the rollback
62      */

63     public void testBasicRB() throws Exception JavaDoc {
64         ope(OP_MOVE, 0, 2, 4, 1, 700);
65     }
66
67     public void testMultiRB() throws Exception JavaDoc {
68         ope(OP_MOVE, 0, 4, 4, 5, 600);
69     }
70
71
72     public void testBasicCreate() throws Exception JavaDoc {
73         ope(OP_CREATE, 100, 150, 1, 1);
74     }
75
76     public void testShortCreate() throws Exception JavaDoc {
77         ope(OP_CREATE, 6000, 8000, 100, 1);
78     }
79
80     public void testMultiCreate() throws Exception JavaDoc {
81         ope(OP_CREATE, 1000, 1900, 1, 12);
82     }
83
84
85     public void testMultiMove() throws Exception JavaDoc {
86         ope(OP_MOVE, 0, 5, 1, 5);
87     }
88
89     /**
90      * test access on removed account
91      * spec EJB 2.1 page 406 (18.3.6/18.3.7) says that the container
92      * must throw a NoSuchObjectException to the client.
93      */

94     public void testAccessRemoved() throws Exception JavaDoc {
95         int num = 700;
96         // create the account if it doesn't exist yet
97
manager.readBalance(num);
98         manager.delAccount(num);
99         try {
100             // read balance for last accessed account
101
manager.readBalance();
102             fail("must throw NoSuchObjectException");
103         } catch (NoSuchObjectException JavaDoc e) {
104             manager = null; // avoids that all other tests fail
105
} catch (ServerException JavaDoc e) {
106             manager = null; // avoids that all other tests fail
107
if (! (e.getCause() instanceof NoSuchObjectException JavaDoc)) {
108                 fail("Should receive NoSuchObjectException");
109             }
110         }
111     }
112
113 }
114
Popular Tags