From ffb3771816910d2eddba367812e57a9c5459ff8c Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Wed, 14 Apr 2021 15:42:55 +0000 Subject: [PATCH] 8265019: Update tests for additional TestNG test permissions Reviewed-by: naoto, bpb, alanb --- test/jdk/java/lang/ProcessHandle/PermissionTest.java | 12 +++++++++--- test/jdk/java/sql/testng/util/TestPolicy.java | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/jdk/java/lang/ProcessHandle/PermissionTest.java b/test/jdk/java/lang/ProcessHandle/PermissionTest.java index 54c51a2c1d4..34b0cba654d 100644 --- a/test/jdk/java/lang/ProcessHandle/PermissionTest.java +++ b/test/jdk/java/lang/ProcessHandle/PermissionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ import java.io.FilePermission; import java.io.IOException; +import java.lang.reflect.ReflectPermission; import java.security.CodeSource; import java.security.Permission; import java.security.PermissionCollection; @@ -205,14 +206,19 @@ class TestPolicy extends Policy { permissions.add(new RuntimePermission("getClassLoader")); permissions.add(new RuntimePermission("setSecurityManager")); permissions.add(new RuntimePermission("createSecurityManager")); - permissions.add(new PropertyPermission("testng.show.stack.frames", - "read")); permissions.add(new PropertyPermission("user.dir", "read")); permissions.add(new PropertyPermission("test.src", "read")); permissions.add(new PropertyPermission("file.separator", "read")); permissions.add(new PropertyPermission("line.separator", "read")); permissions.add(new PropertyPermission("fileStringBuffer", "read")); permissions.add(new PropertyPermission("dataproviderthreadcount", "read")); + permissions.add(new PropertyPermission("testng.show.stack.frames", + "read")); + permissions.add(new PropertyPermission("testng.thread.affinity", "read")); + permissions.add(new PropertyPermission("testng.mode.dryrun", "read")); + permissions.add(new PropertyPermission("testng.report.xml.name", "read")); + permissions.add(new PropertyPermission("testng.timezone", "read")); + permissions.add(new ReflectPermission("suppressAccessChecks")); permissions.add(new FilePermission("<>", "execute")); } diff --git a/test/jdk/java/sql/testng/util/TestPolicy.java b/test/jdk/java/sql/testng/util/TestPolicy.java index 2adeaf31bc7..8b355cb9066 100644 --- a/test/jdk/java/sql/testng/util/TestPolicy.java +++ b/test/jdk/java/sql/testng/util/TestPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ package util; import java.io.FilePermission; +import java.lang.reflect.ReflectPermission; import java.security.AllPermission; import java.security.CodeSource; import java.security.Permission; @@ -102,12 +103,17 @@ public class TestPolicy extends Policy { permissions.add(new RuntimePermission("getClassLoader")); permissions.add(new RuntimePermission("setSecurityManager")); permissions.add(new RuntimePermission("createSecurityManager")); - permissions.add(new PropertyPermission("testng.show.stack.frames", - "read")); permissions.add(new PropertyPermission("line.separator", "read")); permissions.add(new PropertyPermission("fileStringBuffer", "read")); permissions.add(new PropertyPermission("dataproviderthreadcount", "read")); permissions.add(new PropertyPermission("java.io.tmpdir", "read")); + permissions.add(new PropertyPermission("testng.show.stack.frames", + "read")); + permissions.add(new PropertyPermission("testng.thread.affinity", "read")); + permissions.add(new PropertyPermission("testng.mode.dryrun", "read")); + permissions.add(new PropertyPermission("testng.report.xml.name", "read")); + permissions.add(new PropertyPermission("testng.timezone", "read")); + permissions.add(new ReflectPermission("suppressAccessChecks")); permissions.add(new FilePermission("<>", "read, write, delete")); }