1 /* 2 * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 *@test 26 *@bug 6317929 6409419 8008577 27 *@summary Test case for tzdata2005m support for 9 locales 28 *@run main/othervm -Djava.locale.providers=JRE,SPI Bug6317929 29 */ 30 31 import java.util.Locale; 32 import java.util.TimeZone; 33 34 public class Bug6317929 { 35 static Locale[] locales2Test = new Locale[] { 36 new Locale("en"), 37 new Locale("de"), 38 new Locale("es"), 39 new Locale("fr"), 40 new Locale("it"), 41 new Locale("ja"), 42 new Locale("ko"), 43 new Locale("sv"), 44 new Locale("zh","CN"), 45 new Locale("zh","TW") 46 }; 47 48 public static void main(String[] args) { 49 Locale tzLocale; 50 51 TimeZone Coral_Harbour = TimeZone.getTimeZone("America/Coral_Harbour"); 52 tzLocale = locales2Test[0]; 53 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 54 ("Eastern Standard Time")) 55 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 56 "non-daylight saving name for " + 57 "America/Coral_Harbour should be " + 58 "\"Eastern Standard Time\""); 59 tzLocale = locales2Test[1]; 60 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 61 ("\u00d6stliche Normalzeit")) 62 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 63 "non-daylight saving name for " + 64 "America/Coral_Harbour should be " + 65 "\"\u00d6stliche Normalzeit\""); 66 tzLocale = locales2Test[2]; 67 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 68 ("Hora est\u00e1ndar Oriental")) 69 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 70 "non-daylight saving name for " + 71 "America/Coral_Harbour should be " + 72 "\"Hora est\u00e1ndar Oriental\""); 73 tzLocale = locales2Test[3]; 74 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 75 ("Heure normale de l'Est")) 76 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 77 "non-daylight saving name for " + 78 "America/Coral_Harbour should be " + 79 "\"Heure normale de l'Est\""); 80 tzLocale = locales2Test[4]; 81 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 82 ("Ora solare USA orientale")) 83 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 84 "non-daylight saving name for " + 85 "America/Coral_Harbour should be " + 86 "\"Ora solare USA orientale\""); 87 tzLocale = locales2Test[5]; 88 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 89 ("\u6771\u90e8\u6a19\u6e96\u6642")) 90 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 91 "non-daylight saving name for " + 92 "America/Coral_Harbour should be " + 93 "\"\u6771\u90e8\u6a19\u6e96\u6642\""); 94 tzLocale = locales2Test[6]; 95 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 96 ("\ub3d9\ubd80 \ud45c\uc900\uc2dc")) 97 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 98 "non-daylight saving name for " + 99 "America/Coral_Harbour should be " + 100 "\"\ub3d9\ubd80 \ud45c\uc900\uc2dc\""); 101 tzLocale = locales2Test[7]; 102 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 103 ("Eastern, normaltid")) 104 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 105 "non-daylight saving name for " + 106 "America/Coral_Harbour should be " + 107 "\"Eastern, normaltid\""); 108 tzLocale = locales2Test[8]; 109 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 110 ("\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4")) 111 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 112 "non-daylight saving name for " + 113 "America/Coral_Harbour should be " + 114 "\"\u4e1c\u90e8\u6807\u51c6\u65f6\u95f4\""); 115 tzLocale = locales2Test[9]; 116 if (!Coral_Harbour.getDisplayName(false, TimeZone.LONG, tzLocale).equals 117 ("\u6771\u65b9\u6a19\u6e96\u6642\u9593")) 118 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 119 "non-daylight saving name for " + 120 "America/Coral_Harbour should be " + 121 "\"\u6771\u65b9\u6a19\u6e96\u6642\u9593\""); 122 123 TimeZone Currie = TimeZone.getTimeZone("Australia/Currie"); 124 tzLocale = locales2Test[0]; 125 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 126 ("Australian Eastern Standard Time (New South Wales)")) 127 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 128 "non-daylight saving name for " + 129 "Australia/Currie should be " + 130 "\"Australian Eastern Standard Time " + 131 "(New South Wales)\""); 132 tzLocale = locales2Test[1]; 133 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 134 ("\u00D6stliche Normalzeit (New South Wales)")) 135 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 136 "non-daylight saving name for " + 137 "Australia/Currie should be " + 138 "\"\u00D6stliche Normalzeit " + 139 "(New South Wales)\""); 140 tzLocale = locales2Test[2]; 141 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 142 ("Hora est\u00e1ndar Oriental (Nueva Gales del Sur)")) 143 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 144 "non-daylight saving name for " + 145 "Australia/Currie should be " + 146 "\"Hora est\u00e1ndar Oriental " + 147 "(Nueva Gales del Sur)\""); 148 tzLocale = locales2Test[3]; 149 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 150 ("Heure normale de l'Est (Nouvelle-Galles du Sud)")) 151 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 152 "non-daylight saving name for " + 153 "Australia/Currie should be " + 154 "\"Heure normale de l'Est " + 155 "(Nouvelle-Galles du Sud)\""); 156 tzLocale = locales2Test[4]; 157 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 158 ("Ora standard dell'Australia orientale (Nuovo Galles del Sud)")) 159 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 160 "non-daylight saving name for " + 161 "Australia/Currie should be " + 162 "\"Ora standard dell'Australia orientale " + 163 "(Nuovo Galles del Sud)\""); 164 tzLocale = locales2Test[5]; 165 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 166 ("\u6771\u90E8\u6A19\u6E96\u6642" + 167 "(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9\u30A6\u30A7\u30FC\u30EB\u30BA)")) 168 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 169 "non-daylight saving name for " + 170 "Australia/Currie should be " + 171 "\"\u6771\u90E8\u6A19\u6E96\u6642" + 172 "(\u30CB\u30E5\u30FC\u30B5\u30A6\u30B9" + 173 "\u30A6\u30A7\u30FC\u30EB\u30BA)\""); 174 tzLocale = locales2Test[6]; 175 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 176 ("\uB3D9\uBD80 \uD45C\uC900\uC2DC(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)")) 177 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 178 "non-daylight saving name for " + 179 "Australia/Currie should be " + 180 "\"\uB3D9\uBD80 \uD45C\uC900\uC2DC" + 181 "(\uB274\uC0AC\uC6B0\uC2A4\uC6E8\uC77C\uC988)\""); 182 tzLocale = locales2Test[7]; 183 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 184 ("\u00D6stlig standardtid (New South Wales)")) 185 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 186 "non-daylight saving name for " + 187 "Australia/Currie should be " + 188 "\"\u00D6stlig standardtid " + 189 "(New South Wales)\""); 190 tzLocale = locales2Test[8]; 191 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 192 ("\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 (\u65B0\u5357\u5A01\u5C14\u65AF)")) 193 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 194 "non-daylight saving name for " + 195 "Australia/Currie should be " + 196 "\"\u4E1C\u90E8\u6807\u51C6\u65F6\u95F4 " + 197 "(\u65B0\u5357\u5A01\u5C14\u65AF)\""); 198 tzLocale = locales2Test[9]; 199 if (!Currie.getDisplayName(false, TimeZone.LONG, tzLocale).equals 200 ("\u6771\u90E8\u6A19\u6E96\u6642\u9593 (\u65B0\u5357\u5A01\u723E\u65AF)")) 201 throw new RuntimeException("\n" + tzLocale + ": LONG, " + 202 "non-daylight saving name for " + 203 "Australia/Currie should be " + 204 "\"\u6771\u90E8\u6A19\u6E96\u6642\u9593 " + 205 "(\u65B0\u5357\u5A01\u723E\u65AF)\""); 206 } 207 }