[jboss-cvs] JBossAS SVN: r81898 - in projects/jboss-deployers/branches/Branch_2_0/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
Mon Dec 1 08:41:04 EST 2008


Author: alesj
Date: 2008-12-01 08:41:03 -0500 (Mon, 01 Dec 2008)
New Revision: 81898

Modified:
   projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
   projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
Log:
Port fix + test.

Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2008-12-01 13:36:59 UTC (rev 81897)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/classloading/AbstractDeploymentClassLoaderPolicyModule.java	2008-12-01 13:41:03 UTC (rev 81898)
@@ -33,7 +33,7 @@
 
 /**
  * AbstractDeploymentClassLoaderPolicyModule.
- * 
+ *
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 1.1 $
@@ -45,13 +45,13 @@
 
    /** The classloader state for deployments */
    private static ControllerState CLASSLOADER_STATE = new ControllerState(DeploymentStages.CLASSLOADER.getName());
-   
+
    /** The deployment unit */
    private DeploymentUnit unit;
-   
+
    /**
-    * Determine the classloading metadata for the deployment unit 
-    * 
+    * Determine the classloading metadata for the deployment unit
+    *
     * @param unit the deployment unit
     * @return the classloading metadata
     */
@@ -63,8 +63,8 @@
    }
 
    /**
-    * Determine the classloading metadata for the deployment unit 
-    * 
+    * Determine the classloading metadata for the deployment unit
+    *
     * @param unit the deployment unit
     * @param addAlias should we add alias or remove
     * @return the classloading metadata
@@ -77,7 +77,7 @@
       ControllerContext context = unit.getTopLevel().getAttachment(ControllerContext.class);
       if (context == null)
          throw new IllegalStateException("Deployment has no controller context");
-      
+
       // We use the deployment name
       String contextName = unit.getName();
 
@@ -105,13 +105,13 @@
             }
          }
       }
-      
+
       return contextName;
    }
-   
+
    /**
     * Create a new AbstractDeploymentClassLoaderPolicyModule.
-    * 
+    *
     * @param unit the deployment unit
     * @throws IllegalArgumentException for a null unit
     */
@@ -125,7 +125,7 @@
 
    /**
     * Get the unit.
-    * 
+    *
     * @return the unit.
     */
    public DeploymentUnit getDeploymentUnit()
@@ -140,9 +140,15 @@
    }
 
    @Override
-   public void reset()
+   public void release()
    {
-      super.reset();
-      determineContextName(unit, false);
+      try
+      {
+         super.release();
+      }
+      finally
+      {
+         determineContextName(unit, false);
+      }
    }
 }

Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java	2008-12-01 13:36:59 UTC (rev 81897)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java	2008-12-01 13:41:03 UTC (rev 81898)
@@ -80,6 +80,30 @@
       }
    }
 
+   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) throws Exception
    {
       // this is ugly impl detail




More information about the jboss-cvs-commits mailing list