36 import org.bar.ScalarTypes;
37 import org.bar.ScalarTypesWithDefault;
38 import org.bar.Point;
39 import org.openjdk.jigsaw.*;
40
41 /*
42 * @summary Test reading of annotations from the input module-info.class
43 * This references test/java/lang/annotation/UnitTest.java.
44 *
45 */
46 public class ModuleAnnotationTest {
47 private static JigsawModuleSystem ms = JigsawModuleSystem.instance();
48 private static int failCount = 0;
49 private static void fail(String test) {
50 System.out.println("Failure: " + test);
51 failCount++;
52 }
53
54 public static void main(String[] argv) throws Exception {
55 File libPath = new File(argv[0]);
56 Library lb = SimpleLibrary.open(libPath, false);
57
58 List<ModuleId> mids = lb.findModuleIds("test.foo.bar");
59 if (mids.size() != 1)
60 throw new RuntimeException("Installed modules: " + mids);
61
62 System.out.println("Installed module : " + mids);
63
64 for (ModuleId mid : mids) {
65 loadModule(lb, mid);
66 }
67
68 if (failCount > 0) {
69 throw new RuntimeException("Test failed: " + failCount);
70 }
71 }
72
73 static void loadModule(Library lb, ModuleId mid) throws Exception {
74 ModuleInfo mi = lb.readModuleInfo(mid);
75 if (mi == null)
76 throw new RuntimeException(mi + ": Can't read module-info");
|
36 import org.bar.ScalarTypes;
37 import org.bar.ScalarTypesWithDefault;
38 import org.bar.Point;
39 import org.openjdk.jigsaw.*;
40
41 /*
42 * @summary Test reading of annotations from the input module-info.class
43 * This references test/java/lang/annotation/UnitTest.java.
44 *
45 */
46 public class ModuleAnnotationTest {
47 private static JigsawModuleSystem ms = JigsawModuleSystem.instance();
48 private static int failCount = 0;
49 private static void fail(String test) {
50 System.out.println("Failure: " + test);
51 failCount++;
52 }
53
54 public static void main(String[] argv) throws Exception {
55 File libPath = new File(argv[0]);
56 Library lb = SimpleLibrary.open(libPath);
57
58 List<ModuleId> mids = lb.findModuleIds("test.foo.bar");
59 if (mids.size() != 1)
60 throw new RuntimeException("Installed modules: " + mids);
61
62 System.out.println("Installed module : " + mids);
63
64 for (ModuleId mid : mids) {
65 loadModule(lb, mid);
66 }
67
68 if (failCount > 0) {
69 throw new RuntimeException("Test failed: " + failCount);
70 }
71 }
72
73 static void loadModule(Library lb, ModuleId mid) throws Exception {
74 ModuleInfo mi = lb.readModuleInfo(mid);
75 if (mi == null)
76 throw new RuntimeException(mi + ": Can't read module-info");
|