[jboss-cvs] JBossAS SVN: r96122 - in projects/jboss-deployers/trunk/deployers-vfs/src/test: java/org/jboss/test/deployers/vfs/reflect/support/tif and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 7 13:56:23 EST 2009


Author: alesj
Date: 2009-11-07 13:56:22 -0500 (Sat, 07 Nov 2009)
New Revision: 96122

Added:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/support/tif/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/support/tif/TIFTester.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/META-INF/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/META-INF/tif-beans.xml
Modified:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/ClassPoolTestCase.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/TypeInfoTest.java
Log:
Add new hierarchy Module test.

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/support/tif/TIFTester.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/support/tif/TIFTester.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/support/tif/TIFTester.java	2009-11-07 18:56:22 UTC (rev 96122)
@@ -0,0 +1,35 @@
+/*
+ * 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.reflect.support.tif;
+
+import org.jboss.test.deployers.vfs.reflect.support.web.AnyServlet;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TIFTester
+{
+   public AnyServlet getAnys()
+   {
+      return new AnyServlet();
+   }
+}

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/ClassPoolTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/ClassPoolTestCase.java	2009-11-06 21:34:01 UTC (rev 96121)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/ClassPoolTestCase.java	2009-11-07 18:56:22 UTC (rev 96122)
@@ -181,4 +181,47 @@
          System.clearProperty("jboss.tests.url");
       }
    }
+
+
+   public void testHierarchyNonDeploymentModule() throws Exception
+   {
+      URL location = AnyServlet.class.getProtectionDomain().getCodeSource().getLocation();
+      System.setProperty("jboss.tests.url", location.toExternalForm());
+      try
+      {
+         AssembledDirectory jar = createJar();
+         addPath(jar, "/reflect/tif", "META-INF");
+
+         Deployment deployment = createVFSDeployment(jar);
+         DeployerClient main = getDeployerClient();
+         main.deploy(deployment);
+         try
+         {
+            Object anys = assertBean("AnyServlet", Object.class);
+            Class<?> anysClass = anys.getClass();
+            ClassLoader anysCL = anysClass.getClassLoader();
+
+            Object tif = assertBean("TifTester", Object.class);
+            Class<?> tifClass = tif.getClass();
+            ClassLoader tifCL = tifClass.getClassLoader();
+
+            DeploymentUnit du = getMainDeployerStructure().getDeploymentUnit(deployment.getName(), true);
+            ClassLoader cl = getClassLoader(du);
+
+            assertNotSame(cl, anysCL);
+            assertNotSame(cl, tifCL);
+            assertNotSame(anysCL, tifCL);
+
+            // TODO - Flavia, apply ClassPool tests
+         }
+         finally
+         {
+            main.undeploy(deployment);
+         }
+      }
+      finally
+      {
+         System.clearProperty("jboss.tests.url");
+      }
+   }
 }
\ No newline at end of file

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/TypeInfoTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/TypeInfoTest.java	2009-11-06 21:34:01 UTC (rev 96121)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/reflect/test/TypeInfoTest.java	2009-11-07 18:56:22 UTC (rev 96122)
@@ -245,4 +245,53 @@
          System.clearProperty("jboss.tests.url");
       }
    }
+
+   public void testHierarchyNonDeploymentModule() throws Exception
+   {
+      URL location = AnyServlet.class.getProtectionDomain().getCodeSource().getLocation();
+      System.setProperty("jboss.tests.url", location.toExternalForm());
+      try
+      {
+         AssembledDirectory jar = createJar();
+         addPath(jar, "/reflect/tif", "META-INF");
+
+         Deployment deployment = createVFSDeployment(jar);
+         DeployerClient main = getDeployerClient();
+         main.deploy(deployment);
+         try
+         {
+            Object anys = assertBean("AnyServlet", Object.class);
+            Class<?> anysClass = anys.getClass();
+            ClassLoader anysCL = anysClass.getClassLoader();
+
+            Object tif = assertBean("TifTester", Object.class);
+            Class<?> tifClass = tif.getClass();
+            ClassLoader tifCL = tifClass.getClassLoader();
+
+            DeploymentUnit du = getMainDeployerStructure().getDeploymentUnit(deployment.getName(), true);
+            ClassLoader cl = getClassLoader(du);
+
+            assertNotSame(cl, anysCL);
+            assertNotSame(cl, tifCL);
+            assertNotSame(anysCL, tifCL);
+
+            TypeInfoFactory factory = createTypeInfoFactory();
+            TypeInfo tifTIL = factory.getTypeInfo(tifClass);
+            TypeInfo tifRT = assertReturnType(tifTIL, "getAnys");
+            TypeInfo asTIL = factory.getTypeInfo(anysClass);
+            assertEquals(tifRT, asTIL);
+            TypeInfo pjbTI = factory.getTypeInfo(PlainJavaBean.class.getName(), cl);
+            TypeInfo rtL = assertReturnType(asTIL, "getBean");
+            assertEquals(pjbTI, rtL);
+         }
+         finally
+         {
+            main.undeploy(deployment);
+         }
+      }
+      finally
+      {
+         System.clearProperty("jboss.tests.url");
+      }
+   }
 }
\ No newline at end of file

Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/META-INF/tif-beans.xml (from rev 96121, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/module/META-INF/anys-beans.xml)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/META-INF/tif-beans.xml	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/reflect/tif/META-INF/tif-beans.xml	2009-11-07 18:56:22 UTC (rev 96122)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <classloader name="anys-classloader" xmlns="urn:jboss:classloader:1.0" import-all="true" domain="Anys" parent-domain="DefaultDomain">
+    <capabilities>
+      <package name="org.jboss.test.deployers.vfs.reflect.support.web"/>
+    </capabilities>
+    <root>${jboss.tests.url}</root>
+  </classloader>
+
+  <classloader name="tif-classloader" xmlns="urn:jboss:classloader:1.0" import-all="true" domain="TIF" parent-domain="Anys">
+    <capabilities>
+      <package name="org.jboss.test.deployers.vfs.reflect.support.tif"/>
+    </capabilities>
+    <root>${jboss.tests.url}</root>
+  </classloader>
+
+  <bean name="AnyServlet" class="org.jboss.test.deployers.vfs.reflect.support.web.AnyServlet">
+    <classloader><inject bean="anys-classloader:0.0.0"/></classloader>
+  </bean>
+
+  <bean name="TifTester" class="org.jboss.test.deployers.vfs.reflect.support.tif.TIFTester">
+    <classloader><inject bean="tif-classloader:0.0.0"/></classloader>
+  </bean>
+
+</deployment>




More information about the jboss-cvs-commits mailing list