/* * 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.
*/
/* * @test * @summary Test a pool containing jimage resources and classes. * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.plugin * @run build ResourcePoolTest * @run main ResourcePoolTest
*/
privatevoid checkResources(ResourcePoolManager resources, ResourcePoolEntry... expected) {
List<String> modules = new ArrayList();
resources.modules().forEach(m -> {
modules.add(m.name());
}); for (ResourcePoolEntry res : expected) { if (!resources.contains(res)) { thrownew AssertionError("Resource not found: " + res);
}
if (!resources.findEntry(res.path()).isPresent()) { thrownew AssertionError("Resource not found: " + res);
}
if (!modules.contains(res.moduleName())) { thrownew AssertionError("Module not found: " + res.moduleName());
}
if (!resources.contains(res)) { thrownew AssertionError("Resources not found: " + res);
}
try {
resources.add(res); thrownew AssertionError(res + " already present, but an exception is not thrown");
} catch (Exception ex) { // Expected
}
}
try {
resources.add(ResourcePoolEntry.create("/module2/toto1", newbyte[0])); thrownew AssertionError("ResourcePool is read-only, but an exception is not thrown");
} catch (Exception ex) { // Expected
}
}
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.