< prev index next >

test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarProperties.java

Print this page




   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 8194070
  27  * @summary Test the System properties for JarFile that support multi-release jar files
  28  * @library /lib/testlibrary/java/util/jar
  29  * @build Compiler JarBuilder CreateMultiReleaseTestJars


  30  * @run testng MultiReleaseJarProperties
  31  * @run testng/othervm -Djdk.util.jar.version=0   MultiReleaseJarProperties
  32  * @run testng/othervm -Djdk.util.jar.version=8   MultiReleaseJarProperties
  33  * @run testng/othervm -Djdk.util.jar.version=9   MultiReleaseJarProperties
  34  * @run testng/othervm -Djdk.util.jar.version=100 MultiReleaseJarProperties
  35  * @run testng/othervm -Djdk.util.jar.version=8   -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  36  * @run testng/othervm -Djdk.util.jar.version=9   -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  37  * @run testng/othervm -Djdk.util.jar.version=8   -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  38  * @run testng/othervm -Djdk.util.jar.version=9   -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  39  * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  40  * @run testng/othervm -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  41  */
  42 
  43 import java.io.File;
  44 import java.io.IOException;
  45 import java.io.InputStream;
  46 import java.lang.invoke.MethodHandle;
  47 import java.lang.invoke.MethodHandles;
  48 import java.lang.invoke.MethodType;
  49 import java.net.URL;
  50 import java.net.URLClassLoader;
  51 import java.nio.file.Files;
  52 import java.util.jar.JarEntry;
  53 import java.util.jar.JarFile;
  54 




  55 import org.testng.Assert;
  56 import org.testng.annotations.AfterClass;
  57 import org.testng.annotations.BeforeClass;
  58 import org.testng.annotations.Test;
  59 
  60 
  61 public class MultiReleaseJarProperties {
  62     final static int BASE_VERSION = JarFile.baseVersion().major();
  63 
  64     final static String userdir = System.getProperty("user.dir", ".");
  65     final static File multirelease = new File(userdir, "multi-release.jar");
  66     protected int rtVersion;
  67     boolean force;
  68     protected ClassLoader cldr;
  69     protected Class<?> rootClass;
  70 
  71     @BeforeClass
  72     public void initialize() throws Exception {
  73         CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
  74         creator.compileEntries();




   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 8194070
  27  * @summary Test the System properties for JarFile that support multi-release jar files
  28  * @library /lib /test/lib
  29  * @build jdk.test.lib.compiler.Compiler
  30  *        jdk.test.lib.util.JarBuilder
  31  *        mrjar.CreateMultiReleaseTestJars
  32  * @run testng MultiReleaseJarProperties
  33  * @run testng/othervm -Djdk.util.jar.version=0   MultiReleaseJarProperties
  34  * @run testng/othervm -Djdk.util.jar.version=8   MultiReleaseJarProperties
  35  * @run testng/othervm -Djdk.util.jar.version=9   MultiReleaseJarProperties
  36  * @run testng/othervm -Djdk.util.jar.version=100 MultiReleaseJarProperties
  37  * @run testng/othervm -Djdk.util.jar.version=8   -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  38  * @run testng/othervm -Djdk.util.jar.version=9   -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  39  * @run testng/othervm -Djdk.util.jar.version=8   -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  40  * @run testng/othervm -Djdk.util.jar.version=9   -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  41  * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarProperties
  42  * @run testng/othervm -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarProperties
  43  */
  44 
  45 import java.io.File;
  46 import java.io.IOException;
  47 import java.io.InputStream;
  48 import java.lang.invoke.MethodHandle;
  49 import java.lang.invoke.MethodHandles;
  50 import java.lang.invoke.MethodType;
  51 import java.net.URL;
  52 import java.net.URLClassLoader;
  53 import java.nio.file.Files;
  54 import java.util.jar.JarEntry;
  55 import java.util.jar.JarFile;
  56 
  57 import jdk.test.lib.compiler.Compiler;
  58 import jdk.test.lib.util.JarBuilder;
  59 import mrjar.CreateMultiReleaseTestJars;
  60 
  61 import org.testng.Assert;
  62 import org.testng.annotations.AfterClass;
  63 import org.testng.annotations.BeforeClass;
  64 import org.testng.annotations.Test;
  65 
  66 
  67 public class MultiReleaseJarProperties {
  68     final static int BASE_VERSION = JarFile.baseVersion().major();
  69 
  70     final static String userdir = System.getProperty("user.dir", ".");
  71     final static File multirelease = new File(userdir, "multi-release.jar");
  72     protected int rtVersion;
  73     boolean force;
  74     protected ClassLoader cldr;
  75     protected Class<?> rootClass;
  76 
  77     @BeforeClass
  78     public void initialize() throws Exception {
  79         CreateMultiReleaseTestJars creator =  new CreateMultiReleaseTestJars();
  80         creator.compileEntries();


< prev index next >