FileDocCategorySizeDatePackage
SessionTestCase.javaAPI DocApache Axis 1.43728Sat Apr 22 18:57:28 BST 2006test.wsdl.session

SessionTestCase

public class SessionTestCase extends TestCase
Class SessionTestCase

Fields Summary
private static Object
lock
Field lock
private static Object
testLock
Field testLock
private static final int
NO_OF_THREADS
Field NO_OF_THREADS
private static final int
NO_OF_CALLS
Field NO_OF_CALLS
private static int
numThreads
Field numThreads
private static int
count
Field count
private static int
failed
Field failed
private static int
succeeded
Field succeeded
Constructors Summary
public SessionTestCase(String name)
Constructor SessionTestCase

param
name

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)
Main entry point for the application. Takes number of threads as argument.

param
args
throws
Exception


                         
           
        numThreads = count = Integer.parseInt(args[0]);
        SessionTestCase testCase = new SessionTestCase("SessionTestCase");
        testCase.test1SessionTestDoSomething();
    
public voidtest1SessionTestDoSomething()
Method test1SessionTestDoSomething

        // Threads array
        SessionTest[] clients = new SessionTest[numThreads];

        for (int i = 0; i < numThreads; i++) {
            clients[i] = new SessionTest();
        }
        for (int j = 0; j < numThreads; j++) {
            clients[j].start();
            try {
                Thread.currentThread().sleep(150);
            } catch (InterruptedException e) {
                System.out.println("Threads interrupted");
            }
        }
        try {
            synchronized (lock) {
                while (count != 0) {
                    lock.wait();
                }
            }
        } catch (InterruptedException ie) {
            System.out.println("Threads interrupted");
        }
        System.out.println("Succeeded " + succeeded + " times.");
        System.out.println("Failed " + failed + " times.");
        assertTrue("found session failures", (failed == 0));