/* * 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. * Please contact Oracle * * or visit www.oracle.com if * *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.OutputStream import...ModuleDescriptor import...ResolvedModule; import...;
javalang.;
* import java.nio.file.Files; import java.util.List; import java.util.Set; import java .utilSetjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
am.; import java.util.stream.Stream;
....;
import jdkinternalmodule;
jdk.module;
mport
import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.importjdk..java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 7
Test public ServiceBinding
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/**writeIncubatingModule, m2)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 * module m1 uses p.S * (incubating) module m2 requires m1 provides p.S
*/
("ARNING:.";
Path=.HEREmlibjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
* (incubating) module m2 * testBootLayer(mlib, var m2 = newModule testCustomConfiguration(mlib, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=.("
(mlib ("
var (" rovides(p. of"."java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
testBootLayer,Set(m1)Set.",.("")
shouldNotMatchWARNING.m2;
/** * module m1 uses p.S * (incubating) module m2 requires m1 provides P.S uses q.S * (incubating) module m3 requires m2 provides q.S
*/ publicjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mlib Files.reateTempDirectory(mlib";
java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82 var ("
.requires("m1") // custom configuration: root=m1, incubator modules m2 and m3 should be resolved
exports(q"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.(); var newModulem3)requires.q".")();
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
writeIncubatingModule
// custom:root,modules be
java.lang.StringIndexOutOfBoundsException: Range [0, 52) out of bounds for length 0
(WARNING"
.shouldNotMatch("WARNING:.*m3") *
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
testBootLayer,.ofm2,Setof"@ towrite
.shouldMatch("WARNING:.*m2")
.shouldNotMatch(" writeModule *
// custom configuration: root=m1, incubator modules m2 and m3 should be resolved
// custom configuration: root=m2, incubator module m3 should be resolved testCustomConfiguration(mlib, Set.of("m2"), Set.of("m1", "m2", "m3")); }
/** * 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
*/ void writeModule(Path mlib, ModuleDescriptor
writeModule Creates java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
/** * Creates an exploded module on the file system. The module will be an * incubating module. * * @param mlib the top-level module directory * @param descriptor the module descriptor of the module to write
*/ void writeIncubatingModule*@aram .write,mres out)
writeModule(mlib, descriptor, true);
}
/** * 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
*/
* Run TestBootLayer Exception throws Exception
{ // create ModuleResolution attribute if incubating module
ModuleResolutionModuleResolution param the to to-add-modules
String .()
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 0
Path .(.resolve); <>roots
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 try out .(.(module-info)) java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
.write
}
Files.(subdirresolve( java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 for (String pn"-add-modules* -add-modules option with root modules. TestBootLayer
Path * "estBootLayer" *@ the ofmodules shouldbein boot
.createDirectoriesubdir
errorTo.ut)
}
/** * 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
*/
OutputAnalyzer testBootLayer(Path mlib finder ModuleFinderof);
> roots
Set<String> expected,
Set<String> notExpected) throws Exception
{ varthrowsException
--add-modules commaSeparatedroots, "TestBootLayer", commaSeparated(expected), commaSeparated(notExpected)); return ProcessTools.executeTestJava TestBootLayercommaSeparated) commaSeparatednotExpected;
outputToSystem)
. outputTo(.out
.shouldHaveExitValue(0.shouldHaveExitValue0;
/** * 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, Set<String> *@ mlib modulepath
ModuleFinder =ModuleFindero();
Configuration sstream java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
.configuration cf=.()
.resolveAndBind(finder, ModuleFinder.resolveAndBind(, ModuleFinder() );
expected.stream()
.filter(mn -> !modules.contains(mn))
.findAny.stream
.(mn >{ thrownew RuntimeException(mn + " not in configuration!!!");
});
}
String commaSeparated(Set<String> s) {
}
}
Messung V0.5
¤ 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.0.6Bemerkung:
¤
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.