[jboss-cvs] JBossAS SVN: r66430 - in projects/microcontainer/trunk/deployers-impl/src: main/org/jboss/deployers/plugins/main and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 25 09:57:43 EDT 2007


Author: adrian at jboss.org
Date: 2007-10-25 09:57:42 -0400 (Thu, 25 Oct 2007)
New Revision: 66430

Modified:
   projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
   projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
   projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/HeuristicAllOrNothingUnitTestCase.java
Log:
[JBMICROCONT-212] - Remove the failed DeploymentControllerContexts from the Microcontainer at undeploy

Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2007-10-25 13:41:21 UTC (rev 66429)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2007-10-25 13:57:42 UTC (rev 66430)
@@ -392,12 +392,13 @@
          for (int i = undeploy.size()-1; i >= 0; --i)
          {
             DeploymentContext context = undeploy.get(i);
-            context.setState(DeploymentState.UNDEPLOYING);
+            if (DeploymentState.ERROR.equals(context.getState()) == false)
+               context.setState(DeploymentState.UNDEPLOYING);
             log.debug("Undeploying " + context.getName());
             DeploymentControllerContext deploymentControllerContext = context.getTransientAttachments().getAttachment(ControllerContext.class.getName(), DeploymentControllerContext.class);
             if (deploymentControllerContext == null)
             {
-               log.warn("DeploymentContext has no DeploymentControllerContext during undeploy request, ignoring: " + context);
+               log.debug("DeploymentContext has no DeploymentControllerContext during undeploy request, ignoring: " + context);
             }
             else
             {

Modified: projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java	2007-10-25 13:41:21 UTC (rev 66429)
+++ projects/microcontainer/trunk/deployers-impl/src/main/org/jboss/deployers/plugins/main/MainDeployerImpl.java	2007-10-25 13:57:42 UTC (rev 66430)
@@ -572,12 +572,8 @@
       allDeployments.remove(name);
       errorDeployments.remove(name);
       missingDeployers.remove(name);
-      if (context.getState() == DeploymentState.ERROR)
-      {
-         log.debug("Not scheduling removal of context already in error: " + name);
-         return;
-      }
-      context.setState(DeploymentState.UNDEPLOYING);
+      if (DeploymentState.ERROR.equals(context.getState()) == false)
+         context.setState(DeploymentState.UNDEPLOYING);
       DeploymentContext parent = context.getParent();
       log.debug("Scheduling undeployment: " + name + " parent=" + parent);
 

Modified: projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/HeuristicAllOrNothingUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/HeuristicAllOrNothingUnitTestCase.java	2007-10-25 13:41:21 UTC (rev 66429)
+++ projects/microcontainer/trunk/deployers-impl/src/tests/org/jboss/test/deployers/deployer/test/HeuristicAllOrNothingUnitTestCase.java	2007-10-25 13:57:42 UTC (rev 66430)
@@ -138,6 +138,10 @@
       assertEquals(expectedParent, deployer2.getDeployedUnits());
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(deployment.getName()));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentFailInParentDeployer1() throws Exception
@@ -154,6 +158,10 @@
       assertEquals(expectedNothing, deployer2.getDeployedUnits());
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentFailInParentDeployer2() throws Exception
@@ -172,6 +180,10 @@
       assertEquals(expectedParent, deployer2.getDeployedUnits());
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentOneChildNoErrors() throws Exception
@@ -189,6 +201,10 @@
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(childName));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
    
    public void testDeployParentOneChildFailInParentDeployer1() throws Exception
@@ -207,6 +223,10 @@
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(childName));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
    
    public void testDeployParentOneChildFailInParentDeployer2() throws Exception
@@ -225,6 +245,10 @@
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(childName));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
    
    public void testDeployParentOneChildFailInChildDeployer1() throws Exception
@@ -243,6 +267,10 @@
       assertEquals(expectedNothing, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(childName));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
    
    public void testDeployParentOneChildFailInChildDeployer2() throws Exception
@@ -261,6 +289,10 @@
       assertEquals(expectedParent, deployer2.getUndeployedUnits());
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(childName));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenNoErrors() throws Exception
@@ -280,6 +312,10 @@
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInParentDeployer1() throws Exception
@@ -300,6 +336,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInParentDeployer2() throws Exception
@@ -320,6 +360,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInChild1Deployer1() throws Exception
@@ -340,6 +384,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInChild1Deployer2() throws Exception
@@ -360,6 +408,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInChild2Deployer1() throws Exception
@@ -380,6 +432,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenFailInChild2Deployer2() throws Exception
@@ -400,6 +456,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsNoErrors() throws Exception
@@ -424,6 +484,10 @@
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.DEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsParentComponent1Fails() throws Exception
@@ -448,6 +512,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsParentComponent2Fails() throws Exception
@@ -472,6 +540,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsChild1Component1Fails() throws Exception
@@ -496,6 +568,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsChild1Component2Fails() throws Exception
@@ -520,6 +596,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsChild2Component1Fails() throws Exception
@@ -544,6 +624,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    public void testDeployParentMultipleChildrenAndComponentsChild2Component2Fails() throws Exception
@@ -568,6 +652,10 @@
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(deployment.getName()));
       assertEquals(DeploymentState.UNDEPLOYED, main.getDeploymentState(child1Name));
       assertEquals(DeploymentState.ERROR, main.getDeploymentState(child2Name));
+      
+      main.removeDeployment(deployment);
+      main.process();
+      main.checkComplete();
    }
 
    protected static void addMetaData(PredeterminedManagedObjectAttachments attachments, TestComponentMetaDataContainer md)




More information about the jboss-cvs-commits mailing list