Merge
authoranazarov
Thu, 20 Apr 2017 22:46:22 -0700
changeset 44784 f2e3396a6a6b
parent 44782 15f36f4cf2b7 (current diff)
parent 44783 1b4068aea6df (diff)
child 44785 62a18e20f5c1
Merge
--- a/jdk/test/tools/jlink/bindservices/BindServices.java	Fri Apr 21 03:34:11 2017 +0000
+++ b/jdk/test/tools/jlink/bindservices/BindServices.java	Thu Apr 20 22:46:22 2017 -0700
@@ -149,6 +149,23 @@
         testImage(dir, "m1", "m2", "m3");
     }
 
+    @Test
+    public void testVerboseAndNoBindServices() throws Throwable {
+        if (!hasJmods()) return;
+
+        Path dir = Paths.get("verboseNoBind");
+
+        List<String> output =
+            JLink.run("--output", dir.toString(),
+                      "--module-path", MODULE_PATH,
+                      "--verbose",
+                      "--add-modules", "m1").output();
+
+        assertTrue(output.contains("m1 provides p1.S used by m1"));
+
+        testImage(dir, "m1");
+    }
+
     /*
      * Tests the given ${java.home} to only contain the specified modules
      */
--- a/jdk/test/tools/jlink/bindservices/SuggestProviders.java	Fri Apr 21 03:34:11 2017 +0000
+++ b/jdk/test/tools/jlink/bindservices/SuggestProviders.java	Thu Apr 20 22:46:22 2017 -0700
@@ -247,6 +247,42 @@
 
     }
 
+    @Test
+    public void suggestTypeNotRealProvider() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output =
+            JLink.run("--module-path", MODULE_PATH,
+                      "--add-modules", "m1",
+                      "--suggest-providers",
+                      "java.util.List").output();
+
+        System.out.println(output);
+        List<String> expected = List.of(
+            "No provider found for service specified to --suggest-providers: java.util.List"
+        );
+
+        assertTrue(output.containsAll(expected));
+    }
+
+    @Test
+    public void addNonObservableModule() throws Throwable {
+        if (!hasJmods()) return;
+
+        List<String> output =
+            JLink.run("--module-path", MODULE_PATH,
+                      "--add-modules", "nonExistentModule",
+                      "--suggest-providers",
+                      "java.nio.charset.spi.CharsetProvider").output();
+
+        System.out.println(output);
+        List<String> expected = List.of(
+            "jdk.charsets provides java.nio.charset.spi.CharsetProvider used by java.base"
+        );
+
+        assertTrue(output.containsAll(expected));
+    }
+
     static class JLink {
         static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
             .orElseThrow(() ->