[jboss-cvs] JBossAS SVN: r94934 - in projects/jboss-deployers/trunk/deployers-vfs/src/test: java/org/jboss/test/deployers/vfs/classpool/test and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 15 04:37:20 EDT 2009
Author: alesj
Date: 2009-10-15 04:37:19 -0400 (Thu, 15 Oct 2009)
New Revision: 94934
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/PoolFactoryInitializer.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.xml
Log:
Delegate the Module tracking to MC.
TODO - the tests are still failing.
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/PoolFactoryInitializer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/PoolFactoryInitializer.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/PoolFactoryInitializer.java 2009-10-15 08:37:19 UTC (rev 94934)
@@ -0,0 +1,49 @@
+/*
+ * 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.support;
+
+import javassist.scopedpool.ScopedClassPoolFactory;
+import org.jboss.classpool.spi.ClassPoolRepository;
+import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.classpool.RepositoryClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PoolFactoryInitializer
+{
+ private ScopedClassPoolFactory poolFactory;
+
+ public PoolFactoryInitializer(ScopedClassPoolFactory poolFactory)
+ {
+ this.poolFactory = poolFactory;
+ }
+
+ public void start()
+ {
+ ClassPoolRepository repository = ClassPoolRepository.getInstance();
+ repository.setClassPoolFactory(poolFactory);
+ ClassPoolFactory classPoolFactory = new RepositoryClassPoolFactory(repository);
+ JavassistTypeInfoFactoryImpl.setPoolFactory(classPoolFactory);
+ }
+}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java 2009-10-15 08:25:25 UTC (rev 94933)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java 2009-10-15 08:37:19 UTC (rev 94934)
@@ -23,18 +23,10 @@
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;
@@ -62,11 +54,6 @@
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();
}
@@ -92,7 +79,8 @@
assertLoadClass(className, classLoader);
TypeInfo typeInfo = typeInfoFactory.getTypeInfo(className, classLoader);
assertEquals(className, typeInfo.getName());
- assertEquals(classLoader, typeInfo.getClassLoader());
+ ClassLoader cl = typeInfo.getClassLoader();
+ assertEquals(classLoader, cl);
}
}
finally
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.xml 2009-10-15 08:25:25 UTC (rev 94933)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.xml 2009-10-15 08:37:19 UTC (rev 94934)
@@ -3,4 +3,30 @@
<bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
<bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+ <bean name="ClassLoaderScopingPolicy" class="org.jboss.classpool.plugins.as5.VFSClassLoaderDomainRegistry"/>
+
+ <bean name="RegisterModuleCallback" class="org.jboss.classpool.plugins.as5.RegisterModuleCallback">
+ <install method="addModuleRegistry" bean="ClassLoading" whenRequired="Start">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall method="removeModuleRegistry" bean="ClassLoading" whenRequired="Start">
+ <parameter><this/></parameter>
+ </uninstall>
+ <incallback method="addModule" state="Installed"/>
+ <uncallback method="removeModule" state="Installed"/>
+ </bean>
+
+ <bean name="ClassPoolFactory" class="org.jboss.classpool.plugins.as5.jbosscl.JBossClDelegatingClassPoolFactory">
+ <constructor>
+ <parameter><inject bean="ClassLoaderScopingPolicy"/></parameter>
+ <parameter><inject bean="RegisterModuleCallback"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="PoolFactoryInitializer" class="org.jboss.test.deployers.vfs.classpool.support.PoolFactoryInitializer">
+ <constructor>
+ <parameter><inject bean="ClassPoolFactory"/></parameter>
+ </constructor>
+ </bean>
+
</deployment>
More information about the jboss-cvs-commits
mailing list