User: starksm 
  Date: 01/07/14 17:36:21

  Modified:    src/main/org/jboss/test/util Deploy.java
  Log:
  Unwrap any javax.management.MBeanException seen on deploy/undeploy
  
  Revision  Changes    Path
  1.6       +45 -16    jbosstest/src/main/org/jboss/test/util/Deploy.java
  
  Index: Deploy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/util/Deploy.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Deploy.java       2001/07/10 02:34:05     1.5
  +++ Deploy.java       2001/07/15 00:36:21     1.6
  @@ -9,6 +9,7 @@
   
   import java.util.Map;
   import java.util.Hashtable;
  +import javax.management.MBeanException;
   
   import junit.framework.TestCase;
   
  @@ -17,7 +18,7 @@
    *
    * @author  [EMAIL PROTECTED]
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class Deploy
   {
  @@ -27,7 +28,8 @@
      /**
       * Check if a jar is deployed.
       */
  -   private static boolean isDeployed(final String jarName) {
  +   private static boolean isDeployed(final String jarName)
  +   {
         Boolean bool = (Boolean)deployed.get(jarName);
         if (bool == null)
            return false;
  @@ -43,27 +45,38 @@
      }
   
      /** Return the deployment directory to use. */
  -   private static String getDeployFilename(final String filename) {
  +   private static String getDeployFilename(final String filename)
  +   {
         String deployDir = System.getProperty("jbosstest.deploy.dir");
  -      if (deployDir == null) {
  +      if (deployDir == null)
  +      {
            deployDir = "../deploy";
         }
         return deployDir + "/" + filename;
      }
  -    
  +
      /**
       * Deploy the security ejb jar one time.
       */
      public static void deploy(final String jarName) throws Exception
      {
         String noDeploy = System.getProperty("no-deploy");
  -      if (noDeploy != null || isDeployed(jarName)) {
  +      if (noDeploy != null || isDeployed(jarName))
  +      {
            return;
         }
   
         String filename = getDeployFilename(jarName);
         System.out.print("Deploying: "+ jarName + "...");
  -      new org.jboss.jmx.client.Deployer().deploy(filename);
  +      try
  +      {
  +         new org.jboss.jmx.client.Deployer().deploy(filename);
  +      }
  +      catch(MBeanException e)
  +      {
  +         e.printStackTrace();
  +         throw e.getTargetException();
  +      }
         setDeployed(jarName, true);
         System.out.println("Done");
      }
  @@ -80,7 +93,15 @@
   
         String filename = getDeployFilename(jarName);
         System.out.print("Undeploying: "+ jarName + "...");        
  -      new org.jboss.jmx.client.Deployer().undeploy(filename);
  +      try
  +      {
  +         new org.jboss.jmx.client.Deployer().undeploy(filename);
  +      }
  +      catch(MBeanException e)
  +      {
  +         e.printStackTrace();
  +         throw e.getTargetException();
  +      }
         setDeployed(jarName, false);
         System.out.println("Done");
      }
  @@ -93,17 +114,21 @@
      {
         String[] jarNames;
   
  -      public Deployer(final String[] jarNames) {
  +      public Deployer(final String[] jarNames)
  +      {
            super("deploy");
            this.jarNames = jarNames;
         }
         
  -      public Deployer(final String jarName) {
  +      public Deployer(final String jarName)
  +      {
            this(new String[] { jarName });
         }
   
  -      public void deploy() throws Exception {
  -         for (int i=0; i<jarNames.length; i++) {
  +      public void deploy() throws Exception
  +      {
  +         for (int i=0; i<jarNames.length; i++)
  +         {
               Deploy.deploy(this.jarNames[i]);
            }
         }
  @@ -117,17 +142,21 @@
      {
         String[] jarNames;
           
  -      public Undeployer(final String[] jarNames) {
  +      public Undeployer(final String[] jarNames)
  +      {
            super("undeploy");
            this.jarNames = jarNames;
         }
         
  -      public Undeployer(final String jarName) {
  +      public Undeployer(final String jarName)
  +      {
            this(new String[] { jarName });         
         }
         
  -      public void undeploy() throws Exception {
  -         for (int i=0; i<jarNames.length; i++) {         
  +      public void undeploy() throws Exception
  +      {
  +         for (int i=0; i<jarNames.length; i++)
  +         {
               Deploy.undeploy(this.jarNames[i]);
            }
         }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to