/*
 * 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.stests.manac;

import java.rmi.RemoteException;
import javax.ejb.RemoveException;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import javax.transaction.RollbackException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.objectweb.jonas.stests.util.JTestCase;

/**
 * set of testCases used to load the EJBServer
 */
public class F_stress extends A_manac {

    public F_stress(String name) {
	super(name);
    }

    /*
     * no rollback, monothreaded
     */
    public void test_a8_d0_l1200_m1_t1() throws Exception {
	manac(8, 0, 1200, 1, 1);
    }

    /**
     * 2 threads - many loops
     */
    public void test_a8_d0_l600_m1_t2() throws Exception {
	manac(8, 0, 600, 1, 2);
    }

    /**
     * 3 threads - many loops
     */
    public void test_a8_d0_l400_m1_t3() throws Exception {
	manac(8, 0, 400, 1, 3);
    }

    /**
     * 4 threads - many loops
     */
    public void test_a8_d0_l300_m1_t4() throws Exception {
	manac(8, 0, 300, 1, 4);
    }

    /**
     * 6 threads - many loops
     */
    public void _test_a8_d0_l200_m1_t6() throws Exception {
	manac(8, 0, 200, 1, 6);
    }

    /*
     * no rollback, multithreaded
     */
    public void _test_amax_d0_l100_m1_t10() throws Exception {
	manac(maxAccounts, 0, 100, 1, 10);
    }

    /*
     * rollback, monothreaded
     */
    public void test_a4_d0_l1000_m100_t1() throws Exception {
	manac(4, 0, 1000, 100, 1);
    }

    /*
     * rollback, multithreaded
     */
    public void _test_a4_d0_l100_m100_t5() throws Exception {
	manac(4, 0, 100, 100, 5);
    }

    public static Test suite() {
	return new TestSuite(F_stress.class);
    }

    public static void main (String args[]) {
	String testtorun = null;
	// Get args
	for (int argn = 0; argn < args.length; argn++) {
	    String s_arg = args[argn];
	    Integer i_arg;
	    if (s_arg.equals("-n")) {
		testtorun = args[++argn];
	    }
	}
	if (testtorun == null) {
	    junit.textui.TestRunner.run(suite());
	} else {
	    junit.textui.TestRunner.run(new F_stress(testtorun));
	}
    }
}
