[jboss-cvs] JBossAS SVN: r82447 - in projects/aop/trunk/asintegration-mc/src: resources/tests/org/jboss/test/aop/classpool and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 19 11:45:02 EST 2008
Author: kabir.khan at jboss.com
Date: 2008-12-19 11:45:02 -0500 (Fri, 19 Dec 2008)
New Revision: 82447
Added:
projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/
projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/jbosscl/
projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/jbosscl/Common.xml
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
Removed:
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockDeploymentUnit.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockModuleFactory.java
Modified:
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithRepositorySanityTestCase.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java
projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java
Log:
[JBAOP-666]
Modify test setup to use VFSClassLoaderFactory and deploy that into the MC to create the Modules and classloaders as is done in the jboss-cl tests. This replaces my previous attempt at trying to mock a deployment to set up a VFSDeploymentClassLoaderModule, since that would not work once we start using requirements/capabilities as they map onto real MC dependencies
Added: projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/jbosscl/Common.xml
===================================================================
--- projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/jbosscl/Common.xml (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/resources/tests/org/jboss/test/aop/classpool/jbosscl/Common.xml 2008-12-19 16:45:02 UTC (rev 82447)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
+ <constructor factoryClass="org.jboss.test.aop.classpool.jbosscl.test.JBossClClassPoolTest" factoryMethod="getSystem"/>
+ </bean>
+
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured"/>
+ <uncallback method="removeModule" state="Configured"/>
+ </bean>
+
+ <!-- bean name="SchemaResolverConfig" class="org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverConfig">
+ <property name="bindingClasses">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+ <key>urn:jboss:classloader:1.0</key>
+ <value>org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10</value>
+ </entry>
+ </map>
+ </property>
+ </bean -->
+
+</deployment>
Deleted: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockDeploymentUnit.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockDeploymentUnit.java 2008-12-19 16:00:48 UTC (rev 82446)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockDeploymentUnit.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -1,546 +0,0 @@
-/*
-* 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.aop.classpool.jbosscl.support;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
-
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.dependency.spi.CallbackItem;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.dependency.spi.ErrorHandlingMode;
-import org.jboss.dependency.spi.LifecycleCallbackItem;
-import org.jboss.dependency.spi.ScopeInfo;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitVisitor;
-import org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer;
-import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.MutableMetaData;
-import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.util.JBossObject;
-import org.jboss.util.id.GUID;
-import org.jboss.virtual.MemoryFileFactory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-class MockDeploymentUnit implements DeploymentUnit
-{
- private static final long serialVersionUID = 1L;
-
- String name;
-
- Map<String, Object> attachments = new HashMap<String, Object>();
-
- public MockDeploymentUnit(String name, ClassLoadingMetaData clmd, URL... urls) throws Exception
- {
- this.name = name;
-
- List<VirtualFile> roots = new ArrayList<VirtualFile>();
- //Prepend the dynamic URL to the classpath
- VirtualFile dynamicClasses = getInMemoryClassesURL();
- roots.add(dynamicClasses);
- for (URL url : urls)
- {
- VirtualFile file = VFS.getRoot(url);
- roots.add(file);
- }
- addAttachment(VFSClassLoaderClassPathDeployer.VFS_CLASS_PATH, roots);
-
- addAttachment(ControllerContext.class, new MockControllerContext());
- addAttachment(ClassLoadingMetaData.class, clmd);
- }
-
- private VirtualFile getInMemoryClassesURL() throws Exception
- {
- URL dynamicClassRoot = new URL("vfsmemory", GUID.asString(), "");
- VirtualFile classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
- addAttachment(InMemoryClassesDeployer.DYNAMIC_CLASS_URL_KEY, dynamicClassRoot);
- addAttachment(InMemoryClassesDeployer.DYNAMIC_CLASS_KEY, classes);
- return classes;
- }
-
- public DeploymentUnit addComponent(String name)
- {
- return null;
- }
-
- public void addControllerContextName(Object name)
- {
- }
-
- public void addIDependOn(DependencyItem dependency)
- {
- }
-
- public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException
- {
- return false;
- }
-
- public <T> Set<? extends T> getAllMetaData(Class<T> type)
- {
- return null;
- }
-
- public List<DeploymentUnit> getChildren()
- {
- return null;
- }
-
- public ClassLoader getClassLoader()
- {
- return null;
- }
-
- public DeploymentUnit getComponent(String name)
- {
- return null;
- }
-
- public List<DeploymentUnit> getComponents()
- {
- return null;
- }
-
- public Set<Object> getControllerContextNames()
- {
- return null;
- }
-
- public DependencyInfo getDependencyInfo()
- {
- return null;
- }
-
- public MainDeployer getMainDeployer()
- {
- return null;
- }
-
- public MetaData getMetaData()
- {
- return null;
- }
-
- public MutableMetaData getMutableMetaData()
- {
- return null;
- }
-
- public ScopeKey getMutableScope()
- {
- return null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public DeploymentUnit getParent()
- {
- return null;
- }
-
- public String getRelativePath()
- {
- return null;
- }
-
- public ClassLoader getResourceClassLoader()
- {
- return null;
- }
-
- public DeploymentResourceLoader getResourceLoader()
- {
- return null;
- }
-
- public ScopeKey getScope()
- {
- return null;
- }
-
- public String getSimpleName()
- {
- return null;
- }
-
- public DeploymentUnit getTopLevel()
- {
- return this;
- }
-
- public MutableAttachments getTransientManagedObjects()
- {
- return null;
- }
-
- public boolean isComponent()
- {
- return false;
- }
-
- public boolean isTopLevel()
- {
- return false;
- }
-
- public void removeClassLoader(ClassLoaderFactory factory)
- {
- }
-
- public boolean removeComponent(String name)
- {
- return false;
- }
-
- public void removeControllerContextName(Object name)
- {
- }
-
- public void removeIDependOn(DependencyItem dependency)
- {
- }
-
- public void setMutableScope(ScopeKey key)
- {
- }
-
- public void setScope(ScopeKey key)
- {
- }
-
- public void visit(DeploymentUnitVisitor visitor) throws DeploymentException
- {
- }
-
- public Object addAttachment(String name, Object attachment)
- {
- return attachments.put(name, attachment);
- }
-
- public <T> T addAttachment(Class<T> type, T attachment)
- {
- return (T)attachments.put(type.getName(), attachment);
- }
-
- public <T> T addAttachment(String name, T attachment, Class<T> expectedType)
- {
- return (T)attachments.put(name, attachment);
- }
-
- public void clear()
- {
- }
-
- public void clearChangeCount()
- {
- }
-
- public int getChangeCount()
- {
- return 0;
- }
-
- public Object removeAttachment(String name)
- {
- return attachments.remove(name);
- }
-
- public <T> T removeAttachment(Class<T> type)
- {
- return (T)attachments.remove(type.getName());
- }
-
- public <T> T removeAttachment(String name, Class<T> expectedType)
- {
- return (T)attachments.remove(name);
- }
-
- public void setAttachments(Map<String, Object> map)
- {
- attachments = map;
- }
-
- public Object getAttachment(String name)
- {
- return attachments.get(name);
- }
-
- public <T> T getAttachment(Class<T> type)
- {
- return (T)attachments.get(type.getName());
- }
-
- public <T> T getAttachment(String name, Class<T> expectedType)
- {
- return (T)attachments.get(name);
- }
-
- public Map<String, Object> getAttachments()
- {
- return attachments;
- }
-
- public boolean hasAttachments()
- {
- return attachments.size() > 0;
- }
-
- public boolean isAttachmentPresent(String name)
- {
- return attachments.keySet().contains(name);
- }
-
- public boolean isAttachmentPresent(Class<?> type)
- {
- return attachments.keySet().contains(type.getName());
- }
-
- public boolean isAttachmentPresent(String name, Class<?> expectedType)
- {
- return attachments.keySet().contains(name);
- }
-
- private class MockControllerContext extends JBossObject implements ControllerContext
- {
- DependencyInfo dependencies = new MockDependencyInfo();
- public Set<Object> getAliases()
- {
- return null;
- }
-
- public Controller getController()
- {
- return null;
- }
-
- public DependencyInfo getDependencyInfo()
- {
- return dependencies;
- }
-
- public Throwable getError()
- {
- return null;
- }
-
- public ErrorHandlingMode getErrorHandlingMode()
- {
- return null;
- }
-
- public ControllerMode getMode()
- {
- return null;
- }
-
- public Object getName()
- {
- return name;
- }
-
- public ControllerState getRequiredState()
- {
- return null;
- }
-
- public ScopeInfo getScopeInfo()
- {
- return null;
- }
-
- public ControllerState getState()
- {
- return null;
- }
-
- public Object getTarget()
- {
- return null;
- }
-
- public void install(ControllerState fromState, ControllerState toState) throws Throwable
- {
- }
-
- public void setController(Controller controller)
- {
- }
-
- public void setError(Throwable error)
- {
- }
-
- public void setMode(ControllerMode mode)
- {
- }
-
- public void setRequiredState(ControllerState state)
- {
- }
-
- public void setState(ControllerState state)
- {
- }
-
- public void uninstall(ControllerState fromState, ControllerState toState)
- {
- }
- }
-
- private class MockDependencyInfo extends JBossObject implements DependencyInfo
- {
- private Set<DependencyItem> dependsOnMe = new HashSet<DependencyItem>();
- private Set<DependencyItem> iDependOn = new HashSet<DependencyItem>();
- private Set<DependencyItem> unresolved = new CopyOnWriteArraySet<DependencyItem>();
-
- public void addDependsOnMe(DependencyItem dependency)
- {
- dependsOnMe.add(dependency);
- }
-
- public void addIDependOn(DependencyItem dependency)
- {
- iDependOn.add(dependency);
- }
-
- public <T> void addInstallItem(CallbackItem<T> callbackItem)
- {
- throw new RuntimeException("NYI");
- }
-
- public void addLifecycleCallback(LifecycleCallbackItem lifecycleCallbackItem)
- {
- throw new RuntimeException("NYI");
- }
-
- public <T> void addUninstallItem(CallbackItem<T> callbackItem)
- {
- throw new RuntimeException("NYI");
- }
-
- public Set<DependencyItem> getDependsOnMe(Class<?> type)
- {
- return dependsOnMe;
- }
-
- public Set<DependencyItem> getIDependOn(Class<?> type)
- {
- return iDependOn;
- }
-
- public Set<CallbackItem<?>> getInstallItems()
- {
- throw new RuntimeException("NYI");
- }
-
- public List<LifecycleCallbackItem> getLifecycleCallbacks()
- {
- throw new RuntimeException("NYI");
- }
-
- public Set<CallbackItem<?>> getUninstallItems()
- {
- throw new RuntimeException("NYI");
- }
-
- public boolean isAutowireCandidate()
- {
- return false;
- }
-
- public void removeDependsOnMe(DependencyItem dependency)
- {
- dependsOnMe.remove(dependency);
- }
-
- public void removeIDependOn(DependencyItem dependency)
- {
- iDependOn.remove(dependency);
- }
-
- public <T> void removeInstallItem(CallbackItem<T> callbackItem)
- {
- throw new RuntimeException("NYI");
- }
-
- public <T> void removeUninstallItem(CallbackItem<T> callbackItem)
- {
- throw new RuntimeException("NYI");
- }
-
- public void setAutowireCandidate(boolean candidate)
- {
- throw new RuntimeException("NYI");
- }
-
- public boolean resolveDependencies(Controller controller, ControllerState state)
- {
- boolean resolved = true;
- Set<DependencyItem> items = getUnresolvedDependencies(state);
- if (items.isEmpty() == false)
- {
- for (DependencyItem item : items)
- {
- if (item.resolve(controller) == false)
- resolved = false;
- }
- }
- return resolved;
- }
-
- public Set<DependencyItem> getUnresolvedDependencies(ControllerState state)
- {
- if (unresolved.isEmpty())
- return Collections.emptySet();
-
- Set<DependencyItem> result = new HashSet<DependencyItem>();
- for (DependencyItem item : unresolved)
- {
- if (state == null || state.equals(item.getWhenRequired()))
- result.add(item);
- }
- return result;
- }
- }
-}
\ No newline at end of file
Deleted: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockModuleFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockModuleFactory.java 2008-12-19 16:00:48 UTC (rev 82446)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/MockModuleFactory.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -1,110 +0,0 @@
-/*
-* 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.aop.classpool.jbosscl.support;
-
-import java.net.URL;
-
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.ExportAll;
-import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class MockModuleFactory
-{
- public static ClassLoaderPolicyModule createModule(String name, boolean importAll, URL... urls) throws Exception
- {
- return createModule(name, importAll, null, false, urls);
- }
-
- public static ClassLoaderPolicyModule createModule(String name, BundleInfoBuilder builder, URL... urls) throws Exception
- {
- return createModule(name, false, null, null, builder, false, urls);
- }
-
- public static ClassLoaderPolicyModule createModule(String name, boolean importAll, String moduleName, URL... urls) throws Exception
- {
- return createModule(name, importAll, null, false, urls);
- }
-
- public static ClassLoaderPolicyModule createModule(String name, boolean importAll, String domainName, boolean parentFirst, URL... urls) throws Exception
- {
- return createModule(name, importAll, domainName, null, parentFirst, urls);
- }
-
- public static ClassLoaderPolicyModule createModule(String name, boolean importAll, String domainName, String parentDomainName, boolean parentFirst, URL... urls) throws Exception
- {
- return createModule(name, importAll, domainName, parentDomainName, null, parentFirst, urls);
- }
-
- public static ClassLoaderPolicyModule createModule(String name, boolean importAll, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
- {
- ClassLoadingMetaData md = new ClassLoadingMetaData();
- md.setName(name);
- md.setImportAll(importAll);
- if (importAll)
- {
- md.setExportAll(ExportAll.NON_EMPTY);
- }
-
- addCapabilitiesAndRequirements(md, builder);
- setupDomain(md, domainName, parentDomainName, parentFirst);
-
- MockDeploymentUnit du = new MockDeploymentUnit(name, md, urls);
- return new VFSDeploymentClassLoaderPolicyModule(du);
- }
-
- private static void addCapabilitiesAndRequirements(ClassLoadingMetaData md, BundleInfoBuilder builder)
- {
- if (builder != null)
- {
- md.getCapabilities().setCapabilities(builder.getCapabilities());
- md.getRequirements().setRequirements(builder.getRequirements());
- }
- }
-
- private static void setupDomain(ClassLoadingMetaData md, String domainName, String parentDomainName, boolean parentFirst)
- {
- if (domainName != null)
- {
- md.setDomain(domainName);
- md.setJ2seClassLoadingCompliance(parentFirst);
- if (parentDomainName != null)
- {
- md.setParentDomain(parentDomainName);
- }
- else
- {
- md.setParentDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
- }
- }
- else
- {
- md.setDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
- }
- }
-}
Added: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactory.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -0,0 +1,104 @@
+/*
+* 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.aop.classpool.jbosscl.support;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestVFSClassLoaderFactory extends VFSClassLoaderFactory
+{
+ private static final long serialVersionUID = 1L;
+
+ private ClassLoader parent;
+
+ @Override
+ protected Class<? extends VFSClassLoaderPolicyModule> getModuleClass()
+ {
+ return TestVFSClassLoaderPolicyModule.class;
+ }
+
+ public void setParent(ClassLoader parent)
+ {
+ this.parent = parent;
+ }
+
+ @Override
+ public List<BeanMetaData> getBeans()
+ {
+
+ List<BeanMetaData> result = super.getBeans();
+ if (parent != null)
+ {
+ //We need to modify the Module factory method used to create the classloader to pass in the parent
+ if (result.size() != 2)
+ {
+ throw new IllegalStateException("Expected size=2, was " + result.size());
+ }
+
+ BeanMetaData classLoader = null;
+ BeanMetaData module = null;
+ for (BeanMetaData bean : result)
+ {
+ if (bean.getBean().equals(ClassLoader.class.getName()))
+ {
+ classLoader = bean;
+ }
+ else
+ {
+ module = bean;
+ }
+ }
+
+ if (module == null)
+ {
+ throw new IllegalStateException("Could not find module");
+ }
+ if (classLoader == null)
+ {
+ throw new IllegalStateException("Could not find module");
+ }
+
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(classLoader.getName(), ClassLoader.class.getName());
+ builder.setNoClassLoader();
+ builder.setFactory(module.getName());
+ builder.setFactoryMethod("registerClassLoaderPolicy");
+ builder.addConstructorParameter(ClassLoaderSystem.class.getName(), builder.createInject(getClassLoaderSystemName()));
+ builder.addConstructorParameter(ClassLoader.class.getName(), parent);
+ classLoader = builder.getBeanMetaData();
+
+ result = Arrays.asList(classLoader, module);
+ }
+
+ return result;
+ }
+}
Added: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderFactoryFactory.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -0,0 +1,119 @@
+/*
+* 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.aop.classpool.jbosscl.support;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestVFSClassLoaderFactoryFactory
+{
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, null, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, BundleInfoBuilder builder, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, false, null, null, builder, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String moduleName, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, null, false, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, domainName, null, parentFirst, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, boolean parentFirst, URL... urls) throws Exception
+ {
+ return createClassLoaderFactory(name, importAll, domainName, parentDomainName, null, parentFirst, urls);
+ }
+
+ public static TestVFSClassLoaderFactory createClassLoaderFactory(String name, boolean importAll, String domainName, String parentDomainName, BundleInfoBuilder builder, boolean parentFirst, URL... urls) throws Exception
+ {
+ TestVFSClassLoaderFactory factory = new TestVFSClassLoaderFactory();
+ factory.setName(name);
+ factory.setImportAll(importAll);
+ if (importAll)
+ {
+ factory.setExportAll(ExportAll.NON_EMPTY);
+ }
+ factory.setRoots(urlsToStringList(urls));
+ addCapabilitiesAndRequirements(factory, builder);
+ setupDomain(factory, domainName, parentDomainName, parentFirst);
+ return factory;
+ }
+
+ private static void addCapabilitiesAndRequirements(ClassLoadingMetaData md, BundleInfoBuilder builder)
+ {
+ if (builder != null)
+ {
+ md.getCapabilities().setCapabilities(builder.getCapabilities());
+ md.getRequirements().setRequirements(builder.getRequirements());
+ }
+ }
+
+ private static void setupDomain(ClassLoadingMetaData md, String domainName, String parentDomainName, boolean parentFirst)
+ {
+ if (domainName != null)
+ {
+ md.setDomain(domainName);
+ md.setJ2seClassLoadingCompliance(parentFirst);
+ if (parentDomainName != null)
+ {
+ md.setParentDomain(parentDomainName);
+ }
+ else
+ {
+ md.setParentDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
+ }
+ }
+ else
+ {
+ md.setDomain(ClassLoaderSystem.DEFAULT_DOMAIN_NAME);
+ }
+ }
+
+ private static List<String> urlsToStringList(URL... urls)
+ {
+ List<String> urlList = new ArrayList<String>(urls.length);
+ for (URL url : urls)
+ {
+ urlList.add(url.toString());
+ }
+ return urlList;
+ }
+
+}
Added: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java (rev 0)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/support/TestVFSClassLoaderPolicyModule.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -0,0 +1,92 @@
+/*
+* 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.aop.classpool.jbosscl.support;
+
+import java.net.URL;
+
+import org.jboss.classloading.spi.vfs.dependency.VFSClassLoaderPolicyModule;
+import org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory;
+import org.jboss.util.id.GUID;
+import org.jboss.virtual.MemoryFileFactory;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestVFSClassLoaderPolicyModule extends VFSClassLoaderPolicyModule
+{
+ private static final long serialVersionUID = 1;
+
+ /** In AS we need a URL to create the temporary files */
+ URL dynamicClassRoot;
+ VirtualFile classes;
+
+ public TestVFSClassLoaderPolicyModule(VFSClassLoaderFactory classLoadingMetaData, String contextName)
+ {
+ // FIXME TesetMockClassLoaderPolicyModule constructor
+ super(classLoadingMetaData, contextName);
+ }
+
+ /**
+ * Get/Create the vfs memory file where we will create dynamic classes
+ */
+ @Override
+ public URL getDynamicClassRoot()
+ {
+ initDynamicClassRoot();
+ return dynamicClassRoot;
+ }
+
+ /**
+ * Prepend the dynamic URL location to the classpath
+ */
+ @Override
+ protected VirtualFile[] determineVFSRoots()
+ {
+ initDynamicClassRoot();
+ VirtualFile[] roots = super.determineVFSRoots();
+ VirtualFile[] newRoots = new VirtualFile[roots.length + 1];
+ newRoots[0] = classes;
+ System.arraycopy(roots, 0, newRoots, 1, roots.length);
+
+ return newRoots;
+ }
+
+ private synchronized void initDynamicClassRoot()
+ {
+ if (dynamicClassRoot == null)
+ {
+ try
+ {
+ dynamicClassRoot = new URL("vfsmemory", GUID.asString(), "");
+ classes = MemoryFileFactory.createRoot(dynamicClassRoot).getRoot();
+ }
+ catch (Exception e)
+ {
+ // AutoGenerated
+ throw new RuntimeException(e);
+ }
+ }
+ }
+}
Modified: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithRepositorySanityTestCase.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithRepositorySanityTestCase.java 2008-12-19 16:00:48 UTC (rev 82446)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/ClassLoaderWithRepositorySanityTestCase.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -449,9 +449,9 @@
cl11B = createChildDomainParentFirstClassLoader("11B", domain11, domain1, true, JAR_B_2);
cl11C = createChildDomainParentFirstClassLoader("11C", domain11, domain1, true, JAR_C_2);
final String domain12 = "12";
- cl12A = createChildDomainParentLastClassLoader("11A", domain12, domain1, true, JAR_A_2);
- cl12B = createChildDomainParentLastClassLoader("11B", domain12, domain1, true, JAR_B_2);
- cl12C = createChildDomainParentLastClassLoader("11C", domain12, domain1, true, JAR_C_2);
+ cl12A = createChildDomainParentLastClassLoader("12A", domain12, domain1, true, JAR_A_2);
+ cl12B = createChildDomainParentLastClassLoader("12B", domain12, domain1, true, JAR_B_2);
+ cl12C = createChildDomainParentLastClassLoader("12C", domain12, domain1, true, JAR_C_2);
Class<?> aFrom11A = cl11A.loadClass(CLASS_A);
Class<?> aFrom11B = cl11B.loadClass(CLASS_A);
Class<?> aFrom11C = cl11C.loadClass(CLASS_A);
Modified: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java 2008-12-19 16:00:48 UTC (rev 82446)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTest.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -24,6 +24,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -35,18 +37,23 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.asintegration.jboss5.VFSClassLoaderDomainRegistry;
import org.jboss.aop.classpool.jbosscl.JBossClClassPoolFactory;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
import org.jboss.classloader.plugins.filter.PatternClassFilter;
import org.jboss.classloader.spi.ClassLoaderDomain;
import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.ParentPolicy;
import org.jboss.classloader.spi.filter.ClassFilter;
import org.jboss.classloader.test.support.IsolatedClassLoaderTestHelper;
import org.jboss.classloading.spi.dependency.ClassLoading;
import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
import org.jboss.test.AbstractTestCaseWithSetup;
import org.jboss.test.AbstractTestDelegate;
import org.jboss.test.aop.classpool.jbosscl.support.BundleInfoBuilder;
-import org.jboss.test.aop.classpool.jbosscl.support.MockModuleFactory;
+import org.jboss.test.aop.classpool.jbosscl.support.TestVFSClassLoaderFactory;
+import org.jboss.test.aop.classpool.jbosscl.support.TestVFSClassLoaderFactoryFactory;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
import org.jboss.virtual.VFS;
/**
@@ -55,9 +62,8 @@
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
-public class JBossClClassPoolTest extends AbstractTestCaseWithSetup
+public class JBossClClassPoolTest extends MicrocontainerTest
{
- //These might not be needed with the new loaders
public final static URL JAR_A_1 = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-classpool-a1.jar");
public final static URL JAR_A_2 = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-classpool-a2.jar");
public final static URL JAR_B_1 = getURLRelativeToProjectRoot("target/jboss-aop-asintegration-mc-test-classpool-b1.jar");
@@ -74,14 +80,13 @@
public final static String CLASS_B = PACKAGE_B + ".B";
public final static String CLASS_C = PACKAGE_C + ".C";
- //Keep strong references to the Modules since the domainRegistry only has weak references
- private Set<Module> modules = new HashSet<Module>();
-
//Keep a strong reference to the URL classloaders so that they are not garbage collected
final static Set<URLClassLoader> registeredURLClassLoaders = new HashSet<URLClassLoader>();
private Map<ClassLoader, ClassLoaderDomain> scopedChildDomainsByLoader = new WeakHashMap<ClassLoader, ClassLoaderDomain>();
-
+
+ private Map<ClassLoader, KernelDeployment> deploymentsByLoader = new HashMap<ClassLoader, KernelDeployment>();
+
/** The classloader helper */
//protected static IsolatedClassLoaderTestHelper helper;
protected static final ClassLoaderSystem system = ClassLoaderSystem.getInstance();
@@ -92,11 +97,20 @@
static
{
domainRegistry = new VFSClassLoaderDomainRegistry();
+
AspectManager.setClassPoolFactory(new JBossClClassPoolFactory(domainRegistry));
VFS.init();
}
+
+ public static ClassLoaderSystem getSystem()
+ {
+ ClassLoaderDomain defaultDomain = system.getDefaultDomain();
+ defaultDomain.setParentPolicy(ParentPolicy.BEFORE_BUT_JAVA_ONLY);
+ return system;
+ }
+
public static Test suite(Class<?> clazz)
{
return suite(clazz, new Class[0]);
@@ -162,54 +176,23 @@
}
}
- protected ClassLoaderSystem getSystem()
- {
- return system;
- }
-
protected ClassLoaderDomain getDefaultDomain()
{
- return system.getDefaultDomain();
+ return getSystem().getDefaultDomain();
}
protected ClassLoader createClassLoader(String name, boolean importAll, URL... urls) throws Exception
{
- ClassLoaderPolicyModule module = MockModuleFactory.createModule(name, importAll, urls);
- return createClassLoader(module);
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, urls);
+ return createClassLoader(factory);
}
protected ClassLoader createClassLoader(String name, BundleInfoBuilder builder, URL... urls) throws Exception
{
- ClassLoaderPolicyModule module = MockModuleFactory.createModule(name, builder, urls);
- return createClassLoader(module);
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, builder, urls);
+ return createClassLoader(factory);
}
-
- protected ClassLoader createClassLoader(String name, boolean importAll, String moduleName, URL... urls) throws Exception
- {
- ClassLoaderPolicyModule module = MockModuleFactory.createModule(name, importAll, urls);
- return createClassLoader(module);
- }
-
- protected ClassLoader createClassLoader(String name, boolean importAll, ClassLoader parent, URL... urls) throws Exception
- {
- ClassLoaderPolicyModule module = MockModuleFactory.createModule(name, importAll, urls);
- return createClassLoader(module, parent);
- }
-
- protected ClassLoader createClassLoader(ClassLoaderPolicyModule module)
- {
- return createClassLoader(module, null);
- }
-
- protected ClassLoader createClassLoader(ClassLoaderPolicyModule module, ClassLoader parent)
- {
- classLoading.addModule(module);
- ClassLoader loader = parent == null ?
- module.registerClassLoaderPolicy(system) : module.registerClassLoaderPolicy(system, parent);
- registerModule(loader, module);
- return loader;
- }
-
+
protected ClassLoader createChildDomainParentFirstClassLoader(String name, String domainName, boolean importAll, URL... urls) throws Exception
{
return createChildDomainParentFirstClassLoader(name, domainName, importAll, null, urls);
@@ -242,13 +225,12 @@
protected ClassLoader createChildDomainClassLoader(String name, String domainName, String parentDomainName, boolean parentFirst, boolean importAll, ClassLoader parent, URL... urls) throws Exception
{
- ClassLoaderPolicyModule module = MockModuleFactory.createModule(name, importAll, domainName, parentDomainName, parentFirst, urls);
+ TestVFSClassLoaderFactory factory = TestVFSClassLoaderFactoryFactory.createClassLoaderFactory(name, importAll, domainName, parentDomainName, parentFirst, urls);
- ClassLoader classLoader = createClassLoader(module, parent);
+ ClassLoader classLoader = createClassLoader(factory, parent);
- ClassLoaderDomain domain = system.getDomain(domainName);
+ ClassLoaderDomain domain = getSystem().getDomain(domainName);
scopedChildDomainsByLoader.put(classLoader, domain);
- registerModule(classLoader, module);
return classLoader;
}
@@ -259,6 +241,27 @@
return cl;
}
+ private ClassLoader createClassLoader(TestVFSClassLoaderFactory factory) throws Exception
+ {
+ return createClassLoader(factory, null);
+ }
+
+ private ClassLoader createClassLoader(TestVFSClassLoaderFactory factory, ClassLoader parent) throws Exception
+ {
+ if (parent != null)
+ {
+ factory.setParent(parent);
+ }
+
+ KernelDeployment deployment = install(factory);
+ Module module = assertModule(getContextName(factory));
+ ClassLoader loader = assertClassLoader(factory);
+ registerModule(loader, module);
+ deploymentsByLoader.put(loader, deployment);
+
+ return loader;
+ }
+
/**
* Here since we cannot access this via the classloading api
*/
@@ -276,12 +279,12 @@
{
if (domain != null)
{
- ClassLoaderDomain registeredDomain = system.getDomain(domain.getName());
+ ClassLoaderDomain registeredDomain = getSystem().getDomain(domain.getName());
if (registeredDomain == null)
throw new IllegalStateException("Domain is not registered: " + domain.getName());
if (registeredDomain != domain)
throw new IllegalStateException(domain + " is not the same as " + registeredDomain);
- system.unregisterDomain(domain);
+ getSystem().unregisterDomain(domain);
}
}
@@ -389,15 +392,12 @@
return AspectManager.instance().registerClassLoader(loader);
}
- protected void registerModule(ClassLoader loader, ClassLoaderPolicyModule module)
+ protected void registerModule(ClassLoader loader, Module module)
{
- if (system != domainRegistry.getSystem())
+ if (getSystem() != domainRegistry.getSystem())
{
- domainRegistry.setSystem(system);
+ domainRegistry.setSystem(getSystem());
}
- //Add the hard reference to the Module since the registry's reference is weak
- //In the real workd this would be maintained by the deployers
- modules.add(module);
//TODO I have just hacked the domain and the parentUnitLoader here so this might cause problems
//with the tests if we try to do weaving. However, it should be fine while just testing pools
//and loaders
@@ -406,9 +406,6 @@
protected void unregisterModule(ClassLoader loader)
{
- //Remove the hard reference to the Module
- modules.remove(domainRegistry.getModule(loader));
-
domainRegistry.cleanupLoader(loader);
}
@@ -418,7 +415,7 @@
if (domainForLoader == null)
{
//domainForLoader = helper.getDomain();
- domainForLoader = system.getDefaultDomain();
+ domainForLoader = getSystem().getDefaultDomain();
}
assertNotNull(domainForLoader);
@@ -451,8 +448,12 @@
{
if (registeredURLClassLoaders.remove(classLoader) == false)
{
- unregisterModule(classLoader);
- system.unregisterClassLoader(classLoader);
+ domainRegistry.cleanupLoader(classLoader);
+ KernelDeployment deployment = deploymentsByLoader.remove(classLoader);
+ if (deployment != null)
+ {
+ undeploy(deployment);
+ }
}
}
}
@@ -466,11 +467,44 @@
{
if (name != null)
{
- ClassLoaderDomain registeredDomain = system.getDomain(name);
+ ClassLoaderDomain registeredDomain = getSystem().getDomain(name);
unregisterDomain(registeredDomain);
}
}
+ protected KernelDeployment install(TestVFSClassLoaderFactory metaData) throws Exception
+ {
+ AbstractKernelDeployment deployment = new AbstractKernelDeployment();
+ deployment.setName(metaData.getName() + ":" + metaData.getVersion());
+ deployment.setBeanFactories(Collections.singletonList((BeanMetaDataFactory) metaData));
+ deploy(deployment);
+ return deployment;
+ }
+
+ protected String getContextName(TestVFSClassLoaderFactory factory)
+ {
+ String contextName = factory.getContextName();
+ if (contextName == null)
+ contextName = factory.getName() + ":" + factory.getVersion();
+ return contextName;
+ }
+
+ protected ClassLoader assertClassLoader(TestVFSClassLoaderFactory factory) throws Exception
+ {
+ return assertClassLoader(getContextName(factory));
+ }
+
+ protected ClassLoader assertClassLoader(String name) throws Exception
+ {
+ Object obj = getBean(name);
+ return assertInstanceOf(obj, ClassLoader.class);
+ }
+
+ protected Module assertModule(String contextName)
+ {
+ return assertBean(contextName + "$MODULE", Module.class);
+ }
+
/**
* The test classes should not be on the launcher classpath
*/
Modified: projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java
===================================================================
--- projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java 2008-12-19 16:00:48 UTC (rev 82446)
+++ projects/aop/trunk/asintegration-mc/src/tests/org/jboss/test/aop/classpool/jbosscl/test/JBossClClassPoolTestDelegate.java 2008-12-19 16:45:02 UTC (rev 82447)
@@ -21,18 +21,31 @@
*/
package org.jboss.test.aop.classpool.jbosscl.test;
-import org.jboss.test.AbstractTestDelegate;
+import java.net.URL;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
/**
*
* @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
-public class JBossClClassPoolTestDelegate extends AbstractTestDelegate
+public class JBossClClassPoolTestDelegate extends MicrocontainerTestDelegate
{
- public JBossClClassPoolTestDelegate(Class<?> clazz)
+ public JBossClClassPoolTestDelegate(Class<?> clazz) throws Exception
{
super(clazz);
}
+
+ protected void deploy() throws Exception
+ {
+ String common = "/org/jboss/test/aop/classpool/jbosscl/Common.xml";
+ URL url = getClass().getResource(common);
+ if (url == null)
+ throw new IllegalStateException(common + " not found");
+ deploy(url);
+
+ super.deploy();
+ }
}
More information about the jboss-cvs-commits
mailing list