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 * @library /lib/testlibrary
27 * @modules java.base/jdk.internal.module
28 * jdk.compiler
29 * @build ModuleReaderTest CompilerUtils JarUtils
30 * @run testng ModuleReaderTest
31 * @summary Basic tests for java.lang.module.ModuleReader
32 */
33
34 import java.io.File;
35 import java.io.IOException;
36 import java.io.InputStream;
37 import java.lang.module.ModuleFinder;
38 import java.lang.module.ModuleReader;
39 import java.lang.module.ModuleReference;
40 import java.net.URI;
41 import java.net.URL;
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.Arrays;
48 import java.util.HashSet;
49 import java.util.List;
50 import java.util.Optional;
51 import java.util.Set;
52 import java.util.stream.Collectors;
53 import java.util.spi.ToolProvider;
54
55 import jdk.internal.module.ModulePath;
56
57 import org.testng.annotations.BeforeTest;
58 import org.testng.annotations.Test;
59 import static org.testng.Assert.*;
60
61 @Test
62 public class ModuleReaderTest {
63
64 private static final String TEST_SRC = System.getProperty("test.src");
65
66 private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
67 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
68 private static final Path MODS_DIR = Paths.get("mods");
69
70 // the module name of the base module
71 private static final String BASE_MODULE = "java.base";
72
73 // the module name of the test module
74 private static final String TEST_MODULE = "m";
75
| 1 /*
2 * Copyright (c) 2015, 2017, 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 * @library /lib/testlibrary /test/lib
27 * @modules java.base/jdk.internal.module
28 * jdk.compiler
29 * @build ModuleReaderTest jdk.test.lib.compiler.CompilerUtils JarUtils
30 * @run testng ModuleReaderTest
31 * @summary Basic tests for java.lang.module.ModuleReader
32 */
33
34 import java.io.File;
35 import java.io.IOException;
36 import java.io.InputStream;
37 import java.lang.module.ModuleFinder;
38 import java.lang.module.ModuleReader;
39 import java.lang.module.ModuleReference;
40 import java.net.URI;
41 import java.net.URL;
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.Arrays;
48 import java.util.HashSet;
49 import java.util.List;
50 import java.util.Optional;
51 import java.util.Set;
52 import java.util.stream.Collectors;
53 import java.util.spi.ToolProvider;
54
55 import jdk.internal.module.ModulePath;
56 import jdk.test.lib.compiler.CompilerUtils;
57
58 import org.testng.annotations.BeforeTest;
59 import org.testng.annotations.Test;
60 import static org.testng.Assert.*;
61
62 @Test
63 public class ModuleReaderTest {
64
65 private static final String TEST_SRC = System.getProperty("test.src");
66
67 private static final Path USER_DIR = Paths.get(System.getProperty("user.dir"));
68 private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
69 private static final Path MODS_DIR = Paths.get("mods");
70
71 // the module name of the base module
72 private static final String BASE_MODULE = "java.base";
73
74 // the module name of the test module
75 private static final String TEST_MODULE = "m";
76
|