47 case "bug7198834Test":
48 bug7198834Test();
49 break;
50
51 case "tzNameTest":
52 tzNameTest(args[1]);
53 break;
54
55 case "bug8001440Test":
56 bug8001440Test();
57 break;
58
59 case "bug8010666Test":
60 bug8010666Test();
61 break;
62
63 case "bug8013086Test":
64 bug8013086Test(args[1], args[2]);
65 break;
66
67 default:
68 throw new RuntimeException("Test method '"+methodName+"' not found.");
69 }
70 }
71
72 static void getPlatformLocale(Locale.Category cat) {
73 Locale defloc = Locale.getDefault(cat);
74 System.out.printf("%s,%s\n", defloc.getLanguage(), defloc.getCountry());
75 }
76
77 static void adapterTest(String expected, String lang, String ctry) {
78 Locale testLocale = new Locale(lang, ctry);
79 String preference = System.getProperty("java.locale.providers", "");
80 LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, testLocale);
81 LocaleProviderAdapter.Type type = lda.getAdapterType();
82 System.out.printf("testLocale: %s, got: %s, expected: %s\n", testLocale, type, expected);
83 if (!type.toString().equals(expected)) {
84 throw new RuntimeException("Returned locale data adapter is not correct.");
85 }
86 }
178 } else {
179 throw new RuntimeException("Windows Host" +
180 " LocaleProviderAdapter was not selected for" +
181 " English locale.");
182 }
183 }
184 } catch (ParseException pe) {
185 throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
186 }
187 }
188 }
189
190 static void bug8013086Test(String lang, String ctry) {
191 try {
192 // Throws a NullPointerException if the test fails.
193 System.out.println(new SimpleDateFormat("z", new Locale(lang, ctry)).parse("UTC"));
194 } catch (ParseException pe) {
195 // ParseException is fine in this test, as it's not "UTC"
196 }
197 }
198 }
|
47 case "bug7198834Test":
48 bug7198834Test();
49 break;
50
51 case "tzNameTest":
52 tzNameTest(args[1]);
53 break;
54
55 case "bug8001440Test":
56 bug8001440Test();
57 break;
58
59 case "bug8010666Test":
60 bug8010666Test();
61 break;
62
63 case "bug8013086Test":
64 bug8013086Test(args[1], args[2]);
65 break;
66
67 case "bug8013903Test":
68 bug8013903Test();
69 break;
70
71 default:
72 throw new RuntimeException("Test method '"+methodName+"' not found.");
73 }
74 }
75
76 static void getPlatformLocale(Locale.Category cat) {
77 Locale defloc = Locale.getDefault(cat);
78 System.out.printf("%s,%s\n", defloc.getLanguage(), defloc.getCountry());
79 }
80
81 static void adapterTest(String expected, String lang, String ctry) {
82 Locale testLocale = new Locale(lang, ctry);
83 String preference = System.getProperty("java.locale.providers", "");
84 LocaleProviderAdapter lda = LocaleProviderAdapter.getAdapter(DateFormatProvider.class, testLocale);
85 LocaleProviderAdapter.Type type = lda.getAdapterType();
86 System.out.printf("testLocale: %s, got: %s, expected: %s\n", testLocale, type, expected);
87 if (!type.toString().equals(expected)) {
88 throw new RuntimeException("Returned locale data adapter is not correct.");
89 }
90 }
182 } else {
183 throw new RuntimeException("Windows Host" +
184 " LocaleProviderAdapter was not selected for" +
185 " English locale.");
186 }
187 }
188 } catch (ParseException pe) {
189 throw new RuntimeException("Parsing Windows version failed: "+pe.toString());
190 }
191 }
192 }
193
194 static void bug8013086Test(String lang, String ctry) {
195 try {
196 // Throws a NullPointerException if the test fails.
197 System.out.println(new SimpleDateFormat("z", new Locale(lang, ctry)).parse("UTC"));
198 } catch (ParseException pe) {
199 // ParseException is fine in this test, as it's not "UTC"
200 }
201 }
202
203 static void bug8013903Test() {
204 if (System.getProperty("os.name").startsWith("Windows")) {
205 Date sampleDate = new Date(0x10000000000L);
206 String fallbackResult = "Heisei 16.Nov.03 (Wed) AM 11:53:47";
207 String jreResult = "\u5e73\u6210 16.11.03 (\u6c34) \u5348\u524d 11:53:47";
208 Locale l = new Locale("ja", "JP", "JP");
209 SimpleDateFormat sdf = new SimpleDateFormat("GGGG yyyy.MMM.dd '('E')' a hh:mm:ss", l);
210 String result = sdf.format(sampleDate);
211 System.out.println(result);
212 if (LocaleProviderAdapter.getAdapterPreference()
213 .contains(LocaleProviderAdapter.Type.JRE)) {
214 if (!jreResult.equals(result)) {
215 throw new RuntimeException("Format failed. result: \"" +
216 result + "\", expected: \"" + jreResult);
217 }
218 } else {
219 // should be FALLBACK, as Windows HOST does not return
220 // display names
221 if (!fallbackResult.equals(result)) {
222 throw new RuntimeException("Format failed. result: \"" +
223 result + "\", expected: \"" + fallbackResult);
224 }
225 }
226 }
227 }
228 }
|