CachePermissionsTest.java revision 1292
1292N/A * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. 1292N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1292N/A * This code is free software; you can redistribute it and/or modify it 1292N/A * under the terms of the GNU General Public License version 2 only, as 1292N/A * published by the Free Software Foundation. 1292N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1292N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1292N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1292N/A * version 2 for more details (a copy is included in the LICENSE file that 1292N/A * You should have received a copy of the GNU General Public License version 1292N/A * 2 along with this work; if not, write to the Free Software Foundation, 1292N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1292N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1292N/A * CA 95054 USA or visit www.sun.com if you need additional information or 1292N/A * @summary Test verifies that ImageIO checks all permissions required for 1292N/A * no policy file: No security restrictions. 1292N/A * Expected result: ImageIO creates file-cached stream. 1292N/A * w.policy: the case when we have read and write permissions 1292N/A * for java.io.temp directory but have only write permission 1292N/A * Expected result: ImageIO create a memory-cached stream 1292N/A * rw.policy: the case when we have read and write permissions 1292N/A * for java.io.temp directory but have only read and write 1292N/A * permission for a temp cache file. 1292N/A * Expected result: ImageIO creates a memory-cached stream 1292N/A * because temporary cache file can not be deleted. 1292N/A * rwd.policy: the case when we have read and write permissions 1292N/A * for java.io.temp directory and have all required permissions 1292N/A * (read, write, and delete) for a temporary cache file. 1292N/A * Expected result: ImageIO creates file-cached stream. 1292N/A * -Djava.security.debug=access can be used to verify file permissions. 1292N/A * @run main CachePermissionsTest true 1292N/A for (
int i =
0; i <
8192; i++) {
1292N/A for (
int i =
0; i <
8192; i++) {
1292N/A * We do not expect security execptions here: 1292N/A * we there are any security restrition, ImageIO 1292N/A * should swith to memory-cached streams, instead