test/jdk/nio/zipfs/Basic.java

Print this page




  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.nio.file.*;
  25 import java.nio.file.attribute.*;
  26 import java.nio.file.spi.FileSystemProvider;
  27 import java.util.*;
  28 import java.net.URI;
  29 import java.io.IOException;
  30 
  31 /**
  32  *
  33  * @test
  34  * @bug 8038500
  35  * @summary Basic test for zip provider



  36  */
  37 
  38 public class Basic {
  39     public static void main(String[] args) throws Exception {
  40         Path zipfile = Paths.get(System.getProperty("test.jdk"),
  41                                  "jre/lib/ext/zipfs.jar");
  42         // Test: zip should should be returned in provider list
  43         boolean found = false;
  44 
  45         for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
  46             if (provider.getScheme().equalsIgnoreCase("jar")) {
  47                 found = true;
  48                 break;
  49             }
  50         }
  51         if (!found)
  52             throw new RuntimeException("'jar' provider not installed");
  53 
  54         // Test: FileSystems#newFileSystem(Path)
  55         Map<String,?> env = new HashMap<String,Object>();




  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.nio.file.*;
  25 import java.nio.file.attribute.*;
  26 import java.nio.file.spi.FileSystemProvider;
  27 import java.util.*;
  28 import java.net.URI;
  29 import java.io.IOException;
  30 
  31 /**
  32  *
  33  * @test
  34  * @bug 8038500 8040059
  35  * @summary Basic test for zip provider
  36  *
  37  * @run main Basic
  38  * @run main/othervm/policy=test.policy Basic
  39  */
  40 
  41 public class Basic {
  42     public static void main(String[] args) throws Exception {
  43         Path zipfile = Paths.get(System.getProperty("test.jdk"),
  44                                  "jre/lib/ext/zipfs.jar");
  45         // Test: zip should should be returned in provider list
  46         boolean found = false;
  47 
  48         for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
  49             if (provider.getScheme().equalsIgnoreCase("jar")) {
  50                 found = true;
  51                 break;
  52             }
  53         }
  54         if (!found)
  55             throw new RuntimeException("'jar' provider not installed");
  56 
  57         // Test: FileSystems#newFileSystem(Path)
  58         Map<String,?> env = new HashMap<String,Object>();