< prev index next >

test/java/security/Policy/PolicyProvider/UseSystemClassLoader.java

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.File;
  25 import java.net.URL;
  26 import java.security.Policy;
  27 import java.security.Security;
  28 
  29 /*
  30  * @test
  31  * @bug 8075706
  32  * @summary Check that a custom policy provider can be loaded from the classpath

  33  * @run main/othervm UseSystemClassLoader CUSTOM
  34  * @run main/othervm UseSystemClassLoader DEFAULT
  35  * @run main/othervm UseSystemClassLoader NOT_AVAIL
  36  * @run main/othervm UseSystemClassLoader NOT_SET
  37  */
  38 
  39 public class UseSystemClassLoader {
  40 
  41     enum Type {
  42         CUSTOM, DEFAULT, NOT_AVAIL, NOT_SET
  43     };
  44 
  45     public static void main(String[] args) throws Exception {
  46 
  47         Type t = Type.valueOf(args[0]);
  48 
  49         // We can't use the jtreg java.security.policy option to specify
  50         // the policy file because that causes the default JDK policy provider
  51         // to be set and once set, we cannot change it. So, instead we use the
  52         // policy.url security property.




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.io.File;
  25 import java.net.URL;
  26 import java.security.Policy;
  27 import java.security.Security;
  28 
  29 /*
  30  * @test
  31  * @bug 8075706
  32  * @summary Check that a custom policy provider can be loaded from the classpath
  33  * @modules java.base/sun.security.provider
  34  * @run main/othervm UseSystemClassLoader CUSTOM
  35  * @run main/othervm UseSystemClassLoader DEFAULT
  36  * @run main/othervm UseSystemClassLoader NOT_AVAIL
  37  * @run main/othervm UseSystemClassLoader NOT_SET
  38  */
  39 
  40 public class UseSystemClassLoader {
  41 
  42     enum Type {
  43         CUSTOM, DEFAULT, NOT_AVAIL, NOT_SET
  44     };
  45 
  46     public static void main(String[] args) throws Exception {
  47 
  48         Type t = Type.valueOf(args[0]);
  49 
  50         // We can't use the jtreg java.security.policy option to specify
  51         // the policy file because that causes the default JDK policy provider
  52         // to be set and once set, we cannot change it. So, instead we use the
  53         // policy.url security property.


< prev index next >