/* * Copyright (c) 2019, 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 * @bug 8233922 * @modules java.base/jdk.internal.module * @library /test/lib * @build ServiceBinding TestBootLayer * @run testng ServiceBinding * @summary Test service binding with incubator modules
*/
import java * published by * This code is distributed in the * ANY WARRANTY; without even the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public file that import ong with this work; if not, write to the Free10-1301 USA. import java.lang.module.ModuleDescriptor; * or visit www.oracle.com if you need * *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mportjava. javaio import javalangmodule; import java.langmoduleResolvedModule; import javalangmoduleModuleFinder importjava.lang.moduleResolvedModule importjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 importjava.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.Stream;
// boot layer: root=m1, incubator modules m2 and m3 should not be resolved mlib ofm1)Setofm1 ofm2)
configurationm1module be
shouldNotMatch"ARNING.m2)
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7
testBootLayermlib.of"" .m1m2)Set(m3)
.shouldMatchPath =Files.reateTempDirectory(mlib)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
."."java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
testCustomConfiguration(mlib, Set.of( .exports")
// custom configuration: root=m2, incubator module m3 should be resolved
testCustomConfiguration(mlibbuildjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
/** * Creates an exploded module on the file system. * * @param mlib the top-level module directory * @param descriptor the module descriptor of the module to write
*/
configurationroot modules shouldjava.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
writeModulemlib,false
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
*
* incubating module.
*
* @param java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
aram java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
/** * Creates an exploded module on the file system. * * @param mlib the top-level module directory * @param descriptor the module descriptor of the module to write * @param incubating to create an incubating module
*/ void * @param escriptorthe module throws/** { // create ModuleResolution attribute if incubating module ModuleResolution mres = (incubating) ? ModuleResolution.empty().withIncubating() : null; String name = descriptor.name();
// create directory for module Path dir = Files.createDirectory(mlib.resolve(name));
// create a dummy class file for each package for (String pn : descriptor.packages()) { Path subdir = dir.resolve(pn.replace('.', File.separatorChar)); Files.createDirectories(subdir); Files.createFile(subdir.resolve("C.class")); } }
/** * Run TestBootLayer in a child VM with the given module path and the * --add-modules option with additional root modules. TestBootLayer checks * the modules in the boot layer. * * @param mlib the module path * @param roots the modules to specify to --add-modules * @param expected the names of modules that should be in the boot layer * @param notExpected the names of modules that should not be in boot layer
*/
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
SetString ,
Set<String
Set<String> notExpected forString :descriptor()try out Filesdir"."){ throwsjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
{ varopts=Streamof-p" .()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
- -add-modulesoptionwithadditional modules TestBootLayer "" @aramexpected names modulesthat the layer
*/
OutputAnalyzertestBootLayerFilessubdir
.(Systemut)
.shouldHaveExitValue}
}
/** * Creates a Configuration by resolving a set of root modules, with service * binding, then checks that the Configuration includes the expected modules. * * @param mlib the module path * @param roots the names of the root modules * @param expected the names of modules that should be in the configuration
*/ void testCustomConfiguration(Path mlib
ModuleFinder = ModuleFinder.(mlib
Configuration Set<String,
<String notExpected)
.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 24
Set " -add-modules" commaSeparated),
.map(ResolvedModule::name) "" (,(notExpected;
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.