0N/A/*
2362N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A *@test
0N/A *@bug 6377794
0N/A *@summary Test case for tzdata2005r support for 9 locales
0N/A */
0N/A
0N/Aimport java.util.Locale;
0N/Aimport java.util.TimeZone;
0N/A
0N/Apublic class Bug6377794 {
0N/A static Locale[] locales2Test = new Locale[] {
0N/A new Locale("en"),
0N/A new Locale("de"),
0N/A new Locale("es"),
0N/A new Locale("fr"),
0N/A new Locale("it"),
0N/A new Locale("ja"),
0N/A new Locale("ko"),
0N/A new Locale("sv"),
0N/A new Locale("zh","CN"),
0N/A new Locale("zh","TW")
0N/A };
0N/A
0N/A public static void main(String[] args) {
0N/A TimeZone SystemVYST9 = TimeZone.getTimeZone("SystemV/YST9");
0N/A Locale tzLocale;
0N/A for (int i = 0; i < locales2Test.length; i++) {
0N/A tzLocale = locales2Test[i];
0N/A if (!SystemVYST9.getDisplayName(false, TimeZone.SHORT, tzLocale).equals
0N/A ("AKST"))
0N/A throw new RuntimeException("\n" + tzLocale + ": SHORT, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/YST9 should be \"AKST\"");
0N/A }
0N/A
0N/A/*
0N/A * For "SystemV/PST8", testing TimeZone.SHORT would return the same value
0N/A * before and after the fix. Therefore, the regression test was changed to test
0N/A * TimeZone.LONG instead.
0N/A */
0N/A
0N/A TimeZone SystemVPST8 = TimeZone.getTimeZone("SystemV/PST8");
0N/A tzLocale = locales2Test[0];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Pacific Standard Time"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Pacific Standard Time\"");
0N/A tzLocale = locales2Test[1];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Pazifische Normalzeit"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Pazifische Normalzeit\"");
0N/A tzLocale = locales2Test[2];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Hora est\u00e1ndar del Pac\u00edfico"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Hora est\u00e1ndar del Pac\u00edfico\"");
0N/A tzLocale = locales2Test[3];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Heure normale du Pacifique"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Heure normale du Pacifique\"");
0N/A tzLocale = locales2Test[4];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Ora solare della costa occidentale USA"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Ora solare della costa occidentale USA\"");
0N/A tzLocale = locales2Test[5];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\"");
0N/A tzLocale = locales2Test[6];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc\"");
0N/A tzLocale = locales2Test[7];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("Stilla havet, normaltid"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"Stilla havet, normaltid\"");
0N/A tzLocale = locales2Test[8];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4\"");
0N/A tzLocale = locales2Test[9];
0N/A if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
0N/A ("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593"))
0N/A throw new RuntimeException("\n" + tzLocale + ": LONG, " +
0N/A "non-daylight saving name for " +
0N/A "SystemV/PST8 should be " +
0N/A "\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593\"");
0N/A }
0N/A}