KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * 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: 37406 $
32  */

33
34 public class UIL2InvocationLayerStressTestCase extends InvocationLayerStressTest
35 {
36    /**
37     * Constructor for the JBossMQPerfStressTestCase object
38     *
39     * @param name Description of Parameter
40     * @exception Exception Description of Exception
41     */

42    public UIL2InvocationLayerStressTestCase(String JavaDoc name) throws Exception JavaDoc
43    {
44       super(name);
45    }
46
47
48    /**
49     * A unit test for JUnit
50     *
51     * @exception Exception Description of Exception
52     */

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

87    public static void main(String JavaDoc[] args)
88    {
89
90       String JavaDoc newArgs[] = {"org.jboss.test.jbossmq.perf.UIL2InvocationLayerStressTestCase"};
91       TestRunner.main(newArgs);
92
93    }
94
95 }
96
Popular Tags