[jboss-cvs] JBossAS SVN: r94925 - projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 15 03:21:26 EDT 2009
Author: alesj
Date: 2009-10-15 03:21:26 -0400 (Thu, 15 Oct 2009)
New Revision: 94925
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java
Log:
Extract CLPool test.
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java (from rev 94924, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java 2009-10-15 07:21:26 UTC (rev 94925)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.deployers.vfs.classpool.test;
+
+import java.util.Set;
+
+import javassist.scopedpool.ScopedClassPoolFactory;
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.classpool.plugins.as5.RegisterModuleCallback;
+import org.jboss.classpool.plugins.as5.VFSClassLoaderDomainRegistry;
+import org.jboss.classpool.plugins.as5.jbosscl.JBossClDelegatingClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl;
+import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.classpool.RepositoryClassPoolFactory;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Abstract test for ClassPool.
+ *
+ * @author <a href="mailto:flavia.rainone at jboss.com">Flavia Rainone</a>
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ *
+ * @version $Revision$
+ */
+public abstract class ClassPoolTest extends BootstrapDeployersTest
+{
+ protected ClassPoolTest(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ // excluding class that knows hot to load from system classloader
+ Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
+ excluded.add(BeanMetaDataFactoryVisitor.class);
+
+ ScopedClassPoolFactory scopedClassPoolFactory = new JBossClDelegatingClassPoolFactory(new VFSClassLoaderDomainRegistry(), new RegisterModuleCallback());
+ ClassPoolRepository repository = ClassPoolRepository.getInstance();
+ repository.setClassPoolFactory(scopedClassPoolFactory);
+ ClassPoolFactory classPoolFactory = new RepositoryClassPoolFactory(repository);
+ JavassistTypeInfoFactoryImpl.setPoolFactory(classPoolFactory);
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ // reverting exclusion performed on setUp
+ Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
+ excluded.remove(BeanMetaDataFactoryVisitor.class);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void assertClassPool(VirtualFile file, Class<?> ... classes) throws Exception
+ {
+ DeploymentUnit unit = assertDeploy(file);
+ try
+ {
+ ClassLoader classLoader = getClassLoader(unit);
+ for (Class<?> clazz: classes)
+ {
+ String className = clazz.getName();
+ assertLoadClass(className, classLoader);
+ TypeInfoFactory typeInfoFactory = new JavassistTypeInfoFactory();
+ TypeInfo typeInfo = typeInfoFactory.getTypeInfo(className, classLoader);
+ assertEquals(className, typeInfo.getName());
+ assertEquals(classLoader, typeInfo.getType().getClassLoader());
+ }
+ }
+ finally
+ {
+ undeploy(unit);
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java 2009-10-15 06:54:35 UTC (rev 94924)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java 2009-10-15 07:21:26 UTC (rev 94925)
@@ -21,24 +21,7 @@
*/
package org.jboss.test.deployers.vfs.classpool.test;
-import java.util.Set;
-
-import javassist.scopedpool.ScopedClassPoolFactory;
import junit.framework.Test;
-
-import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
-import org.jboss.classpool.plugins.as5.RegisterModuleCallback;
-import org.jboss.classpool.plugins.as5.VFSClassLoaderDomainRegistry;
-import org.jboss.classpool.plugins.as5.jbosscl.JBossClDelegatingClassPoolFactory;
-import org.jboss.classpool.spi.ClassPoolRepository;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
-import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl;
-import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
-import org.jboss.reflect.plugins.javassist.classpool.RepositoryClassPoolFactory;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.reflect.spi.TypeInfoFactory;
-import org.jboss.test.deployers.BootstrapDeployersTest;
import org.jboss.test.deployers.vfs.classpool.support.crm.CrmFacade;
import org.jboss.test.deployers.vfs.classpool.support.ejb.MySLSBean;
import org.jboss.test.deployers.vfs.classpool.support.ext.External;
@@ -57,42 +40,18 @@
*
* @version $Revision$
*/
-public class ClassPoolTestCase extends BootstrapDeployersTest
+public class ClassPoolTestCase extends ClassPoolTest
{
public ClassPoolTestCase(String name)
{
super(name);
}
-
+
public static Test suite()
{
return suite(ClassPoolTestCase.class);
}
- @Override
- protected void setUp() throws Exception
- {
- // excluding class that knows hot to load from system classloader
- Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
- excluded.add(BeanMetaDataFactoryVisitor.class);
-
- ScopedClassPoolFactory scopedClassPoolFactory = new JBossClDelegatingClassPoolFactory(new VFSClassLoaderDomainRegistry(), new RegisterModuleCallback());
- ClassPoolRepository repository = ClassPoolRepository.getInstance();
- repository.setClassPoolFactory(scopedClassPoolFactory);
- ClassPoolFactory classPoolFactory = new RepositoryClassPoolFactory(repository);
- JavassistTypeInfoFactoryImpl.setPoolFactory(classPoolFactory);
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
- // reverting exclusion performed on setUp
- Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
- excluded.remove(BeanMetaDataFactoryVisitor.class);
- }
-
public void testJar() throws Exception
{
AssembledDirectory directory = createJar();
@@ -260,28 +219,4 @@
return ear;
}
-
- @SuppressWarnings("deprecation")
- private void assertClassPool(AssembledDirectory directory, Class<?> ... classes)
- throws Exception
- {
- DeploymentUnit unit = assertDeploy(directory);
- try
- {
- ClassLoader classLoader = getClassLoader(unit);
- for (Class<?> clazz: classes)
- {
- String className = clazz.getName();
- assertLoadClass(className, classLoader);
- TypeInfoFactory typeInfoFactory = new JavassistTypeInfoFactoryImpl();
- TypeInfo typeInfo = typeInfoFactory.getTypeInfo(className, classLoader);
- assertEquals(className, typeInfo.getName());
- assertEquals(classLoader, typeInfo.getType().getClassLoader());
- }
- }
- finally
- {
- undeploy(unit);
- }
- }
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list