9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 */ 23 24 /* 25 * @test 26 * @bug 5024531 27 * @summary Basic Test for ManagementFactory.newPlatformMXBean(). 28 * @author Mandy Chung 29 * 30 * @compile -source 1.5 MXBeanProxyTest.java 31 * @run main MXBeanProxyTest 32 */ 33 import javax.management.*; 34 import java.lang.management.ClassLoadingMXBean; 35 import java.lang.management.RuntimeMXBean; 36 import static java.lang.management.ManagementFactory.*; 37 public class MXBeanProxyTest { 38 private static MBeanServer server = getPlatformMBeanServer(); 39 public static void main(String[] argv) throws Exception { 40 boolean iae = false; 41 try { 42 // Get a MXBean proxy with invalid name 43 newPlatformMXBeanProxy(server, 44 "Invalid ObjectName", 45 RuntimeMXBean.class); 46 } catch (IllegalArgumentException e) { 47 // Expected exception 48 System.out.println("EXPECTED: " + e); 49 iae = true; 50 } 51 if (!iae) { | 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 */ 23 24 /* 25 * @test 26 * @bug 5024531 27 * @summary Basic Test for ManagementFactory.newPlatformMXBean(). 28 * @author Mandy Chung 29 */ 30 import javax.management.*; 31 import java.lang.management.ClassLoadingMXBean; 32 import java.lang.management.RuntimeMXBean; 33 import static java.lang.management.ManagementFactory.*; 34 public class MXBeanProxyTest { 35 private static MBeanServer server = getPlatformMBeanServer(); 36 public static void main(String[] argv) throws Exception { 37 boolean iae = false; 38 try { 39 // Get a MXBean proxy with invalid name 40 newPlatformMXBeanProxy(server, 41 "Invalid ObjectName", 42 RuntimeMXBean.class); 43 } catch (IllegalArgumentException e) { 44 // Expected exception 45 System.out.println("EXPECTED: " + e); 46 iae = true; 47 } 48 if (!iae) { |