jdk/test/demo/zipfs/ZFSTests.java
author tschatzl
Mon, 20 Jan 2014 11:47:07 +0100
changeset 22545 b93a7f0e9b9d
parent 12430 bd6e432b84ad
permissions -rw-r--r--
8027476: Improve performance of Stringtable unlink 8027455: Improve symbol table scan times during gc pauses Summary: Parallelize string table and symbol table scan during remark and full GC. Some additional statistics output if the experimental flag G1TraceStringSymbolTableScrubbing is set. Reviewed-by: mgerdin, coleenp, brutisso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12430
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     1
/*
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     4
 *
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     7
 * published by the Free Software Foundation.
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     8
 *
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    13
 * accompanied this code).
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    14
 *
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    18
 *
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    21
 * questions.
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    22
 */
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    23
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    24
/* @test
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    25
   @bug 7156873
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    26
   @summary ZipFileSystem regression tests
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    27
 */
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    28
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    29
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    30
import java.net.URI;
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    31
import java.nio.file.*;
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    32
import java.util.Map;
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    33
import java.util.HashMap;
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    34
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    35
public class ZFSTests {
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    36
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    37
    public static void main(String[] args) throws Throwable {
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    38
        test7156873();
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    39
    }
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    40
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    41
    static void test7156873() throws Throwable {
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    42
        String DIRWITHSPACE = "testdir with spaces";
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    43
        Path dir = Paths.get(DIRWITHSPACE);
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    44
        Path path = Paths.get(DIRWITHSPACE, "file.zip");
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    45
        try {
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    46
            Files.createDirectory(dir);
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    47
            URI uri = URI.create("jar:" + path.toUri());
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    48
            Map<String, Object> env = new HashMap<String, Object>();
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    49
            env.put("create", "true");
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    50
            try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {}
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    51
        } finally {
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    52
            Files.deleteIfExists(path);
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    53
            Files.deleteIfExists(dir);
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    54
        }
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    55
    }
bd6e432b84ad 7156873: (zipfs) FileSystems.newFileSystem(uri, env) fails for uri with escaped octets
sherman
parents:
diff changeset
    56
}