< prev index next >

test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java

Print this page


   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  */
  26 
  27 import java.text.*;


  28 import java.time.format.TextStyle;
  29 import java.util.*;
  30 import sun.util.locale.provider.*;
  31 import sun.util.resources.*;










  32 
  33 public class TimeZoneNameProviderTest extends ProviderTest {
  34 
  35     com.bar.TimeZoneNameProviderImpl tznp = new com.bar.TimeZoneNameProviderImpl();
  36 
  37     public static void main(String[] s) {
  38         new TimeZoneNameProviderTest();
  39     }
  40 
  41     TimeZoneNameProviderTest() {
  42         test1();
  43         test2();
  44         test3();
  45         aliasTest();
  46         genericFallbackTest();
  47     }
  48 
  49     void test1() {
  50         Locale[] available = Locale.getAvailableLocales();
  51         List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getTimeZoneNameProvider().getAvailableLocales());
  52         List<Locale> providerLocales = Arrays.asList(tznp.getAvailableLocales());
  53         String[] ids = TimeZone.getAvailableIDs();
  54 
  55         for (Locale target: available) {


   1 /*
   2  * Copyright (c) 2007, 2018, 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 4052440 8003267 8062588 8210406
  27  * @summary TimeZoneNameProvider tests
  28  * @library providersrc/foobarutils
  29  *          providersrc/barprovider
  30  * @modules java.base/sun.util.locale.provider
  31  *          java.base/sun.util.resources
  32  * @build com.foobar.Utils
  33  *        com.bar.*
  34  * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameProviderTest
  35  */
  36 
  37 import java.text.DateFormatSymbols;
  38 import java.text.ParseException;
  39 import java.text.SimpleDateFormat;
  40 import java.time.format.TextStyle;
  41 import java.util.Arrays;
  42 import java.util.Calendar;
  43 import java.util.Date;
  44 import java.util.List;
  45 import java.util.Locale;
  46 import java.util.MissingResourceException;
  47 import java.util.TimeZone;
  48 
  49 import com.bar.TimeZoneNameProviderImpl;
  50 
  51 import sun.util.locale.provider.LocaleProviderAdapter;
  52 import sun.util.locale.provider.ResourceBundleBasedAdapter;
  53 import sun.util.resources.OpenListResourceBundle;
  54 
  55 public class TimeZoneNameProviderTest extends ProviderTest {
  56 
  57     TimeZoneNameProviderImpl tznp = new TimeZoneNameProviderImpl();
  58 
  59     public static void main(String[] s) {
  60         new TimeZoneNameProviderTest();
  61     }
  62 
  63     TimeZoneNameProviderTest() {
  64         test1();
  65         test2();
  66         test3();
  67         aliasTest();
  68         genericFallbackTest();
  69     }
  70 
  71     void test1() {
  72         Locale[] available = Locale.getAvailableLocales();
  73         List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getTimeZoneNameProvider().getAvailableLocales());
  74         List<Locale> providerLocales = Arrays.asList(tznp.getAvailableLocales());
  75         String[] ids = TimeZone.getAvailableIDs();
  76 
  77         for (Locale target: available) {


< prev index next >