18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.jmx.security;
27
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
30 import java.util.List;
31
32 import jdk.jfr.jmx.JmxHelper;
33
34 import jdk.management.jfr.ConfigurationInfo;
35 import jdk.management.jfr.FlightRecorderMXBean;
36 import jdk.test.lib.Asserts;
37
38 /*
39 * @test
40 * @key jfr
41 * @summary Test with minimal needed permissions. All functions should work.
42 * @library /test/lib /test/jdk
43 * @run main/othervm/secure=java.lang.SecurityManager/java.security.policy=enough.policy jdk.jfr.jmx.security.TestEnoughPermission
44 */
45 public class TestEnoughPermission {
46
47 public static void main(String[] args) throws Throwable {
48 try {
49 FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean();
50
51 System.out.println("AAAAAAAAAAAAAAAAAA");
52 Asserts.assertFalse(bean.getEventTypes().isEmpty(), "No EventTypes");
53 System.out.println("BBBBBBBBBBBBBBB");
54 List<ConfigurationInfo> configs = bean.getConfigurations();
55 System.out.println("CCCCCCCCCCCCCCCCC");
56 for (ConfigurationInfo config : configs) {
57 System.out.println("config.name=" + config.getName() + ": " + config.getContents());
58 }
59
60 long recId = testRecording(bean);
61 testStream(bean, recId);
|
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package jdk.jfr.jmx.security;
27
28 import java.nio.file.Path;
29 import java.nio.file.Paths;
30 import java.util.List;
31
32 import jdk.jfr.jmx.JmxHelper;
33
34 import jdk.management.jfr.ConfigurationInfo;
35 import jdk.management.jfr.FlightRecorderMXBean;
36 import jdk.test.lib.Asserts;
37
38 /**
39 * @test
40 * @key jfr
41 * @summary Test with minimal needed permissions. All functions should work.
42 * @requires vm.hasJFR
43 * @library /test/lib /test/jdk
44 * @run main/othervm/secure=java.lang.SecurityManager/java.security.policy=enough.policy jdk.jfr.jmx.security.TestEnoughPermission
45 */
46 public class TestEnoughPermission {
47
48 public static void main(String[] args) throws Throwable {
49 try {
50 FlightRecorderMXBean bean = JmxHelper.getFlighteRecorderMXBean();
51
52 System.out.println("AAAAAAAAAAAAAAAAAA");
53 Asserts.assertFalse(bean.getEventTypes().isEmpty(), "No EventTypes");
54 System.out.println("BBBBBBBBBBBBBBB");
55 List<ConfigurationInfo> configs = bean.getConfigurations();
56 System.out.println("CCCCCCCCCCCCCCCCC");
57 for (ConfigurationInfo config : configs) {
58 System.out.println("config.name=" + config.getName() + ": " + config.getContents());
59 }
60
61 long recId = testRecording(bean);
62 testStream(bean, recId);
|