[jboss-cvs] JBossAS SVN: r92396 - in branches/Branch_5_x: testsuite/imports/sections and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 14 16:51:02 EDT 2009


Author: scott.stark at jboss.org
Date: 2009-08-14 16:51:02 -0400 (Fri, 14 Aug 2009)
New Revision: 92396

Added:
   branches/Branch_5_x/testsuite/src/resources/profileservice/testCNFE-service.xml
Modified:
   branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
   branches/Branch_5_x/testsuite/imports/sections/profileservice.xml
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
Log:
JBAS-7177, include the deployment failure cause in the IncompleteDeploymentException

Modified: branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java
===================================================================
--- branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-08-14 20:47:12 UTC (rev 92395)
+++ branches/Branch_5_x/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/AbstractDeployHandler.java	2009-08-14 20:51:02 UTC (rev 92396)
@@ -32,6 +32,7 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.InvocationResponse;
 import org.jboss.aspects.remoting.AOPRemotingInvocationHandler;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
 import org.jboss.deployers.spi.management.deploy.DeploymentID;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.logging.Logger;
@@ -289,11 +290,29 @@
          // Schedule start for the deployment
          deployments.add(start(name, deploymentRepository));
       }
+
+      try
+      {
       // Process
       deployer.process();
       // CheckComplete
       deployer.checkComplete(
             deployments.toArray(new String[deployments.size()]));
+      }
+      catch(IncompleteDeploymentException e)
+      {
+         Map<String, Throwable> errors = e.getIncompleteDeployments().getContextsInError();
+         Exception ex = e;
+         // TODO: how to handle multiple erorrs
+         if(errors.size() >= 1)
+         {
+            Throwable t = errors.values().iterator().next();
+            IncompleteDeploymentException ide = new IncompleteDeploymentException(e.getIncompleteDeployments());
+            ide.initCause(t);
+            ex = ide;
+         }
+         throw ex;
+      }
       
       log.info("End start, "+ deployments);
    }

Modified: branches/Branch_5_x/testsuite/imports/sections/profileservice.xml
===================================================================
--- branches/Branch_5_x/testsuite/imports/sections/profileservice.xml	2009-08-14 20:47:12 UTC (rev 92395)
+++ branches/Branch_5_x/testsuite/imports/sections/profileservice.xml	2009-08-14 20:51:02 UTC (rev 92396)
@@ -95,6 +95,8 @@
          </fileset>
       </jar>
 
+      <copy tofile="${build.lib}/testCNFE-service.xml"
+         file="${build.resources}/profileservice/testCNFE-service.xml" />
 
    </target>
 </project>

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2009-08-14 20:47:12 UTC (rev 92395)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java	2009-08-14 20:51:02 UTC (rev 92396)
@@ -27,6 +27,7 @@
 
 import javax.naming.InitialContext;
 
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
 import org.jboss.deployers.spi.management.ManagementView;
 import org.jboss.deployers.spi.management.deploy.DeploymentManager;
 import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
@@ -222,6 +223,24 @@
       testDeployment(name, "sar", null);
    }
 
+   /**
+    * Test that a valid exception is seen
+    * @throws Exception
+    */
+   public void testSarCNFEDeployment() throws Exception
+   {
+      String name = "testCNFE-service.xml";
+      try
+      {
+         testDeployment(name, "sar", null);
+      }
+      catch(IncompleteDeploymentException e)
+      {
+         Throwable cause = e.getCause();
+         assertTrue("Failure caused by CNFE", cause instanceof ClassNotFoundException);
+      }
+   }
+
    private interface ManagedDeploymentTester
    {
       void testManagedDeployment() throws Exception;

Added: branches/Branch_5_x/testsuite/src/resources/profileservice/testCNFE-service.xml
===================================================================
--- branches/Branch_5_x/testsuite/src/resources/profileservice/testCNFE-service.xml	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/resources/profileservice/testCNFE-service.xml	2009-08-14 20:51:02 UTC (rev 92396)
@@ -0,0 +1,6 @@
+<server>
+    <!-- An mbean reference to a non-existent class -->
+    <mbean code="org.jboss.test.profileservice.sar.NoSuchBean"
+        name="jboss.test:service=NoSuchBean">
+    </mbean>    
+</server>




More information about the jboss-cvs-commits mailing list