test/jdk/java/sql/testng/util/TestPolicy.java
changeset 55684 000138a6a4b3
parent 47216 71c04702a3d5
equal deleted inserted replaced
55683:b528b724b16d 55684:000138a6a4b3
     1 /*
     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    40 /*
    40 /*
    41  * Simple Policy class that supports the required Permissions to validate the
    41  * Simple Policy class that supports the required Permissions to validate the
    42  * JDBC concrete classes
    42  * JDBC concrete classes
    43  */
    43  */
    44 public class TestPolicy extends Policy {
    44 public class TestPolicy extends Policy {
       
    45     static final Policy DEFAULT_POLICY = Policy.getPolicy();
    45 
    46 
    46     final PermissionCollection permissions = new Permissions();
    47     final PermissionCollection permissions = new Permissions();
    47 
    48 
    48     /**
    49     /**
    49      * Constructor which sets the minimum permissions allowing testNG to work
    50      * Constructor which sets the minimum permissions allowing testNG to work
   135         return permissions;
   136         return permissions;
   136     }
   137     }
   137 
   138 
   138     @Override
   139     @Override
   139     public boolean implies(ProtectionDomain domain, Permission perm) {
   140     public boolean implies(ProtectionDomain domain, Permission perm) {
   140         return permissions.implies(perm);
   141         return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
   141     }
   142     }
   142 }
   143 }