< prev index next >

test/jdk/tools/jlink/JLinkTest.java

Print this page


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  27 import java.lang.module.ModuleDescriptor;
  28 import java.nio.file.Files;
  29 import java.nio.file.Path;
  30 import java.nio.file.Paths;
  31 import java.util.ArrayList;
  32 import java.util.Collections;
  33 import java.util.List;
  34 import java.util.spi.ToolProvider;
  35 import java.util.stream.Stream;
  36 
  37 import jdk.tools.jlink.plugin.Plugin;
  38 import jdk.tools.jlink.internal.PluginRepository;
  39 import tests.Helper;
  40 import tests.JImageGenerator;
  41 
  42 /*
  43  * @test
  44  * @summary Test image creation
  45  * @bug 8189777
  46  * @author Jean-Francois Denise

  47  * @library ../lib
  48  * @modules java.base/jdk.internal.jimage
  49  *          jdk.jdeps/com.sun.tools.classfile
  50  *          jdk.jlink/jdk.tools.jlink.internal
  51  *          jdk.jlink/jdk.tools.jlink.plugin
  52  *          jdk.jlink/jdk.tools.jimage
  53  *          jdk.compiler
  54  * @build tests.*
  55  * @run main/othervm -Xmx1g JLinkTest
  56  */
  57 public class JLinkTest {
  58     static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
  59         .orElseThrow(() ->
  60             new RuntimeException("jlink tool not found")
  61         );
  62 
  63     // number of built-in plugins from jdk.jlink module
  64     private static int getNumJlinkPlugins() {
  65         ModuleDescriptor desc = Plugin.class.getModule().getDescriptor();
  66         return desc.provides().stream()


   1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  27 import java.lang.module.ModuleDescriptor;
  28 import java.nio.file.Files;
  29 import java.nio.file.Path;
  30 import java.nio.file.Paths;
  31 import java.util.ArrayList;
  32 import java.util.Collections;
  33 import java.util.List;
  34 import java.util.spi.ToolProvider;
  35 import java.util.stream.Stream;
  36 
  37 import jdk.tools.jlink.plugin.Plugin;
  38 import jdk.tools.jlink.internal.PluginRepository;
  39 import tests.Helper;
  40 import tests.JImageGenerator;
  41 
  42 /*
  43  * @test
  44  * @summary Test image creation
  45  * @bug 8189777
  46  * @author Jean-Francois Denise
  47  * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g)
  48  * @library ../lib
  49  * @modules java.base/jdk.internal.jimage
  50  *          jdk.jdeps/com.sun.tools.classfile
  51  *          jdk.jlink/jdk.tools.jlink.internal
  52  *          jdk.jlink/jdk.tools.jlink.plugin
  53  *          jdk.jlink/jdk.tools.jimage
  54  *          jdk.compiler
  55  * @build tests.*
  56  * @run main/othervm -Xmx1g JLinkTest
  57  */
  58 public class JLinkTest {
  59     static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
  60         .orElseThrow(() ->
  61             new RuntimeException("jlink tool not found")
  62         );
  63 
  64     // number of built-in plugins from jdk.jlink module
  65     private static int getNumJlinkPlugins() {
  66         ModuleDescriptor desc = Plugin.class.getModule().getDescriptor();
  67         return desc.provides().stream()


< prev index next >