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 * @library /test/lib
27 * @modules java.base/jdk.internal.module
28 * @build MultiReleaseJarTest JarUtils
29 * @run testng MultiReleaseJarTest
30 * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarTest
31 * @summary Basic test of modular JARs as multi-release JARs
32 */
33
34 import java.io.File;
35 import java.io.InputStream;
36 import java.io.OutputStream;
37 import java.lang.module.ModuleDescriptor;
38 import java.lang.module.ModuleFinder;
39 import java.lang.module.ModuleReader;
40 import java.lang.module.ModuleReference;
41 import java.net.URI;
42 import java.net.URLConnection;
43 import java.nio.ByteBuffer;
44 import java.nio.file.Files;
45 import java.nio.file.Path;
46 import java.nio.file.Paths;
47 import java.util.ArrayList;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
51 import java.util.Map;
52 import java.util.Optional;
53 import java.util.Set;
54 import java.util.jar.Attributes;
55 import java.util.jar.Manifest;
56
57 import jdk.internal.module.ModuleInfoWriter;
58
59 import org.testng.annotations.Test;
60 import static org.testng.Assert.*;
61
62
63 @Test
64 public class MultiReleaseJarTest {
65
66 private static final String MODULE_INFO = "module-info.class";
67
68 private static final int VERSION = Runtime.version().major();
69
70 // are multi-release JARs enabled?
71 private static final boolean MULTI_RELEASE;
72 static {
73 String s = System.getProperty("jdk.util.jar.enableMultiRelease");
74 MULTI_RELEASE = (s == null || Boolean.parseBoolean(s));
75 }
76
77 /**
|
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 * @library /test/lib
27 * @modules java.base/jdk.internal.module
28 * @build MultiReleaseJarTest jdk.test.lib.util.JarUtils
29 * @run testng MultiReleaseJarTest
30 * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarTest
31 * @summary Basic test of modular JARs as multi-release JARs
32 */
33
34 import java.io.File;
35 import java.io.InputStream;
36 import java.io.OutputStream;
37 import java.lang.module.ModuleDescriptor;
38 import java.lang.module.ModuleFinder;
39 import java.lang.module.ModuleReader;
40 import java.lang.module.ModuleReference;
41 import java.net.URI;
42 import java.net.URLConnection;
43 import java.nio.ByteBuffer;
44 import java.nio.file.Files;
45 import java.nio.file.Path;
46 import java.nio.file.Paths;
47 import java.util.ArrayList;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
51 import java.util.Map;
52 import java.util.Optional;
53 import java.util.Set;
54 import java.util.jar.Attributes;
55 import java.util.jar.Manifest;
56
57 import jdk.internal.module.ModuleInfoWriter;
58 import jdk.test.lib.util.JarUtils;
59
60 import org.testng.annotations.Test;
61 import static org.testng.Assert.*;
62
63
64 @Test
65 public class MultiReleaseJarTest {
66
67 private static final String MODULE_INFO = "module-info.class";
68
69 private static final int VERSION = Runtime.version().major();
70
71 // are multi-release JARs enabled?
72 private static final boolean MULTI_RELEASE;
73 static {
74 String s = System.getProperty("jdk.util.jar.enableMultiRelease");
75 MULTI_RELEASE = (s == null || Boolean.parseBoolean(s));
76 }
77
78 /**
|