KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > stests > manac > A_mono


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_mono.java,v 1.6 2003/12/09 12:37:36 durieuxp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.stests.manac;
27
28 /**
29  * Set of test with only 1 thread at a time.
30  */

31 public abstract class A_mono extends A_manac {
32
33     // default values
34
int accounts = 20; // 20 accounts (nb of pre-created accounts)
35
int delay = 0; // no delay added
36
int loops = 1; // 1 loop
37
int amount = 10; // withdraw value : 10 (initial value is 1000)
38
int threads = 1; // 1 thread (mono!)
39
int checklevel = 2; // check accounts after every test
40
int timeout = 12; // 12 seconds
41

42     public A_mono(String JavaDoc name) {
43         super(name);
44     }
45
46     public int getAccounts() {
47         return accounts;
48     }
49
50     /*
51      * Simplest test : 1 loop, no rollback, no delay
52      */

53     public void testBasic() throws Exception JavaDoc {
54         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
55     }
56
57     public void testLoop() throws Exception JavaDoc {
58         int loops = 40;
59         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
60     }
61
62     /*
63      * test rollback
64      */

65     public void testRb() throws Exception JavaDoc {
66         int amount = 2000;
67         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
68     }
69
70     public void testDelay() throws Exception JavaDoc {
71         int accounts = 4;
72         int delay = 3;
73         int loops = 6;
74         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
75     }
76
77     public void testCreate() throws Exception JavaDoc {
78         int accounts = 200;
79         int loops = 12;
80         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
81     }
82
83     public void testCreateRb() throws Exception JavaDoc {
84         int accounts = 100;
85         int loops = 10;
86         int amount = 444;
87         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
88     }
89
90     /**
91      * test with a timeout shorter than the transaction
92      * -> transaction will be rolled back.
93      */

94     public void testTimeout() throws Exception JavaDoc {
95         int timeout = 3;
96         int delay = 5;
97         manac(accounts, delay, loops, amount, threads, checklevel, timeout);
98     }
99 }
100
Popular Tags