8163126: Fix @modules in some of jdk/* tests
authorshurailine
Mon, 22 Aug 2016 18:22:19 -0700
changeset 40531 d1fd060ce6b7
parent 40530 53bc022a137b
child 40532 6eb2dc8dffde
8163126: Fix @modules in some of jdk/* tests Reviewed-by: weijun, alanb, mchung
jdk/test/jdk/lambda/TEST.properties
jdk/test/jdk/modules/etc/VerifyModuleDelegation.java
jdk/test/jdk/modules/scenarios/container/ContainerTest.java
jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java
jdk/test/jdk/security/jarsigner/Spec.java
--- a/jdk/test/jdk/lambda/TEST.properties	Mon Aug 22 17:22:09 2016 -0700
+++ b/jdk/test/jdk/lambda/TEST.properties	Mon Aug 22 18:22:19 2016 -0700
@@ -3,4 +3,4 @@
 TestNG.dirs = .
 
 javatest.maxOutputSize = 250000
-modules = jdk.compiler
+modules = jdk.compiler jdk.zipfs
--- a/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Mon Aug 22 17:22:09 2016 -0700
+++ b/jdk/test/jdk/modules/etc/VerifyModuleDelegation.java	Mon Aug 22 18:22:19 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @summary Verify the defining class loader of each module never delegates
  *          to its child class loader. Also sanity check java.compact2
  *          requires.
+ * @modules java.compact2
  * @run testng/othervm --add-modules=ALL-SYSTEM VerifyModuleDelegation
  */
 
@@ -33,7 +34,9 @@
 import java.lang.module.ModuleFinder;
 import java.lang.module.ModuleReference;
 import java.lang.reflect.Layer;
+import java.lang.reflect.Module;
 import java.util.Set;
+import static java.util.stream.Collectors.toSet;
 
 import static java.lang.module.ModuleDescriptor.Requires.Modifier.*;
 
@@ -58,8 +61,9 @@
             .requires(Set.of(PUBLIC), "java.xml")
             .build();
 
-    private static final Set<ModuleReference> MREFS
-            = ModuleFinder.ofSystem().findAll();
+    private static final Set<ModuleDescriptor> MREFS
+            = Layer.boot().modules().stream().map(Module::getDescriptor)
+                .collect(toSet());
 
     private void check(ModuleDescriptor md, ModuleDescriptor ref) {
         assertTrue(md.requires().size() == ref.requires().size());
@@ -69,7 +73,7 @@
     @Test
     public void checkJavaBase() {
         ModuleDescriptor md =
-                MREFS.stream().map(ModuleReference::descriptor)
+                MREFS.stream()
                      .filter(d -> d.name().equals(JAVA_BASE))
                      .findFirst().orElseThrow(Error::new);
 
@@ -78,7 +82,7 @@
     @Test
     public void checkCompact2() {
         ModuleDescriptor md =
-                MREFS.stream().map(ModuleReference::descriptor)
+                MREFS.stream()
                      .filter(d -> d.name().equals(JAVA_COMPACT2))
                      .findFirst().orElseThrow(Error::new);
         check(md, COMPACT2);
@@ -87,7 +91,7 @@
     @Test
     public void checkLoaderDelegation() {
         Layer boot = Layer.boot();
-        MREFS.stream().map(ModuleReference::descriptor)
+        MREFS.stream()
              .forEach(md -> md.requires().stream().forEach(req ->
                  {
                      // check if M requires D and D's loader must be either the
--- a/jdk/test/jdk/modules/scenarios/container/ContainerTest.java	Mon Aug 22 17:22:09 2016 -0700
+++ b/jdk/test/jdk/modules/scenarios/container/ContainerTest.java	Mon Aug 22 18:22:19 2016 -0700
@@ -26,6 +26,8 @@
  * @library /lib/testlibrary
  * @modules jdk.jartool/sun.tools.jar
  *          jdk.compiler
+ *          jdk.zipfs
+ *          java.se
  * @build ContainerTest CompilerUtils jdk.testlibrary.*
  * @run testng ContainerTest
  * @summary Starts a simple container that uses dynamic configurations
--- a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Mon Aug 22 17:22:09 2016 -0700
+++ b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java	Mon Aug 22 18:22:19 2016 -0700
@@ -28,7 +28,7 @@
  * @library /lib/testlibrary/java/util/jar
  * @build Compiler JarBuilder CreateMultiReleaseTestJars
  * @run testng MultiReleaseJarTest
- * @modules java.compiler
+ * @modules jdk.compiler
  *          jdk.jartool
  *          jdk.zipfs
  */
--- a/jdk/test/jdk/security/jarsigner/Spec.java	Mon Aug 22 17:22:09 2016 -0700
+++ b/jdk/test/jdk/security/jarsigner/Spec.java	Mon Aug 22 18:22:19 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
  * @modules java.base/sun.security.tools.keytool
  *          java.base/sun.security.provider.certpath
  *          jdk.jartool
+ *          jdk.crypto.ec
  */
 
 import com.sun.jarsigner.ContentSigner;