[jboss-cvs] JBossAS SVN: r104764 - in projects/jboss-deployers/trunk/deployers-vfs/src/test: java/org/jboss/test/deployers/vfs/classloading/support and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 13 09:56:37 EDT 2010


Author: alesj
Date: 2010-05-13 09:56:36 -0400 (Thu, 13 May 2010)
New Revision: 104764

Added:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/support/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/support/MockServlet.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/jboss-beans.xml
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/web.xml
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/test/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.xml
Modified:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/ClassLoadingTestSuite.java
Log:
Mock CL cache check.

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/ClassLoadingTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/ClassLoadingTestSuite.java	2010-05-13 13:52:43 UTC (rev 104763)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/ClassLoadingTestSuite.java	2010-05-13 13:56:36 UTC (rev 104764)
@@ -22,6 +22,7 @@
 
 package org.jboss.test.deployers.vfs.classloading;
 
+import org.jboss.test.deployers.vfs.classloading.test.ClassLoaderCachingTestCase;
 import org.jboss.test.deployers.vfs.classloading.test.DeploymentMetaDataUnitTestCase;
 
 import junit.framework.Test;
@@ -45,6 +46,7 @@
       TestSuite suite = new TestSuite("VFS ClassLoading Tests");
 
       suite.addTest(DeploymentMetaDataUnitTestCase.suite());
+      suite.addTest(ClassLoaderCachingTestCase.suite());
 
       return suite;
    }

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/support/MockServlet.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/support/MockServlet.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/support/MockServlet.java	2010-05-13 13:56:36 UTC (rev 104764)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.classloading.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockServlet
+{
+   private String className;
+
+   public MockServlet(String className)
+   {
+      if (className == null)
+         throw new IllegalArgumentException("Null class name");
+      this.className = className;
+   }
+
+   public void ping() throws Exception
+   {
+      ClassLoader cl = getClass().getClassLoader();
+      Class<?> clazz = cl.loadClass(className);
+      System.out.println("clazz = " + clazz);
+   }
+}

Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.java (from rev 104697, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/test/DeploymentMetaDataUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.java	2010-05-13 13:56:36 UTC (rev 104764)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.classloading.test;
+
+import java.lang.reflect.Method;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.vfs.classloading.support.MockServlet;
+import org.jboss.vfs.VFS;
+import org.jboss.vfs.VirtualFile;
+
+import junit.framework.Test;
+
+/**
+ * Mock different deployments to check BaseCL caching.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ClassLoaderCachingTestCase extends BootstrapDeployersTest
+{
+   public ClassLoaderCachingTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(ClassLoaderCachingTestCase.class);
+   }
+
+   private static void ping(Object servlet) throws Exception
+   {
+      Class<?> clazz = servlet.getClass();
+      Method ping = clazz.getMethod("ping");
+      ping.invoke(servlet);
+   }
+
+   public void testWar() throws Exception
+   {
+      VirtualFile war = VFS.getChild(getName()).getChild("top-level.war");
+      createAssembledDirectory(war)
+         .addPath("/classloading/cache/web")
+         .addPackage("WEB-INF/classes", MockServlet.class);
+
+      DeploymentUnit unit = assertDeploy(war);
+      try
+      {
+         Object servlet = getBean("Servlet");
+         assertNotNull(servlet);
+         ping(servlet);
+         ping(servlet);
+      }
+      finally
+      {
+         undeploy(unit);
+      }
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/jboss-beans.xml	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/jboss-beans.xml	2010-05-13 13:56:36 UTC (rev 104764)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+    <bean name="Servlet" class="org.jboss.test.deployers.vfs.classloading.support.MockServlet">
+        <constructor>
+            <parameter>org.jboss.dependency.spi.Controller</parameter>
+        </constructor>
+    </bean>
+
+</deployment>

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/web.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/web.xml	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/classloading/cache/web/WEB-INF/web.xml	2010-05-13 13:56:36 UTC (rev 104764)
@@ -0,0 +1,2 @@
+<web>
+</web>

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.xml	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/classloading/test/ClassLoaderCachingTestCase.xml	2010-05-13 13:56:36 UTC (rev 104764)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <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="WarClassLoader" class="org.jboss.test.deployers.vfs.reflect.support.MockWarClassLoaderDeployer"/>
+
+</deployment>




More information about the jboss-cvs-commits mailing list