/* * Copyright (c) 2015, 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.
*/
// This test case must be first one, the JlinkTask is clean // and reveals possible bug related to plugin options in defaults
testSameNames(helper);
testOptions();
}
privatestaticvoid testSameNames(Helper helper) throws Exception { // Multiple modules with the same name in modulepath, take the first one in the path. // First jmods then jars. So jmods are found, jars are hidden.
String[] jarClasses = {"amodule.jar.Main"};
String[] jmodsClasses = {"amodule.jmods.Main"};
helper.generateDefaultJarModule("amodule", Arrays.asList(jarClasses));
helper.generateDefaultJModule("amodule", Arrays.asList(jmodsClasses));
List<String> okLocations = new ArrayList<>();
okLocations.addAll(Helper.toLocation("amodule", Arrays.asList(jmodsClasses)));
Path image = helper.generateDefaultImage(new String[0], "amodule").assertSuccess();
JImageValidator validator = new JImageValidator("amodule", okLocations,
image.toFile(), Collections.emptyList(), Collections.emptyList());
validator.validate();
}
privatestaticvoid testOptions() throws Exception {
List<Plugin> builtInPlugins = new ArrayList<>();
builtInPlugins.addAll(PluginRepository.getPlugins(ModuleLayer.boot())); if(builtInPlugins.isEmpty()) { thrownew Exception("No builtin plugins");
}
List<String> options = new ArrayList<>(); for (Plugin p : builtInPlugins) { if (p.getOption() == null) { thrownew Exception("Null option for " + p.getName());
} if (options.contains(p.getName())) { thrownew Exception("Option " + p.getOption() + " used more than once");
}
options.add(p.getName());
}
}
}
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.