001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: A_mono.java 3862 2003-12-09 12:37:39Z durieuxp $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.stests.manac;
027:
028: /**
029: * Set of test with only 1 thread at a time.
030: */
031: public abstract class A_mono extends A_manac {
032:
033: // default values
034: int accounts = 20; // 20 accounts (nb of pre-created accounts)
035: int delay = 0; // no delay added
036: int loops = 1; // 1 loop
037: int amount = 10; // withdraw value : 10 (initial value is 1000)
038: int threads = 1; // 1 thread (mono!)
039: int checklevel = 2; // check accounts after every test
040: int timeout = 12; // 12 seconds
041:
042: public A_mono(String name) {
043: super (name);
044: }
045:
046: public int getAccounts() {
047: return accounts;
048: }
049:
050: /*
051: * Simplest test : 1 loop, no rollback, no delay
052: */
053: public void testBasic() throws Exception {
054: manac(accounts, delay, loops, amount, threads, checklevel,
055: timeout);
056: }
057:
058: public void testLoop() throws Exception {
059: int loops = 40;
060: manac(accounts, delay, loops, amount, threads, checklevel,
061: timeout);
062: }
063:
064: /*
065: * test rollback
066: */
067: public void testRb() throws Exception {
068: int amount = 2000;
069: manac(accounts, delay, loops, amount, threads, checklevel,
070: timeout);
071: }
072:
073: public void testDelay() throws Exception {
074: int accounts = 4;
075: int delay = 3;
076: int loops = 6;
077: manac(accounts, delay, loops, amount, threads, checklevel,
078: timeout);
079: }
080:
081: public void testCreate() throws Exception {
082: int accounts = 200;
083: int loops = 12;
084: manac(accounts, delay, loops, amount, threads, checklevel,
085: timeout);
086: }
087:
088: public void testCreateRb() throws Exception {
089: int accounts = 100;
090: int loops = 10;
091: int amount = 444;
092: manac(accounts, delay, loops, amount, threads, checklevel,
093: timeout);
094: }
095:
096: /**
097: * test with a timeout shorter than the transaction
098: * -> transaction will be rolled back.
099: */
100: public void testTimeout() throws Exception {
101: int timeout = 3;
102: int delay = 5;
103: manac(accounts, delay, loops, amount, threads, checklevel,
104: timeout);
105: }
106: }
|