/* * Copyright (c) 2017, 2018, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
@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 ist noch experimentell.