72 // test a .class file |
74 // test a .class file |
73 test(new File(testDir, "Test.class"), |
75 test(new File(testDir, "Test.class"), |
74 new String[] {"java.lang", "p"}, |
76 new String[] {"java.lang", "p"}, |
75 new String[] {"compact1", "not found"}); |
77 new String[] {"compact1", "not found"}); |
76 // test a directory |
78 // test a directory |
|
79 // also test non-SE javax.activity class dependency |
77 test(new File(testDir, "p"), |
80 test(new File(testDir, "p"), |
78 new String[] {"java.lang", "java.util", "java.lang.management"}, |
81 new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto"}, |
79 new String[] {"compact1", "compact1", "compact3"}); |
82 new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"}, |
|
83 new String[] {"-classpath", testDir.getPath()}); |
80 // test class-level dependency output |
84 // test class-level dependency output |
81 test(new File(testDir, "Test.class"), |
85 test(new File(testDir, "Test.class"), |
82 new String[] {"java.lang.Object", "java.lang.String", "p.Foo"}, |
86 new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, |
83 new String[] {"compact1", "compact1", "not found"}, |
87 new String[] {"compact1", "compact1", "not found", "not found"}, |
84 new String[] {"-verbose:class"}); |
88 new String[] {"-verbose:class"}); |
85 // test -p option |
89 // test -p option |
86 test(new File(testDir, "Test.class"), |
90 test(new File(testDir, "Test.class"), |
87 new String[] {"p.Foo"}, |
91 new String[] {"p.Foo", "p.Bar"}, |
88 new String[] {"not found"}, |
92 new String[] {"not found", "not found"}, |
89 new String[] {"-verbose:class", "-p", "p"}); |
93 new String[] {"-verbose:class", "-p", "p"}); |
90 // test -e option |
94 // test -e option |
91 test(new File(testDir, "Test.class"), |
95 test(new File(testDir, "Test.class"), |
92 new String[] {"p.Foo"}, |
96 new String[] {"p.Foo", "p.Bar"}, |
93 new String[] {"not found"}, |
97 new String[] {"not found", "not found"}, |
94 new String[] {"-verbose:class", "-e", "p\\..*"}); |
98 new String[] {"-verbose:class", "-e", "p\\..*"}); |
95 test(new File(testDir, "Test.class"), |
99 test(new File(testDir, "Test.class"), |
96 new String[] {"java.lang"}, |
100 new String[] {"java.lang"}, |
97 new String[] {"compact1"}, |
101 new String[] {"compact1"}, |
98 new String[] {"-verbose:package", "-e", "java\\.lang\\..*"}); |
102 new String[] {"-verbose:package", "-e", "java\\.lang\\..*"}); |
99 // test -classpath and -include options |
103 // test -classpath and -include options |
100 test(null, |
104 test(null, |
101 new String[] {"java.lang", "java.util", |
105 new String[] {"java.lang", "java.util", |
102 "java.lang.management"}, |
106 "java.lang.management", "javax.crypto"}, |
103 new String[] {"compact1", "compact1", "compact3"}, |
107 new String[] {"compact1", "compact1", "compact3", "compact1"}, |
104 new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"}); |
108 new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"}); |
105 test(new File(testDir, "Test.class"), |
109 test(new File(testDir, "Test.class"), |
106 new String[] {"java.lang.Object", "java.lang.String", "p.Foo"}, |
110 new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, |
107 new String[] {"compact1", "compact1", testDir.getName()}, |
111 new String[] {"compact1", "compact1", testDir.getName(), testDir.getName()}, |
108 new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"}); |
112 new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"}); |
|
113 |
|
114 // split package p - move p/Foo.class to dir1 and p/Bar.class to dir2 |
|
115 Path testClassPath = testDir.toPath(); |
|
116 Path dirP = testClassPath.resolve("p"); |
|
117 Path dir1 = testClassPath.resolve("dir1"); |
|
118 Path subdir1P = dir1.resolve("p"); |
|
119 Path dir2 = testClassPath.resolve("dir2"); |
|
120 Path subdir2P = dir2.resolve("p"); |
|
121 if (!Files.exists(subdir1P)) |
|
122 Files.createDirectories(subdir1P); |
|
123 if (!Files.exists(subdir2P)) |
|
124 Files.createDirectories(subdir2P); |
|
125 Files.move(dirP.resolve("Foo.class"), subdir1P.resolve("Foo.class"), REPLACE_EXISTING); |
|
126 Files.move(dirP.resolve("Bar.class"), subdir2P.resolve("Bar.class"), REPLACE_EXISTING); |
|
127 StringBuilder cpath = new StringBuilder(testDir.toString()); |
|
128 cpath.append(File.pathSeparator).append(dir1.toString()); |
|
129 cpath.append(File.pathSeparator).append(dir2.toString()); |
|
130 test(new File(testDir, "Test.class"), |
|
131 new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"}, |
|
132 new String[] {"compact1", "compact1", dir1.toFile().getName(), dir2.toFile().getName()}, |
|
133 new String[] {"-v", "-classpath", cpath.toString(), "Test.class"}); |
109 return errors; |
134 return errors; |
110 } |
135 } |
111 |
136 |
112 void test(File file, String[] expect, String[] profiles) { |
137 void test(File file, String[] expect, String[] profiles) { |
113 test(file, expect, profiles, new String[0]); |
138 test(file, expect, profiles, new String[0]); |