001 // jademx - JADE management using JMX 002 // Copyright 2005 Caboodle Networks, Inc. 003 // 004 // This library is free software; you can redistribute it and/or 005 // modify it under the terms of the GNU Lesser General Public 006 // License as published by the Free Software Foundation; either 007 // version 2.1 of the License, or (at your option) any later version. 008 // 009 // This library is distributed in the hope that it will be useful, 010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 // Lesser General Public License for more details. 013 // 014 // You should have received a copy of the GNU Lesser General Public 015 // License along with this library; if not, write to the Free Software 016 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 017 018 package jade.jademx.server; 019 020 import java.lang.management.ManagementFactory; // J2SE 5.0 021 import javax.management.MBeanServer; 022 023 import jade.jademx.server.JavaPlatform; 024 import jade.jademx.JadeMXSuiteTest; 025 import junit.framework.Test; 026 import junit.framework.TestCase; 027 import junit.framework.TestSuite; 028 029 /** 030 * Java platform MBean server test 031 * @author David Bernstein, <a href="http://www.caboodlenetworks.com" 032 * >Caboodle Networks, Inc.</a> 033 */ 034 public class JavaPlatformTest extends TestCase { 035 036 // tests 037 038 /** 039 * Test that can get platform MBean server. 040 */ 041 public void testIsPlatformMBeanServer() { 042 JavaPlatform javaPlatform = new JavaPlatform(); 043 MBeanServer mBeanServer = javaPlatform.getMBeanServer(); 044 MBeanServer platformMBS = ManagementFactory.getPlatformMBeanServer(); 045 assertEquals( "JavaPlatform returned "+mBeanServer+ 046 " instead of "+platformMBS, 047 mBeanServer, platformMBS ); 048 } 049 050 // suite 051 052 /** 053 * return the implicit suite of tests 054 * @return the implicit suite of tests 055 */ 056 public static Test suite() { 057 return new TestSuite( 058 JavaPlatformTest.class, 059 JadeMXSuiteTest.nameWithClass( JavaPlatformTest.class, 060 "testing JavaPlatform: Java platform MBean server") ); 061 } 062 063 064 065 }