5070N/A * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. 5070N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5070N/A * This code is free software; you can redistribute it and/or modify it 5070N/A * under the terms of the GNU General Public License version 2 only, as 5070N/A * published by the Free Software Foundation. 5070N/A * This code is distributed in the hope that it will be useful, but WITHOUT 5070N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5070N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5070N/A * version 2 for more details (a copy is included in the LICENSE file that 5070N/A * You should have received a copy of the GNU General Public License version 5070N/A * 2 along with this work; if not, write to the Free Software Foundation, 5070N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5070N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5070N/A * or visit www.oracle.com if you need additional information or have any 5070N/A * @summary Check the emission of notifications when a Security Manager is 5070N/A * installed. Test the property "jmx.remote.x.check.notification.emission". 5070N/A * @author Luis-Miguel Alventosa 5070N/A * @run clean NotificationEmissionTest 5070N/A * @run build NotificationEmissionTest 5070N/A * @run main NotificationEmissionTest 1 5070N/A * @run main NotificationEmissionTest 2 5070N/A * @run main NotificationEmissionTest 3 5070N/A * @run main NotificationEmissionTest 4 5070N/A * @run main NotificationEmissionTest 5 5070N/A // Create a new MBeanServer 5070N/A // Create server environment map 5070N/A // Create the JMXServiceURL 5070N/A // Create a JMXConnectorServer 5070N/A // Start the JMXConnectorServer // Create server environment map // Create JMXConnector and connect to JMXConnectorServer // Get non-secure MBeanServerConnection // Add notification listener // Invoke the "sendNotification" method new String[] {
"int",
"javax.management.ObjectName"});
new String[] {
"int",
"javax.management.ObjectName"});
new String[] {
"int",
"javax.management.ObjectName"});
// If the check is effective and we're using policy.negative, // then we should see the two notifs sent by nb2 (of which one // has a getSource() that is nb3), but not the notif sent by nb1. // Otherwise we should see all three notifs. The check is only // effective if the property jmx.remote.x.check.notification.emission // is explicitly true and there is a security manager. // Wait for notifications to be emitted // Remove notification listener // Stop the connector server // Release the MBeanServer echo(
"\n--- Check the emission of notifications " +
"when a Security Manager is installed");