/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6876135 7024172
*
* @summary Test PlatformLoggingMXBean
* This test performs similar testing as
*
* @build PlatformLoggingMXBeanTest
* @run main PlatformLoggingMXBeanTest
*/
import javax.management.*;
public class PlatformLoggingMXBeanTest
{
}
/*
* Create the MBeanServeri, register the PlatformLoggingMXBean
*/
try {
}
catch ( Exception e ) {
throw e;
}
/*
* Access our MBean to get the current list of Loggers
*/
// check that Level object are returned properly
try {
}
catch ( Exception e ) {
throw e;
}
/*
* Dump the list of Loggers already present, if any
*/
Level l;
}
else {
try {
}
catch ( Exception e ) {
throw e;
}
}
}
/*
* Create two new loggers to the list of Loggers already present
*/
// check that Level object are returned properly
try {
}
catch ( Exception e ) {
throw e;
}
/*
* Check for the existence of our new Loggers
*/
throw new RuntimeException(
"Could not Detect the presense of the new Loggers");
}
else {
log1 = true;
}
log2 = true;
}
}
else {
throw new RuntimeException(
"Could not Detect the presense of the new Loggers");
}
}
/*
* Set a new Logging levels and check that it succeeded
*/
log1 = false;
log2 = false;
try {
// Set the level of logger1 to ALL
// Set the level of logger2 to FINER
// Okay read back the Level from Logger1. Should be ALL
log1 = true;
}
else {
throw new RuntimeException(
"Level Set to ALL but returned " + l.toString());
}
// Okay read back the Level from Logger2. Should be FINER
log2 = true;
}
else {
throw new RuntimeException(
"Level Set to FINER but returned " + l.toString());
}
}
catch ( Exception e ) {
throw e;
}
}
}
// check if the PlatformLoggingMXBean is registered in the platform MBeanServer
// We could call mbs.isRegistered(objName) here.
// Calling getMBeanInfo will throw exception if not found.
}
// test if PlatformLoggingMXBean works properly in a MBeanServer
}
}