< prev index next >

test/java/nio/file/WatchService/WithSecurityManager.java

Print this page




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 /* @test
  25  * @bug 4313887
  26  * @summary Unit test for Watchable#register's permission checks

  27  * @build WithSecurityManager
  28  * @run main/othervm WithSecurityManager denyAll.policy - fail
  29  * @run main/othervm WithSecurityManager denyAll.policy tree fail
  30  * @run main/othervm WithSecurityManager grantDirOnly.policy - pass
  31  * @run main/othervm WithSecurityManager grantDirOnly.policy tree fail
  32  * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy - pass
  33  * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy tree fail
  34  * @run main/othervm WithSecurityManager grantDirAndTree.policy - pass
  35  * @run main/othervm WithSecurityManager grantDirAndTree.policy tree pass
  36  */
  37 
  38 import java.nio.file.*;
  39 import java.io.IOException;
  40 import com.sun.nio.file.ExtendedWatchEventModifier;
  41 
  42 public class WithSecurityManager {
  43 
  44     public static void main(String[] args) throws IOException {
  45         String policyFile = args[0];
  46         boolean recursive = args[1].equals("tree");




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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 /* @test
  25  * @bug 4313887
  26  * @summary Unit test for Watchable#register's permission checks
  27  * @modules java.base/com.sun.nio.file
  28  * @build WithSecurityManager
  29  * @run main/othervm WithSecurityManager denyAll.policy - fail
  30  * @run main/othervm WithSecurityManager denyAll.policy tree fail
  31  * @run main/othervm WithSecurityManager grantDirOnly.policy - pass
  32  * @run main/othervm WithSecurityManager grantDirOnly.policy tree fail
  33  * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy - pass
  34  * @run main/othervm WithSecurityManager grantDirAndOneLevel.policy tree fail
  35  * @run main/othervm WithSecurityManager grantDirAndTree.policy - pass
  36  * @run main/othervm WithSecurityManager grantDirAndTree.policy tree pass
  37  */
  38 
  39 import java.nio.file.*;
  40 import java.io.IOException;
  41 import com.sun.nio.file.ExtendedWatchEventModifier;
  42 
  43 public class WithSecurityManager {
  44 
  45     public static void main(String[] args) throws IOException {
  46         String policyFile = args[0];
  47         boolean recursive = args[1].equals("tree");


< prev index next >