01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.test.jbossmq.perf;
23:
24: import junit.textui.TestRunner;
25: import EDU.oswego.cs.dl.util.concurrent.Semaphore;
26:
27: /**
28: * JBossMQPerfStressTestCase.java Some simple tests of JBossMQ
29: *
30: * @author <a href="mailto:hiram.chirino@jboss.org">Hiram Chirino</a>
31: * @version $Revision: 57211 $
32: */
33:
34: public class OILInvocationLayerStressTestCase extends
35: InvocationLayerStressTest {
36: /**
37: * Constructor for the JBossMQPerfStressTestCase object
38: *
39: * @param name Description of Parameter
40: * @exception Exception Description of Exception
41: */
42: public OILInvocationLayerStressTestCase(String name)
43: throws Exception {
44: super (name);
45: }
46:
47: /**
48: * A unit test for JUnit
49: *
50: * @exception Exception Description of Exception
51: */
52: public void testOILMutliSessionOneConnection() throws Exception {
53: getLog().debug("Starting OIL MutliSessionOneConnection test");
54:
55: connect("ConnectionFactory", "ConnectionFactory");
56: queueConnection.start();
57: exitSemaphore = new Semaphore(-WORKER_COUNT);
58: exitSemaphore.release();
59:
60: getLog().debug("Creating workers.");
61: QueueWorker workers[] = new QueueWorker[WORKER_COUNT];
62: for (int i = 0; i < WORKER_COUNT; i++) {
63: workers[i] = new QueueWorker("ConnectionTestQueue-" + i,
64: "OIL");
65: }
66:
67: getLog().debug("Starting workers.");
68: for (int i = 0; i < WORKER_COUNT; i++) {
69: workers[i].start();
70: }
71:
72: getLog().debug("Waiting for workers to finish.");
73: exitSemaphore.acquire();
74:
75: disconnect();
76: getLog().debug("OIL MutliSessionOneConnection passed");
77: }
78:
79: /**
80: * The main entry-point for the JBossMQPerfStressTestCase class
81: *
82: * @param args The command line arguments
83: */
84: public static void main(String[] args) {
85:
86: String newArgs[] = { "org.jboss.test.jbossmq.perf.OILInvocationLayerStressTestCase" };
87: TestRunner.main(newArgs);
88:
89: }
90:
91: }
|