KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > jbossmq > perf > OILInvocationLayerStressTestCase


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.jbossmq.perf;
8
9 import javax.jms.*;
10
11 import javax.management.ObjectName JavaDoc;
12 import javax.naming.Context JavaDoc;
13 import javax.naming.InitialContext JavaDoc;
14 import junit.textui.TestRunner;
15
16 import org.apache.log4j.Category;
17
18 import org.jboss.test.JBossTestCase;
19
20 import EDU.oswego.cs.dl.util.concurrent.Semaphore;
21
22 /**
23  * JBossMQPerfStressTestCase.java Some simple tests of JBossMQ
24  *
25  * @author <a HREF="mailto:hiram.chirino@jboss.org">Hiram Chirino</a>
26  * @version $Revision: 1.2 $
27  */

28
29 public class OILInvocationLayerStressTestCase extends InvocationLayerStressTest
30 {
31    /**
32     * Constructor for the JBossMQPerfStressTestCase object
33     *
34     * @param name Description of Parameter
35     * @exception Exception Description of Exception
36     */

37    public OILInvocationLayerStressTestCase(String JavaDoc name) throws Exception JavaDoc
38    {
39       super(name);
40    }
41
42
43    /**
44     * A unit test for JUnit
45     *
46     * @exception Exception Description of Exception
47     */

48    public void testOILMutliSessionOneConnection() throws Exception JavaDoc
49    {
50       getLog().debug("Starting OIL MutliSessionOneConnection test");
51
52       connect("ConnectionFactory", "ConnectionFactory");
53       queueConnection.start();
54       exitSemaphore = new Semaphore(-WORKER_COUNT);
55       exitSemaphore.release();
56
57       getLog().debug("Creating workers.");
58       QueueWorker workers[] = new QueueWorker[WORKER_COUNT];
59       for (int i = 0; i < WORKER_COUNT; i++)
60       {
61          workers[i] = new QueueWorker("ConnectionTestQueue-" + i, "OIL");
62       }
63
64       getLog().debug("Starting workers.");
65       for (int i = 0; i < WORKER_COUNT; i++)
66       {
67          workers[i].start();
68       }
69
70       getLog().debug("Waiting for workers to finish.");
71       exitSemaphore.acquire();
72
73       disconnect();
74       getLog().debug("OIL MutliSessionOneConnection passed");
75    }
76
77    /**
78     * The main entry-point for the JBossMQPerfStressTestCase class
79     *
80     * @param args The command line arguments
81     */

82    public static void main(String JavaDoc[] args)
83    {
84
85       String JavaDoc newArgs[] = {"org.jboss.test.jbossmq.perf.OILInvocationLayerStressTestCase"};
86       TestRunner.main(newArgs);
87
88    }
89
90 }
91
Popular Tags