/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */


package org.objectweb.jonas.jtests.clients.distribution;

import java.rmi.NoSuchObjectException;
import java.rmi.ServerException;

public abstract class A_bankLwrite extends A_bankRead {

    public A_bankLwrite(String name) {
        super(name);
    }
    /**
     * Operation= create 
     * min 100 mx 150 loop 1 Thread 1
     * @throws Exception
     */   
    public void testBasicCreate() throws Exception {
        ope(OP_CREATE, 100, 150, 1, 1);
    }
    /**
     * Operation= create 
     * min 6000 mx 8000 loop 100 Thread 1
     * @throws Exception
     */   
    public void testShortCreate() throws Exception {
        ope(OP_CREATE, 6000, 8000, 100, 1);
    }
    /**
     * Operation= create 
     * min 9000 mx 9900 loop 1 Threads 12 
     * @throws Exception
     */   
    public void testMultiCreate() throws Exception {
        ope(OP_CREATE, 9000, 9900, 1, 12);
    }

    /**
     * Operation= move
     * min 0 mx 5 loop 1 Threads 5
     * @throws Exception
     */   
    public void testMultiMove() throws Exception {
        ope(OP_MOVE, 0, 5, 1, 5);
    }
    
    /**
     * Operation= move
     * min 100 mx 500 loop 100 Threads 20
     * This test can lead to some messages in server:
     * ### Conflict writing entity bean
     * ### possible deadlock
     * @throws Exception
     */   
    public void testMultiMove2() throws Exception {
        ope(OP_MOVE, 0, 19, 100, 20);
    }
    public void testMultiMove3() throws Exception {
        ope(OP_MOVE, 0, 5, 20, 2);
    }
  
     /**
     * Operation= create 
     * min 2000 mx 80000 loop 40 Thread 1
     * @throws Exception
     */
    
    public void testLongCreate() throws Exception {
        ope(OP_CREATE, 20000, 80000, 40, 1);
    }
    
    /**
     * Operation= create 
     * min 10000 mx 50000 loop 20 Threads 4
     * @throws Exception
     */
   
    public void testMultiLongCreate() throws Exception {
        ope(OP_CREATE, 10000, 50000, 20, 4);
  
    }
    
    /**
     * Operation= move on the same acount
     * min 6 mx 6 loop 20 Threads 10 amount 10
     * @throws Exception
     */
    public void testMultiLongSameAccount() throws Exception {
        ope(OP_MOVETO, 6, 6, 20, 10, 10);
    }

    /**
     * Operation= read
     * min range for account nb = 0
     * max range for account nb = 3
     * nb of loop in each thread = 100
     * nb of threads running the same operations = 6
     * verification of base's state
     * @throws Exception
     */
    public void testMultiReaders() throws Exception {
        createOpe(OP_READ, 0, 3, 100, 6);
    }

    /**
     * nb of loop in each thread = 200
     * nb of threads running the same operations = 8
     */
    public void testManyFindPK() throws Exception {
        ope(OP_FINDPK, 0, 9, 200, 8, 0, false, CHECK_YES);
    }

    /**
     * KO in jonas 4.8.6
     * nb of loop in each thread = 200
     * nb of threads running the same operations = 8
     */
    public void testManyFindPKNot() throws Exception {
        ope(OP_FINDPK, accountNb, accountNb + 1, 200, 8, 0, false, CHECK_NO);
    }

}
