KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > classloader > test > CircularityUnitTestCase


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.classloader.test;
23
24 import javax.management.MBeanServerConnection JavaDoc;
25 import javax.management.ObjectName JavaDoc;
26
27 import junit.extensions.TestSetup;
28 import junit.framework.Test;
29 import junit.framework.TestSuite;
30
31 import org.jboss.test.JBossTestCase;
32 import org.jboss.test.JBossTestSetup;
33
34 /** Unit tests for the org.jboss.mx.loading.UnifiedLoaderRepository
35  * @author Scott.Stark@jboss.org
36  * @version $Revision: 37406 $
37  */

38 public class CircularityUnitTestCase extends JBossTestCase
39 {
40    private static String JavaDoc JMX_NAME = "jboss.test:name=CircularityError";
41    private ObjectName JavaDoc testObjectName;
42    private Object JavaDoc[] args = {};
43    private String JavaDoc[] sig = {};
44    MBeanServerConnection JavaDoc server;
45
46    public CircularityUnitTestCase(String JavaDoc name) throws Exception JavaDoc
47    {
48       super(name);
49       testObjectName = new ObjectName JavaDoc(JMX_NAME);
50       server = getServer();
51    }
52
53    /** Test the UnifiedLoaderRepository for ClassCircularityError
54     */

55    public void testDuplicateClass() throws Exception JavaDoc
56    {
57       server.invoke(testObjectName, "testDuplicateClass", args, sig);
58    }
59    public void testUCLOwner() throws Exception JavaDoc
60    {
61       server.invoke(testObjectName, "testUCLOwner", args, sig);
62    }
63    public void testMissingSuperClass() throws Exception JavaDoc
64    {
65       server.invoke(testObjectName, "testMissingSuperClass", args, sig);
66    }
67    public void testLoading() throws Exception JavaDoc
68    {
69       server.invoke(testObjectName, "testLoading", args, sig);
70    }
71    public void testPackageProtected() throws Exception JavaDoc
72    {
73       server.invoke(testObjectName, "testPackageProtected", args, sig);
74    }
75    public void testDeadlockCase1() throws Exception JavaDoc
76    {
77       server.invoke(testObjectName, "testDeadlockCase1", args, sig);
78    }
79    public void testRecursiveLoadMT() throws Exception JavaDoc
80    {
81       server.invoke(testObjectName, "testRecursiveLoadMT", args, sig);
82    }
83
84    /**
85     * Setup the test suite.
86     */

87    public static Test suite() throws Exception JavaDoc
88    {
89       TestSuite suite = new TestSuite();
90       suite.addTest(new TestSuite(CircularityUnitTestCase.class));
91
92       // Create an initializer for the test suite
93
TestSetup wrapper = new JBossTestSetup(suite)
94       {
95          protected void setUp() throws Exception JavaDoc
96          {
97             super.setUp();
98             deploy("circularity.sar");
99          }
100          protected void tearDown() throws Exception JavaDoc
101          {
102             undeploy("circularity.sar");
103             super.tearDown();
104          }
105       };
106       return wrapper;
107    }
108
109 }
110
Popular Tags