[jboss-cvs] JBossAS SVN: r87851 - in projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller: support and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 27 04:14:06 EDT 2009


Author: alesj
Date: 2009-04-27 04:14:06 -0400 (Mon, 27 Apr 2009)
New Revision: 87851

Added:
   projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenError.java
Modified:
   projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/instantiate/plain/test/PlainMBeanRedeployAfterErrorPlainUnitTestCase.java
   projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenDynamicMBean.java
Log:
Diff exception handling.

Modified: projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/instantiate/plain/test/PlainMBeanRedeployAfterErrorPlainUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/instantiate/plain/test/PlainMBeanRedeployAfterErrorPlainUnitTestCase.java	2009-04-27 07:22:18 UTC (rev 87850)
+++ projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/instantiate/plain/test/PlainMBeanRedeployAfterErrorPlainUnitTestCase.java	2009-04-27 08:14:06 UTC (rev 87851)
@@ -24,14 +24,16 @@
 import javax.management.NotCompliantMBeanException;
 
 import junit.framework.Test;
-
 import org.jboss.test.AbstractTestDelegate;
 import org.jboss.test.system.controller.support.BrokenDynamicMBean;
+import org.jboss.test.system.controller.support.BrokenError;
+import org.jboss.util.platform.Java;
 
 /**
  * PlainMBeanPlainUnitTestCase.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @version $Revision: 82920 $
  */
 public class PlainMBeanRedeployAfterErrorPlainUnitTestCase extends PlainMBeanTest
@@ -54,15 +56,8 @@
    // The JDK MBeanServer eats the error message :-(
    public void testPlainMBeanGetMBeanInfoError() throws Exception
    {
-      try
-      {
-         assertMaybeDeployFailure(BrokenDynamicMBean.OBJECT_NAME, NotCompliantMBeanException.class);
-      }
-      catch (Throwable t)
-      {
-         // in JDK6 we get different expected Throwable == Error
-         assertInstanceOf(t, Error.class, false);
-         assertEquals("BROKEN", t.getMessage());
-      }
+      boolean isJDK6OrMore = Java.isCompatible(Java.VERSION_1_6);
+      Class<? extends Throwable> expected = isJDK6OrMore ? BrokenError.class : NotCompliantMBeanException.class;
+      assertMaybeDeployFailure(BrokenDynamicMBean.OBJECT_NAME, expected);
    }
 }

Modified: projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenDynamicMBean.java
===================================================================
--- projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenDynamicMBean.java	2009-04-27 07:22:18 UTC (rev 87850)
+++ projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenDynamicMBean.java	2009-04-27 08:14:06 UTC (rev 87851)
@@ -46,7 +46,7 @@
    
    public MBeanInfo getMBeanInfo()
    {
-      throw new Error("BROKEN");
+      throw new BrokenError();
    }
 
    public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException

Copied: projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenError.java (from rev 87581, projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenDynamicMBean.java)
===================================================================
--- projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenError.java	                        (rev 0)
+++ projects/microcontainer/trunk/jmx-mc-int/src/test/java/org/jboss/test/system/controller/support/BrokenError.java	2009-04-27 08:14:06 UTC (rev 87851)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.system.controller.support;
+
+/**
+ * BrokenError
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BrokenError extends Error
+{
+   public BrokenError()
+   {
+      super("BROKEN");
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list