@Test publicvoid noServiceBinding() throws Throwable { if (!hasJmods()) return;
Path dir = Paths.get("noServiceBinding");
// no service binding and does not link m2,m3 providers.
JLink.run("--output", dir.toString(), "--module-path", MODULE_PATH, "--add-modules", "m1").output();
testImage(dir, "m1");
}
@Test publicvoid fullServiceBinding() throws Throwable { if (!hasJmods()) return;
Path dir = Paths.get("fullServiceBinding");
// full service binding // m2 is a provider used by m1. During service binding, when m2 is // resolved, m2 uses p2.T that causes m3 to be linked as it is a // provider to p2.T
JLink.run("--output", dir.toString(), "--module-path", MODULE_PATH, "--add-modules", "m1", "--bind-services", "--limit-modules", "m1,m2,m3");
testImage(dir, "m1", "m2", "m3");
}
@Test publicvoid testVerbose() throws Throwable { if (!hasJmods()) return;
List<String> expected = List.of( "m1 " + MODS_DIR.resolve("m1").toUri().toString(), "m2 " + MODS_DIR.resolve("m2").toUri().toString(), "m3 " + MODS_DIR.resolve("m3").toUri().toString(), "java.base provides java.nio.file.spi.FileSystemProvider used by java.base", "m1 provides p1.S used by m1", "m2 provides p1.S used by m1", "m2 provides p2.T used by m2", "m3 provides p2.T used by m2", "m3 provides p3.S not used by any observable module"
);
assertTrue(output.containsAll(expected));
testImage(dir, "m1", "m2", "m3");
}
@Test publicvoid testVerboseAndNoBindServices() throws Throwable { if (!hasJmods()) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.