test/jdk/tools/jlink/JLinkSigningTest.java
author ihse
Tue, 22 Oct 2019 09:51:52 +0200
branchihse-cflags-rewrite-branch
changeset 58736 e878a0b7cff0
parent 47216 71c04702a3d5
permissions -rw-r--r--
Add doubunder on solaris in two places.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     1
/*
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     4
 *
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     7
 * published by the Free Software Foundation.
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     8
 *
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    13
 * accompanied this code).
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    14
 *
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    18
 *
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    21
 * questions.
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    22
 */
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    23
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    24
/*
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    25
 * @test
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    26
 * @bug 8159393
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    27
 * @summary Test signed jars involved in image creation
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    28
 * @modules java.base/jdk.internal.jimage
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    29
 *          java.base/sun.security.tools.keytool
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    31
 *          jdk.jartool/sun.security.tools.jarsigner
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    32
 *          jdk.jartool/sun.tools.jar
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    33
 *          jdk.jlink/jdk.tools.jlink.internal
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    34
 * @run main/othervm JLinkSigningTest
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    35
 */
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    36
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    37
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    38
import java.io.File;
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    39
import java.io.IOException;
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    40
import java.nio.file.Files;
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    41
import java.nio.file.Path;
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    42
import java.nio.file.Paths;
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    43
import java.util.Arrays;
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    44
import java.util.spi.ToolProvider;
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    45
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    46
public class JLinkSigningTest {
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    47
    private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    48
            .orElseThrow(() -> new RuntimeException("jar tool not found"));
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    49
    private static final ToolProvider JAVAC_TOOL = ToolProvider.findFirst("javac")
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    50
            .orElseThrow(() -> new RuntimeException("javac tool not found"));
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    51
    private static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    52
            .orElseThrow(() -> new RuntimeException("jlink tool not found"));
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    53
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    54
    static final String[] MODULE_INFO = {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    55
        "module test {",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    56
        "}",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    57
    };
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    58
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    59
    static final String[] TEST_CLASS = {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    60
        "package test;",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    61
        "public class test {",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    62
        "    public static void main(String[] args) {",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    63
        "    }",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    64
        "}",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    65
    };
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    66
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    67
    static void report(String command, String[] args) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    68
        System.out.println(command + " " + String.join(" ", Arrays.asList(args)));
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    69
    }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    70
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    71
    static void jar(String[] args) {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    72
        report("jar", args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    73
        JAR_TOOL.run(System.out, System.err, args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    74
    }
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    75
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    76
    static void jarsigner(String[] args) {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    77
        report("jarsigner", args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    78
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    79
        try {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    80
            sun.security.tools.jarsigner.Main.main(args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    81
        } catch (Exception ex) {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    82
            throw new RuntimeException("jarsigner not found");
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    83
        }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    84
    }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    85
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    86
    static void javac(String[] args) {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    87
        report("javac", args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    88
        JAVAC_TOOL.run(System.out, System.err, args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    89
    }
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    90
42151
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    91
    static void jlink(String[] args) {
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    92
        report("jlink", args);
8909334754c4 8169505: Update changes by JDK-8159393 to reflect CCC review
jlaskey
parents: 41919
diff changeset
    93
        JLINK_TOOL.run(System.out, System.err, args);
41919
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    94
    }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    95
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    96
    static void keytool(String[] args) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    97
        report("keytool", args);
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    98
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
    99
        try {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   100
            sun.security.tools.keytool.Main.main(args);
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   101
        } catch (Exception ex) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   102
            throw new RuntimeException("keytool failed");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   103
        }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   104
    }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   105
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   106
    public static void main(String[] args) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   107
        final String JAVA_HOME = System.getProperty("java.home");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   108
        Path moduleInfoJavaPath = Paths.get("module-info.java");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   109
        Path moduleInfoClassPath = Paths.get("module-info.class");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   110
        Path testDirectoryPath = Paths.get("test");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   111
        Path testJavaPath = testDirectoryPath.resolve("test.java");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   112
        Path testClassPath = testDirectoryPath.resolve("test.class");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   113
        Path testModsDirectoryPath = Paths.get("testmods");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   114
        Path jmodsPath = Paths.get(JAVA_HOME, "jmods");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   115
        Path testjarPath = testModsDirectoryPath.resolve("test.jar");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   116
        String modulesPath = testjarPath.toString() +
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   117
                             File.pathSeparator +
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   118
                             jmodsPath.toString();
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   119
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   120
        try {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   121
            Files.write(moduleInfoJavaPath, Arrays.asList(MODULE_INFO));
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   122
            Files.createDirectories(testDirectoryPath);
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   123
            Files.write(testJavaPath, Arrays.asList(TEST_CLASS));
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   124
            Files.createDirectories(testModsDirectoryPath);
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   125
        } catch (IOException ex) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   126
            throw new RuntimeException("file construction failed");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   127
        }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   128
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   129
        javac(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   130
            testJavaPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   131
            moduleInfoJavaPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   132
        });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   133
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   134
        jar(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   135
            "-c",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   136
            "-f", testjarPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   137
            "--module-path", jmodsPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   138
            testClassPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   139
            moduleInfoClassPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   140
        });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   141
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   142
        keytool(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   143
            "-genkey",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   144
            "-keyalg", "RSA",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   145
            "-dname", "CN=John Doe, OU=JPG, O=Oracle, L=Santa Clara, ST=California, C=US",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   146
            "-alias", "examplekey",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   147
            "-storepass", "password",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   148
            "-keypass", "password",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   149
            "-keystore", "examplekeystore",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   150
            "-validity", "365",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   151
        });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   152
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   153
        jarsigner(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   154
            "-keystore", "examplekeystore",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   155
            "-verbose", testjarPath.toString(),
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   156
            "-storepass", "password",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   157
            "-keypass", "password",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   158
            "examplekey",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   159
        });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   160
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   161
        try {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   162
            jlink(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   163
                "--module-path", modulesPath,
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   164
                "--add-modules", "test",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   165
                "--output", "foo",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   166
            });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   167
        } catch (Throwable ex) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   168
            System.out.println("Failed as should");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   169
        }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   170
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   171
        try {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   172
            jlink(new String[] {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   173
                "--module-path", modulesPath,
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   174
                "--add-modules", "test",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   175
                "--ignore-signing-information",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   176
                "--output", "foo",
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   177
            });
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   178
            System.out.println("Suceeded as should");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   179
        } catch (Throwable ex) {
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   180
            System.err.println("Should not have failed");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   181
            throw new RuntimeException(ex);
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   182
        }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   183
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   184
        System.out.println("Done");
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   185
    }
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   186
}
612b698f8b8f 8159393: jlink should print a warning that a signed modular JAR will be treated as unsigned
jlaskey
parents:
diff changeset
   187