[jboss-cvs] JBossAS SVN: r95445 - in projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool: test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 22 16:32:56 EDT 2009
Author: alesj
Date: 2009-10-22 16:32:56 -0400 (Thu, 22 Oct 2009)
New Revision: 95445
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/MockWarClassLoaderDeployer.java
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/ClassPoolTestCase.java
Log:
Fix war Classpool tests.
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/MockWarClassLoaderDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/MockWarClassLoaderDeployer.java 2009-10-22 20:15:12 UTC (rev 95444)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/support/MockWarClassLoaderDeployer.java 2009-10-22 20:32:56 UTC (rev 95445)
@@ -79,7 +79,7 @@
public void deploy(VFSDeploymentUnit unit) throws DeploymentException
{
// ignore if it already has classloading or not war deployment
- if (unit.getName().endsWith(".war") == false || unit.isAttachmentPresent(ClassLoadingMetaData.class))
+ if (unit.getSimpleName().endsWith(".war") == false || unit.isAttachmentPresent(ClassLoadingMetaData.class))
return;
// The default domain name is the unit name
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-22 20:15:12 UTC (rev 95444)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTest.java 2009-10-22 20:32:56 UTC (rev 95445)
@@ -21,7 +21,9 @@
*/
package org.jboss.test.deployers.vfs.classpool.test;
+import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -68,13 +70,25 @@
protected void assertClassPool(VirtualFile file, Class<?> ... classes) throws Exception
{
+ Map<Class<?>, String> map = new HashMap<Class<?>, String>();
+ for (Class<?> clazz : classes)
+ {
+ map.put(clazz, null);
+ }
+ assertClassPool(file, map);
+ }
+
+ protected void assertClassPool(VirtualFile file, Map<Class<?>, String> classes) throws Exception
+ {
DeploymentUnit unit = assertDeploy(file);
try
{
TypeInfoFactory typeInfoFactory = new JavassistTypeInfoFactory();
- ClassLoader classLoader = getClassLoader(unit);
- for (Class<?> clazz: classes)
+ for (Map.Entry<Class<?>, String> entry : classes.entrySet())
{
+ DeploymentUnit du = getDeploymentUnit(unit, entry.getValue());
+ ClassLoader classLoader = getClassLoader(du);
+ Class<?> clazz = entry.getKey();
String className = clazz.getName();
assertLoadClass(className, classLoader);
TypeInfo typeInfo = typeInfoFactory.getTypeInfo(className, classLoader);
@@ -88,4 +102,12 @@
undeploy(unit);
}
}
+
+ protected DeploymentUnit getDeploymentUnit(DeploymentUnit parent, String name)
+ {
+ if (name == null)
+ return parent;
+
+ return assertChild(parent, name);
+ }
}
\ 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-22 20:15:12 UTC (rev 95444)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classpool/test/ClassPoolTestCase.java 2009-10-22 20:32:56 UTC (rev 95445)
@@ -21,8 +21,11 @@
*/
package org.jboss.test.deployers.vfs.classpool.test;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
import junit.framework.Test;
-
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;
@@ -80,9 +83,16 @@
public void testBasicEar() throws Exception
{
AssembledDirectory directory = createBasicEar();
- assertClassPool(directory, SomeUtil.class, PlainJavaBean.class,
- MySLSBean.class, AnyServlet.class, UIBean.class,
- JsfBean.class, CrmFacade.class, SomeMBean.class);
+ Map<Class<?>, String> classes = new HashMap<Class<?>, String>();
+ classes.put(SomeUtil.class, null);
+ classes.put(PlainJavaBean.class, null);
+ classes.put(MySLSBean.class, null);
+ classes.put(AnyServlet.class, "simple.war");
+ classes.put(UIBean.class, "simple.war");
+ classes.put(JsfBean.class, "jsfapp.war");
+ classes.put(CrmFacade.class, "jsfapp.war");
+ classes.put(SomeMBean.class, null);
+ assertClassPool(directory, classes);
}
public void testTopLevelWithUtil() throws Exception
@@ -94,7 +104,7 @@
public void testWarInEar() throws Exception
{
AssembledDirectory directory = createWarInEar();
- assertClassPool(directory, AnyServlet.class);
+ assertClassPool(directory, Collections.<Class<?>, String>singletonMap(AnyServlet.class, "simple.war"));
}
public void testJarInEar() throws Exception
More information about the jboss-cvs-commits
mailing list