< prev index next >

jdk/test/java/util/jar/JarFile/MultiReleaseJarAPI.java

Print this page


   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   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 /*
  25  * @test
  26  * @bug 8132734
  27  * @summary Test the extended API and the aliasing additions in JarFile that
  28  *          support multi-release jar files
  29  * @library /lib/testlibrary/java/util/jar
  30  * @build Compiler JarBuilder CreateMultiReleaseTestJars
  31  * @run testng MultiReleaseJarAPI
  32  */
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.io.InputStream;
  37 import java.nio.file.Files;
  38 import java.util.Arrays;
  39 import java.util.jar.JarFile;
  40 import java.util.zip.ZipEntry;
  41 import java.util.zip.ZipFile;
  42 import jdk.Version;
  43 
  44 import static java.util.jar.JarFile.Release;
  45 
  46 import org.testng.Assert;
  47 import org.testng.annotations.AfterClass;
  48 import org.testng.annotations.BeforeClass;
  49 import org.testng.annotations.Test;
  50 
  51 
  52 public class MultiReleaseJarAPI {
  53 
  54     static final int MAJOR_VERSION = Version.current().major();
  55 
  56     String userdir = System.getProperty("user.dir",".");
  57     CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
  58     File unversioned = new File(userdir, "unversioned.jar");
  59     File multirelease = new File(userdir, "multi-release.jar");
  60     File signedmultirelease = new File(userdir, "signed-multi-release.jar");
  61     Release[] values = JarFile.Release.values();
  62 
  63 
  64     @BeforeClass
  65     public void initialize() throws Exception {
  66         creator.compileEntries();
  67         creator.buildUnversionedJar();
  68         creator.buildMultiReleaseJar();
  69         creator.buildSignedMultiReleaseJar();
  70     }
  71 
  72     @AfterClass
  73     public void close() throws IOException {
  74         Files.delete(unversioned.toPath());


   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   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 /*
  25  * @test
  26  * @bug 8132734 8144062
  27  * @summary Test the extended API and the aliasing additions in JarFile that
  28  *          support multi-release jar files
  29  * @library /lib/testlibrary/java/util/jar
  30  * @build Compiler JarBuilder CreateMultiReleaseTestJars
  31  * @run testng MultiReleaseJarAPI
  32  */
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.io.InputStream;
  37 import java.nio.file.Files;
  38 import java.util.Arrays;
  39 import java.util.jar.JarFile;
  40 import java.util.zip.ZipEntry;
  41 import java.util.zip.ZipFile;

  42 
  43 import static java.util.jar.JarFile.Release;
  44 
  45 import org.testng.Assert;
  46 import org.testng.annotations.AfterClass;
  47 import org.testng.annotations.BeforeClass;
  48 import org.testng.annotations.Test;
  49 
  50 
  51 public class MultiReleaseJarAPI {
  52 
  53     static final int MAJOR_VERSION = Runtime.version().major();
  54 
  55     String userdir = System.getProperty("user.dir",".");
  56     CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
  57     File unversioned = new File(userdir, "unversioned.jar");
  58     File multirelease = new File(userdir, "multi-release.jar");
  59     File signedmultirelease = new File(userdir, "signed-multi-release.jar");
  60     Release[] values = JarFile.Release.values();
  61 
  62 
  63     @BeforeClass
  64     public void initialize() throws Exception {
  65         creator.compileEntries();
  66         creator.buildUnversionedJar();
  67         creator.buildMultiReleaseJar();
  68         creator.buildSignedMultiReleaseJar();
  69     }
  70 
  71     @AfterClass
  72     public void close() throws IOException {
  73         Files.delete(unversioned.toPath());


< prev index next >