1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8144355 8144062 8176709 |
26 * @bug 8144355 8144062 8176709 8194070 |
27 * @summary Test aliasing additions to ZipFileSystem for multi-release jar files |
27 * @summary Test aliasing additions to ZipFileSystem for multi-release jar files |
28 * @library /lib/testlibrary/java/util/jar |
28 * @library /lib/testlibrary/java/util/jar |
29 * @build Compiler JarBuilder CreateMultiReleaseTestJars |
29 * @build Compiler JarBuilder CreateMultiReleaseTestJars |
30 * @run testng MultiReleaseJarTest |
30 * @run testng MultiReleaseJarTest |
31 * @modules jdk.compiler |
31 * @modules jdk.compiler |
90 {"runtime", MAJOR_VERSION}, |
90 {"runtime", MAJOR_VERSION}, |
91 {"-20", 8}, |
91 {"-20", 8}, |
92 {"0", 8}, |
92 {"0", 8}, |
93 {"8", 8}, |
93 {"8", 8}, |
94 {"9", 9}, |
94 {"9", 9}, |
95 {"10", 10}, |
95 {Integer.toString(MAJOR_VERSION), MAJOR_VERSION}, |
96 {"11", 10}, |
96 {Integer.toString(MAJOR_VERSION+1), MAJOR_VERSION}, |
97 {"50", 10} |
97 {"50", MAJOR_VERSION} |
98 }; |
98 }; |
99 } |
99 } |
100 |
100 |
101 @DataProvider(name="integers") |
101 @DataProvider(name="integers") |
102 public Object[][] createIntegers() { |
102 public Object[][] createIntegers() { |
103 return new Object[][] { |
103 return new Object[][] { |
104 {new Integer(-5), 8}, |
104 {new Integer(-5), 8}, |
105 {new Integer(0), 8}, |
105 {new Integer(0), 8}, |
106 {new Integer(8), 8}, |
106 {new Integer(8), 8}, |
107 {new Integer(9), 9}, |
107 {new Integer(9), 9}, |
108 {new Integer(10), 10}, |
108 {new Integer(MAJOR_VERSION), MAJOR_VERSION}, |
109 {new Integer(11), 10}, |
109 {new Integer(MAJOR_VERSION + 1), MAJOR_VERSION}, |
110 {new Integer(100), 10} |
110 {new Integer(100), MAJOR_VERSION} |
111 }; |
111 }; |
112 } |
112 } |
113 |
113 |
114 @DataProvider(name="versions") |
114 @DataProvider(name="versions") |
115 public Object[][] createVersions() { |
115 public Object[][] createVersions() { |
116 return new Object[][] { |
116 return new Object[][] { |
117 {Version.parse("8"), 8}, |
117 {Version.parse("8"), 8}, |
118 {Version.parse("9"), 9}, |
118 {Version.parse("9"), 9}, |
119 {Version.parse("10"), 10}, |
119 {Version.parse("11"), MAJOR_VERSION}, |
120 {Version.parse("11"), 10}, |
120 {Version.parse("100"), MAJOR_VERSION} |
121 {Version.parse("100"), 10} |
|
122 }; |
121 }; |
123 } |
122 } |
124 |
123 |
125 // Not the best test but all I can do since ZipFileSystem and JarFileSystem |
124 // Not the best test but all I can do since ZipFileSystem and JarFileSystem |
126 // are not public, so I can't use (fs instanceof ...) |
125 // are not public, so I can't use (fs instanceof ...) |
166 runTest(versionEnv, expected); |
165 runTest(versionEnv, expected); |
167 } |
166 } |
168 |
167 |
169 @Test |
168 @Test |
170 public void testShortJar() throws Throwable { |
169 public void testShortJar() throws Throwable { |
171 integerEnv.put("multi-release", Integer.valueOf(10)); |
170 integerEnv.put("multi-release", Integer.valueOf(MAJOR_VERSION)); |
172 runTest(smruri, integerEnv, 10); |
171 runTest(smruri, integerEnv, MAJOR_VERSION); |
173 integerEnv.put("multi-release", Integer.valueOf(9)); |
172 integerEnv.put("multi-release", Integer.valueOf(9)); |
174 runTest(smruri, integerEnv, 8); |
173 runTest(smruri, integerEnv, 8); |
175 } |
174 } |
176 |
175 |
177 private void runTest(Map<String,?> env, int expected) throws Throwable { |
176 private void runTest(Map<String,?> env, int expected) throws Throwable { |