langtools/test/jdk/javadoc/tool/VerifyLocale.java
changeset 36705 890c250d8da8
parent 35426 374342e56a56
child 36709 f9f252088afa
equal deleted inserted replaced
36503:4a95f4b1bd8b 36705:890c250d8da8
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8035473
    26  * @bug 8035473
    27  * @summary Verify that init method works correctly.
    27  * @summary Verify that init method works correctly.
       
    28  * @ignore 8149565
    28  * @modules jdk.javadoc
    29  * @modules jdk.javadoc
    29  */
    30  */
    30 
    31 
    31 import java.util.Collections;
    32 import java.util.Collections;
    32 import java.util.Locale;
    33 import java.util.Locale;
    38 import jdk.javadoc.doclet.Doclet;
    39 import jdk.javadoc.doclet.Doclet;
    39 import jdk.javadoc.doclet.Reporter;
    40 import jdk.javadoc.doclet.Reporter;
    40 import jdk.javadoc.doclet.DocletEnvironment;
    41 import jdk.javadoc.doclet.DocletEnvironment;
    41 
    42 
    42 public class VerifyLocale implements Doclet {
    43 public class VerifyLocale implements Doclet {
       
    44     static String language;
       
    45     static String country;
       
    46     static String variant;
       
    47 
    43     Locale locale;
    48     Locale locale;
    44     Reporter reporter;
    49     Reporter reporter;
    45 
    50 
    46     public static void main(String[] args) {
    51     public static void main(String[] args) {
    47         String thisFile = "" +
    52         String thisFile = "" +
    48             new java.io.File(System.getProperty("test.src", "."),
    53             new java.io.File(System.getProperty("test.src", "."),
    49                              "VerifyLocale.java");
    54                              "VerifyLocale.java");
    50 
    55 
    51         String[] argarray = {
    56         for (Locale loc : Locale.getAvailableLocales()) {
    52             // jumble the options in some weird order
    57             language = loc.getLanguage();
    53             "-doclet", "VerifyLocale",
    58             country = loc.getCountry();
    54             "-locale", "ja",
    59             variant = loc.getVariant();
    55             "-docletpath", System.getProperty("test.classes", "."),
    60             if (!language.equals("")) {
    56             thisFile
    61                 String[] command_line = {
    57         };
    62                     // jumble the options in some weird order
    58         if (jdk.javadoc.internal.tool.Main.execute(argarray) != 0)
    63                     "-doclet", "VerifyLocale",
    59             throw new Error("Javadoc encountered warnings or errors.");
    64                     "-locale", language + (country.equals("") ? "" : ("_" + country + (variant.equals("") ? "" : "_" + variant))),
       
    65                     "-docletpath", System.getProperty("test.classes", "."),
       
    66                     thisFile
       
    67                 };
       
    68                 if (jdk.javadoc.internal.tool.Main.execute(command_line) != 0)
       
    69                     throw new Error("Javadoc encountered warnings or errors.");
       
    70             }
       
    71         }
    60     }
    72     }
    61 
    73 
    62     public boolean run(DocletEnvironment root) {
    74     public boolean run(DocletEnvironment root) {
    63         reporter.print(Kind.NOTE, "just a test: Locale is: " + locale.getDisplayName());
    75         reporter.print(Kind.NOTE, "just a test: Locale is: " + locale.getDisplayName());
    64         return locale.getDisplayName(Locale.ENGLISH).contains("Japan");
    76         return language.equals(locale.getLanguage())
       
    77                && country.equals(locale.getCountry())
       
    78                && variant.equals(locale.getVariant());
    65     }
    79     }
    66 
    80 
    67     @Override
    81     @Override
    68     public String getName() {
    82     public String getName() {
    69         return "Test";
    83         return "Test";