24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @summary Tests split packages |
26 * @summary Tests split packages |
27 * @library ../lib |
27 * @library ../lib |
28 * @build CompilerUtils JdepsUtil |
28 * @build CompilerUtils JdepsUtil |
29 * @modules jdk.jdeps/com.sun.tools.jdeps |
29 * @modules java.logging |
|
30 * jdk.jdeps/com.sun.tools.jdeps |
|
31 * jdk.unsupported |
30 * @run testng InverseDeps |
32 * @run testng InverseDeps |
31 */ |
33 */ |
32 |
34 |
33 import java.io.File; |
35 import java.io.File; |
34 import java.nio.file.Files; |
36 import java.nio.file.Files; |
85 }); |
87 }); |
86 JdepsUtil.createJar(LIBS_DIR.resolve(mn + ".jar"), root, entries); |
88 JdepsUtil.createJar(LIBS_DIR.resolve(mn + ".jar"), root, entries); |
87 } |
89 } |
88 } |
90 } |
89 } |
91 } |
|
92 @DataProvider(name = "jdkModules") |
|
93 public Object[][] jdkModules() { |
|
94 return new Object[][]{ |
|
95 // --require and a subset of dependences |
|
96 { "jdk.compiler", new String[][] { |
|
97 new String[] {"jdk.compiler", "jdk.jshell"}, |
|
98 new String[] {"jdk.compiler", "jdk.rmic"}, |
|
99 new String[] {"jdk.compiler", "jdk.javadoc", "jdk.rmic"}, |
|
100 } |
|
101 }, |
|
102 { "java.compiler", new String[][] { |
|
103 new String[] {"java.compiler", "jdk.jshell"}, |
|
104 new String[] {"java.compiler", "jdk.compiler", "jdk.jshell"}, |
|
105 new String[] {"java.compiler", "jdk.compiler", "jdk.rmic"}, |
|
106 new String[] {"java.compiler", "jdk.compiler", "jdk.javadoc", "jdk.rmic"}, |
|
107 new String[] {"java.compiler", "java.se", "java.se.ee"}, |
|
108 } |
|
109 }, |
|
110 }; |
|
111 } |
|
112 |
|
113 @Test(dataProvider = "jdkModules") |
|
114 public void testJDKModule(String moduleName, String[][] expected) throws Exception { |
|
115 // this invokes the jdeps launcher so that all system modules are observable |
|
116 JdepsRunner jdeps = JdepsRunner.run( |
|
117 "--inverse", "--require", moduleName |
|
118 ); |
|
119 List<String> output = Arrays.stream(jdeps.output()) |
|
120 .map(s -> s.trim()) |
|
121 .collect(Collectors.toList()); |
|
122 |
|
123 // verify the dependences |
|
124 assertTrue(Arrays.stream(expected) |
|
125 .map(path -> Arrays.stream(path) |
|
126 .collect(Collectors.joining(" <- "))) |
|
127 .anyMatch(output::contains)); |
|
128 } |
|
129 |
90 |
130 |
91 @DataProvider(name = "testrequires") |
131 @DataProvider(name = "testrequires") |
92 public Object[][] expected1() { |
132 public Object[][] expected1() { |
93 return new Object[][] { |
133 return new Object[][] { |
94 // --require and result |
134 // --require and result |