jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java
author okutsu
Fri, 17 Jun 2016 17:06:16 +0900
changeset 39051 1b0204c55914
parent 38747 469920616f3a
child 39734 7701942a1e7b
permissions -rw-r--r--
8158272: IncludeLocalesPluginTest.java fails with timeout 8158468: tools/jlink/plugins/IncludeLocalesPluginTest.java doesn't detect test failures Reviewed-by: alanb, mchung, naoto
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
import java.nio.file.Path;
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    25
import java.util.Arrays;
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    26
import java.util.ArrayList;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    27
import java.util.List;
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    28
import java.util.Locale;
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    29
import java.util.stream.Collectors;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    30
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    31
import jdk.tools.jlink.plugin.Plugin;
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    32
import jdk.tools.jlink.plugin.PluginException;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    33
import jdk.tools.jlink.internal.PluginRepository;
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    34
import jdk.tools.jlink.internal.TaskHelper;
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    35
import jdk.tools.jlink.internal.plugins.PluginsResourceBundle;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    36
import tests.Helper;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import tests.JImageGenerator;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import tests.JImageValidator;
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    39
import tests.Result;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    40
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    41
/*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    42
 * @test
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    43
 * @bug 8152143 8152704 8155649
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    44
 * @summary IncludeLocalesPlugin tests
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    45
 * @author Naoto Sato
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    46
 * @library ../../lib
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    47
 * @modules java.base/jdk.internal.jimage
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    48
 *          jdk.jdeps/com.sun.tools.classfile
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    49
 *          jdk.jlink/jdk.tools.jlink.internal
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    50
 *          jdk.jlink/jdk.tools.jlink.internal.plugins
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    51
 *          jdk.jlink/jdk.tools.jmod
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    52
 *          jdk.jlink/jdk.tools.jimage
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    53
 *          jdk.compiler
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    54
 * @build tests.*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    55
 * @build tools.jlink.plugins.GetAvailableLocales
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    56
 * @run main/othervm -Xmx1g IncludeLocalesPluginTest
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    57
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    58
public class IncludeLocalesPluginTest {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    59
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    60
    private final static String moduleName = "IncludeLocalesTest";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    61
    private static Helper helper;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    62
    private final static int INCLUDE_LOCALES_OPTION = 0;
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    63
    private final static int ADDMODS_OPTION         = 1;
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    64
    private final static int EXPECTED_LOCATIONS     = 2;
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    65
    private final static int UNEXPECTED_PATHS       = 3;
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    66
    private final static int AVAILABLE_LOCALES      = 4;
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    67
    private final static int ERROR_MESSAGE          = 5;
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    68
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    69
    private static int errors;
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    70
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    71
    private final static Object[][] testData = {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    72
        // without --include-locales option: should include all locales
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    73
        {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    74
            "",
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    75
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    76
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    77
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    78
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    79
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    80
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    81
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    82
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    83
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    84
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    85
            List.of(),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    86
            Arrays.stream(Locale.getAvailableLocales())
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    87
                  // "(root)" for Locale.ROOT rather than ""
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    88
                  .map(loc -> loc.equals(Locale.ROOT) ? "(root)" : loc.toString())
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    89
                  .collect(Collectors.toList()),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
    90
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    91
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    92
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
    93
        // All English and Japanese locales
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    94
        {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    95
            "--include-locales=en,ja",
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
    96
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    97
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    98
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    99
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   100
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   101
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   102
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   103
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   104
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   105
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   106
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   107
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   108
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   109
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   110
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   111
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   112
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   113
                "(root)", "en", "en_001", "en_150", "en_AG", "en_AI", "en_AS", "en_AT",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   114
                "en_AU", "en_BB", "en_BE", "en_BI", "en_BM", "en_BS", "en_BW", "en_BZ",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   115
                "en_CA", "en_CC", "en_CH", "en_CK", "en_CM", "en_CX", "en_CY", "en_DE",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   116
                "en_DG", "en_DK", "en_DM", "en_ER", "en_FI", "en_FJ", "en_FK", "en_FM",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   117
                "en_GB", "en_GD", "en_GG", "en_GH", "en_GI", "en_GM", "en_GU", "en_GY",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   118
                "en_HK", "en_IE", "en_IL", "en_IM", "en_IN", "en_IO", "en_JE", "en_JM",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   119
                "en_KE", "en_KI", "en_KN", "en_KY", "en_LC", "en_LR", "en_LS", "en_MG",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   120
                "en_MH", "en_MO", "en_MP", "en_MS", "en_MT", "en_MU", "en_MW", "en_MY",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   121
                "en_NA", "en_NF", "en_NG", "en_NL", "en_NR", "en_NU", "en_NZ", "en_PG",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   122
                "en_PH", "en_PK", "en_PN", "en_PR", "en_PW", "en_RW", "en_SB", "en_SC",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   123
                "en_SD", "en_SE", "en_SG", "en_SH", "en_SI", "en_SL", "en_SS", "en_SX",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   124
                "en_SZ", "en_TC", "en_TK", "en_TO", "en_TT", "en_TV", "en_TZ", "en_UG",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   125
                "en_UM", "en_US", "en_US_POSIX", "en_VC", "en_VG", "en_VI", "en_VU",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   126
                "en_WS", "en_ZA", "en_ZM", "en_ZW", "ja", "ja_JP",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   127
                "ja_JP_JP_#u-ca-japanese"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   128
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   129
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   130
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   131
        // All locales in India
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   132
        {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   133
            "--include-locales=*-IN",
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   134
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   135
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   136
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_IN.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   137
                "/jdk.localedata/sun/text/resources/ext/FormatData_hi_IN.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   138
                "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_as_IN.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   139
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   140
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_IN.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   141
                "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_kok_IN.class",
38747
469920616f3a 8145136: Upgrade CLDR locale data
rgoel
parents: 37790
diff changeset
   142
                "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_pa_Guru_IN.class"),
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   143
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   144
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   145
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   146
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   147
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   148
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   149
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   150
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   151
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   152
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   153
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   154
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   155
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   156
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   157
                "(root)", "as_IN", "bn_IN", "bo_IN", "brx_IN", "en", /* "en_001", */
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   158
                "en_IN", "en_US", "en_US_POSIX", "gu_IN", "hi_IN", "kn_IN", "kok_IN",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   159
                "ks_IN", "ml_IN", "mr_IN", "ne_IN", "or_IN", "pa_IN", "pa_IN_#Guru",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   160
                "ta_IN", "te_IN", "ur_IN"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   161
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   162
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   163
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   164
        // Thai
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   165
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   166
            "--include-locales=th",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   167
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   168
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   169
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   170
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   171
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   172
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   173
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   174
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   175
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   176
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   177
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   178
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   179
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   180
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   181
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   182
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   183
                "(root)", "en", "en_US", "en_US_POSIX", "th", "th_TH",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   184
                "th_TH_TH_#u-nu-thai"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   185
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   186
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   187
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   188
        // Hong Kong
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   189
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   190
            "--include-locales=zh-HK",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   191
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   192
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   193
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   194
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh_HK.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   195
                "/jdk.localedata/sun/text/resources/ext/FormatData_zh_TW.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   196
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   197
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   198
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   199
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   200
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   201
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   202
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   203
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   204
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   205
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   206
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   207
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   208
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   209
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   210
                "(root)", "en", "en_US", "en_US_POSIX", "zh_HK", "zh_HK_#Hans",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   211
                "zh_HK_#Hant"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   212
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   213
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   214
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   215
        // Norwegian
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   216
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   217
            "--include-locales=nb,nn,no",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   218
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   219
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   220
                "/jdk.localedata/sun/text/resources/ext/FormatData_no.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   221
                "/jdk.localedata/sun/text/resources/ext/FormatData_no_NO.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   222
                "/jdk.localedata/sun/text/resources/ext/FormatData_no_NO_NY.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   223
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   224
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   225
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   226
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   227
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   228
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   229
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   230
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   231
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   232
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   233
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   234
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   235
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   236
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   237
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   238
                "(root)", "en", "en_US", "en_US_POSIX", "nb", "nb_NO", "nb_SJ", "nn",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   239
                "nn_NO", "no", "no_NO", "no_NO_NY"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   240
            "",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   241
        },
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   242
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   243
        // Hebrew/Indonesian/Yiddish
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   244
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   245
            "--include-locales=he,id,yi",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   246
            "jdk.localedata",
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   247
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   248
                "/jdk.localedata/sun/text/resources/ext/FormatData_in.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   249
                "/jdk.localedata/sun/text/resources/ext/FormatData_in_ID.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   250
                "/jdk.localedata/sun/text/resources/ext/FormatData_iw.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   251
                "/jdk.localedata/sun/text/resources/ext/FormatData_iw_IL.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   252
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_in.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   253
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   254
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   255
            List.of(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   256
                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   257
                "/jdk.localedata/sun/text/resources/thai_dict",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   258
                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   259
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   260
                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   261
                "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   262
                "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   263
                "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   264
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   265
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   266
                "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   267
            List.of(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   268
                "(root)", "en", "en_US", "en_US_POSIX", "in", "in_ID", "iw", "iw_IL",
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   269
                "ji", "ji_001"),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   270
            "",
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   271
        },
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   272
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   273
        // Error case: No matching locales
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   274
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   275
            "--include-locales=xyz",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   276
            "jdk.localedata",
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   277
            null,
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   278
            null,
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   279
            null,
36739
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   280
            new PluginException(String.format(
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   281
                PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"), "xyz"))
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   282
                .getMessage(),
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   283
        },
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   284
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   285
        // Error case: Invalid argument
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   286
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   287
            "--include-locales=en,zh_HK",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   288
            "jdk.localedata",
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   289
            null,
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   290
            null,
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   291
            null,
36739
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   292
            new PluginException(String.format(
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   293
                PluginsResourceBundle.getMessage("include-locales.invalidtag"), "zh_HK"))
145210aba850 8152704: jlink command line output/help message improvement
naoto
parents: 36666
diff changeset
   294
                .getMessage(),
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   295
        },
37790
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   296
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   297
        // Error case: jdk.localedata is not added
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   298
        {
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   299
            "--include-locales=en-US",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   300
            "java.base",
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   301
            null,
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   302
            null,
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   303
            null,
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   304
            new PluginException(
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   305
                PluginsResourceBundle.getMessage("include-locales.localedatanotfound"))
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   306
                .getMessage(),
71c730d5e73a 8155649: IncludeLocalesPlugin throws NPE when jdk.localedata not resolved
naoto
parents: 36739
diff changeset
   307
        },
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   308
    };
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   309
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   310
    public static void main(String[] args) throws Exception {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   311
        helper = Helper.newHelper();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   312
        if (helper == null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   313
            System.err.println("Test not run");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   314
            return;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   315
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   316
        helper.generateDefaultModules();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   317
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   318
        for (Object[] data : testData) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   319
            // create image for each test data
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   320
            System.out.println("Invoking jlink with \"" + data[INCLUDE_LOCALES_OPTION] + "\"");
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   321
            Result result = JImageGenerator.getJLinkTask()
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   322
                    .modulePath(helper.defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   323
                    .output(helper.createNewImageDir(moduleName))
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   324
                    .addMods((String) data[ADDMODS_OPTION])
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   325
                    .option((String) data[INCLUDE_LOCALES_OPTION])
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   326
                    .call();
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   327
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   328
            String errorMsg = (String) data[ERROR_MESSAGE];
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   329
            if (errorMsg.isEmpty()) {
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   330
                Path image = result.assertSuccess();
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   331
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   332
                // test locale data entries
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   333
                testLocaleDataEntries(image,
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   334
                    (List<String>) data[EXPECTED_LOCATIONS],
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   335
                    (List<String>) data[UNEXPECTED_PATHS]);
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   336
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   337
                // test available locales
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   338
                testAvailableLocales(image, (List<String>) data[AVAILABLE_LOCALES]);
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   339
            } else {
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   340
                result.assertFailure(new TaskHelper(TaskHelper.JLINK_BUNDLE)
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   341
                    .getMessage("error.prefix") + " " +errorMsg);
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   342
                System.out.println("\tExpected failure: " + result.getMessage());
36666
bf6dce37a2f0 8152143: jlink --include-locales should gracefully detect certain user error
naoto
parents: 36511
diff changeset
   343
            }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   344
        }
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   345
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   346
        if (errors > 0) {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   347
            throw new RuntimeException("Test failed");
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   348
        }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   349
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   350
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   351
    private static void testLocaleDataEntries(Path image, List<String> expectedLocations,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   352
                        List<String> unexpectedPaths) throws Exception {
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   353
        System.out.println("testLocaleDataEntries:");
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   354
        try {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   355
            JImageValidator.validate(
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   356
                image.resolve("lib").resolve("modules"),
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   357
                expectedLocations, unexpectedPaths);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   358
        } catch (Exception e) {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   359
            System.out.println("\tFailed with: " + e);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   360
            e.printStackTrace();
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   361
            errors++;
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   362
        }
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   363
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   364
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   365
    private static void testAvailableLocales(Path image, List<String> availableLocales) throws Exception {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   366
        System.out.println("testAvailableLocales:");
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   367
        Path launcher = image.resolve("bin/java" +
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   368
            (System.getProperty("os.name").startsWith("Windows") ? ".exe" : ""));
39051
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   369
        List<String> args = new ArrayList<>(availableLocales.size() + 2);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   370
        args.add(launcher.toString());
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   371
        args.add("GetAvailableLocales");
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   372
        args.addAll(availableLocales);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   373
        Process proc = new ProcessBuilder(args).inheritIO().start();
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   374
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   375
        int len = Math.min(10, args.size());
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   376
        String command = args.subList(0, len).stream().collect(Collectors.joining(" "))
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   377
                         + (len < availableLocales.size() ? " ..." : "");
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   378
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   379
        int status = proc.waitFor();
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   380
        if (status == 0) {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   381
            System.out.println("\tDone\t" + command);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   382
        } else {
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   383
            System.out.println("\tExit " + status + "\t" + command);
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   384
            errors++;
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   385
        }
1b0204c55914 8158272: IncludeLocalesPluginTest.java fails with timeout
okutsu
parents: 38747
diff changeset
   386
        System.out.println();
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   387
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   388
}