--- 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(() ->