[jboss-cvs] JBossAS SVN: r81803 - in projects/jboss-deployers/trunk/deployers-impl/src: test/java/org/jboss/test/deployers/classloading/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 29 03:18:54 EST 2008


Author: alesj
Date: 2008-11-29 03:18:54 -0500 (Sat, 29 Nov 2008)
New Revision: 81803

Modified:
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
   projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
Log:
[JBDEPLOY-137]; ignore 2nd Module::reset.

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2008-11-29 05:28:02 UTC (rev 81802)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2008-11-29 08:18:54 UTC (rev 81803)
@@ -143,6 +143,17 @@
    public void reset()
    {
       super.reset();
-      determineContextName(unit, false);
+      // TODO - JBDEPLOY-137, not the best fix
+      if (unit != null)
+      {
+         try
+         {
+            determineContextName(unit, false);
+         }
+         finally
+         {
+            unit = null;
+         }
+      }
    }
 }

Modified: projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java	2008-11-29 05:28:02 UTC (rev 81802)
+++ projects/jboss-deployers/trunk/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java	2008-11-29 08:18:54 UTC (rev 81803)
@@ -29,6 +29,7 @@
 import org.jboss.deployers.client.spi.DeployerClient;
 import org.jboss.deployers.client.spi.Deployment;
 import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.structure.ContextInfo;
 import org.jboss.deployers.structure.spi.DeploymentContext;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
@@ -71,20 +72,44 @@
       mainDeployer.deploy(ad);
       try
       {
-         assertAlias(true);
+         assertAlias(true, "A");
       }
       finally
       {
          mainDeployer.undeploy(ad);        
-         assertAlias(false);
+         assertAlias(false, "A");
       }
    }
 
-   protected void assertAlias(boolean exists) throws Exception
+   public void testAliasRemoveOnChild() throws Exception
    {
+      DeployerClient mainDeployer = getMainDeployer();
+
+      Version v1 = Version.parseVersion("1");
+      Deployment ad = createSimpleDeployment("A");
+      addClassLoadingMetaData(ad, ad.getName(), v1, true, A.class);
+
+      Version v2 = Version.parseVersion("2");
+      ContextInfo childContextInfo = addChild(ad, "B");
+      addClassLoadingMetaData(childContextInfo, "B", v2, true, A.class);
+
+      mainDeployer.deploy(ad);
+      try
+      {
+         assertAlias(true, "A/B");
+      }
+      finally
+      {
+         mainDeployer.undeploy(ad);
+         assertAlias(false, "A/B");
+      }
+   }
+
+   protected void assertAlias(boolean exists, String name) throws Exception
+   {
       // this is ugly impl detail
       String controllerId = controller.getClass().getSimpleName() + "[" + System.identityHashCode(controller) + "]";
-      ControllerContext alias = controller.getContext("A_Alias_" + controllerId, null);
+      ControllerContext alias = controller.getContext(name + "_Alias_" + controllerId, null);
       assertEquals(exists, alias != null);
    }
 




More information about the jboss-cvs-commits mailing list