[jboss-cvs] JBossAS SVN: r71384 - trunk/testsuite/src/main/org/jboss/test/classloader/leak/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 28 12:26:19 EDT 2008
Author: bstansberry at jboss.com
Date: 2008-03-28 12:26:18 -0400 (Fri, 28 Mar 2008)
New Revision: 71384
Added:
trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/CommonsLoggingClassloaderLeakUnitTestCase.java
Modified:
trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/ClassloaderLeakUnitTestCase.java
Log:
Split the commons-logging classloader leak tests into their own test class
Modified: trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/ClassloaderLeakUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/ClassloaderLeakUnitTestCase.java 2008-03-28 16:18:56 UTC (rev 71383)
+++ trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/ClassloaderLeakUnitTestCase.java 2008-03-28 16:26:18 UTC (rev 71384)
@@ -35,10 +35,6 @@
* of various packages (wars, ejb jars and ears with and without scoped
* classloaders).
* <p/>
- * These tests were originally written to test for leaks caused by Jakarta
- * Commons Logging. As a result, there are various permutations of the tests
- * that store copies of commons-logging in different locations on the classpath.
- * <p/>
* If these tests are run with JBoss Profiler's jbossAgent (.dll or .so) on the path
* and the AS is started with -agentlib:jbossAgent, in case of classloader leakage
* an extensive report will be logged to the server log, showing the path to root of
@@ -49,14 +45,9 @@
public class ClassloaderLeakUnitTestCase extends ClassloaderLeakTestBase
{
private static final String SIMPLE_WAR = "classloader-leak-simple.war";
- private static final String WAR_WITH_JCL = "classloader-leak-in-war.war";
private static final String SIMPLE_EJB = "classloader-leak-ejb.jar";
private static final String SIMPLE_EAR = "classloader-leak-simple.ear";
- private static final String EAR_WITH_JCL = "classloader-leak-in-ear.ear";
private static final String SIMPLE_ISOLATED_EAR = "classloader-leak-simple-isolated.ear";
- private static final String ISOLATED_EAR_WITH_JCL = "classloader-leak-in-ear-isolated.ear";
- private static final String EAR_WITH_DUAL_JCL = "classloader-leak-dual.ear";
- private static final String ISOLATED_EAR_WITH_DUAL_JCL = "classloader-leak-dual-isolated.ear";
private static final String NO_WEB_EAR = "classloader-leak-noweb.ear";
private static final String ISOLATED_NO_WEB_EAR = "classloader-leak-noweb-isolated.ear";
@@ -84,11 +75,6 @@
warTest(SIMPLE_WAR);
}
- public void testWarWithJcl() throws Exception
- {
- warTest(WAR_WITH_JCL);
- }
-
public void testSimpleEjb() throws Exception
{
ejbTest(SIMPLE_EJB);
@@ -99,11 +85,6 @@
earTest(SIMPLE_EAR);
}
- public void testEarWithJcl() throws Exception
- {
- earTest(EAR_WITH_JCL);
- }
-
public void testNoWebEar() throws Exception
{
ejbTest(NO_WEB_EAR);
@@ -119,21 +100,6 @@
ejbTest(ISOLATED_NO_WEB_EAR);
}
- public void testIsolatedEarWithJcl() throws Exception
- {
- earTest(ISOLATED_EAR_WITH_JCL);
- }
-
- public void testEarWithDualJcl() throws Exception
- {
- earTest(EAR_WITH_DUAL_JCL);
- }
-
- public void testIsolatedEarWithDualJcl() throws Exception
- {
- earTest(ISOLATED_EAR_WITH_DUAL_JCL);
- }
-
protected String getWarContextPath()
{
return "classloader-leak";
Added: trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/CommonsLoggingClassloaderLeakUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/CommonsLoggingClassloaderLeakUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/classloader/leak/test/CommonsLoggingClassloaderLeakUnitTestCase.java 2008-03-28 16:26:18 UTC (rev 71384)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.classloader.leak.test;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.test.classloader.leak.ejb.interfaces.StatefulSession;
+import org.jboss.test.classloader.leak.ejb.interfaces.StatefulSessionHome;
+import org.jboss.test.classloader.leak.ejb.interfaces.StatelessSession;
+import org.jboss.test.classloader.leak.ejb.interfaces.StatelessSessionHome;
+
+/**
+ * Tests for classloader leaks caused by use of Jakarta Commons Logging.
+ * Checks for classloader leaks following deployment, use and undeployment
+ * of various packages (wars, ejb jars and ears with and without scoped
+ * classloaders). There are various permutations of the tests
+ * that store copies of commons-logging in different locations on the classpath.
+ * <p>
+ * If these tests are run with JBoss Profiler's jbossAgent (.dll or .so) on the path
+ * and the AS is started with -agentlib:jbossAgent, in case of classloader leakage
+ * an extensive report will be logged to the server log, showing the path to root of
+ * all references to the classloader.
+ * <p/>
+ *
+ * @author Brian Stansberry
+ */
+public class CommonsLoggingClassloaderLeakUnitTestCase extends ClassloaderLeakTestBase
+{
+ private static final String WAR_WITH_JCL = "classloader-leak-in-war.war";
+ private static final String EAR_WITH_JCL = "classloader-leak-in-ear.ear";
+ private static final String ISOLATED_EAR_WITH_JCL = "classloader-leak-in-ear-isolated.ear";
+ private static final String EAR_WITH_DUAL_JCL = "classloader-leak-dual.ear";
+ private static final String ISOLATED_EAR_WITH_DUAL_JCL = "classloader-leak-dual-isolated.ear";
+
+ private static final String EJB2_SLSB = "EJB2_SLSB";
+ private static final String EJB2_SFSB = "EJB2_SFSB";
+ private static final String EJB2_SLSB_TCCL = "EJB2_SLSB_TCCL";
+ private static final String EJB2_SFSB_TCCL = "EJB2_SFSB_TCCL";
+
+ private static final String[] EJB2 = new String[]{ EJB2_SLSB, EJB2_SLSB_TCCL, EJB2_SFSB, EJB2_SFSB_TCCL };
+
+
+ public CommonsLoggingClassloaderLeakUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(CommonsLoggingClassloaderLeakUnitTestCase.class, "classloader-leak-test.sar");
+ }
+
+ public void testWarWithJcl() throws Exception
+ {
+ warTest(WAR_WITH_JCL);
+ }
+
+ public void testEarWithJcl() throws Exception
+ {
+ earTest(EAR_WITH_JCL);
+ }
+
+ public void testIsolatedEarWithJcl() throws Exception
+ {
+ earTest(ISOLATED_EAR_WITH_JCL);
+ }
+
+ public void testEarWithDualJcl() throws Exception
+ {
+ earTest(EAR_WITH_DUAL_JCL);
+ }
+
+ public void testIsolatedEarWithDualJcl() throws Exception
+ {
+ earTest(ISOLATED_EAR_WITH_DUAL_JCL);
+ }
+
+ protected String getWarContextPath()
+ {
+ return "classloader-leak";
+ }
+
+ protected String[] getEjbKeys()
+ {
+ return EJB2;
+ }
+
+ protected void makeEjbRequests() throws Exception
+ {
+ InitialContext ctx = new InitialContext();
+ StatelessSessionHome slsbhome = (StatelessSessionHome) ctx.lookup("ClassloaderLeakStatelessSession");
+ StatelessSession slsbbean = slsbhome.create();
+ slsbbean.log("EJB");
+ StatefulSessionHome sfsbhome = (StatefulSessionHome) ctx.lookup("ClassloaderLeakStatefulSession");
+ StatefulSession sfsbbean = sfsbhome.create();
+ sfsbbean.log("EJB");
+ }
+}
More information about the jboss-cvs-commits
mailing list