8210406: Refactor java.util.PluggableLocale:i18n shell tests to plain java tests

Reviewed-by: naoto
This commit is contained in:
Dora Zhou 2018-10-18 00:56:38 -07:00
parent 10b754ee85
commit 3c2c6bce02
65 changed files with 402 additions and 753 deletions
test/jdk/java/util/PluggableLocale
BreakIteratorProviderTest.javaBreakIteratorProviderTest.shCalendarDataProviderTest.javaCalendarDataProviderTest.shCalendarNameProviderTest.javaCalendarNameProviderTest.shClasspathTest.javaClasspathTest.shCollatorProviderTest.javaCollatorProviderTest.shCurrencyNameProviderTest.javaCurrencyNameProviderTest.shDateFormatProviderTest.javaDateFormatProviderTest.shDateFormatSymbolsProviderTest.javaDateFormatSymbolsProviderTest.shDecimalFormatSymbolsProviderTest.javaDecimalFormatSymbolsProviderTest.shExecTest.shGenericTest.javaGenericTest.shLocaleNameProviderTest.javaLocaleNameProviderTest.shNumberFormatProviderTest.javaNumberFormatProviderTest.shPermissionTest.javaPermissionTest.shTimeZoneNameProviderTest.javaTimeZoneNameProviderTest.shbarprovider.jardummy.policyfooprovider.jar
providersrc

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,27 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8062588 8165804 8210406
* @summary BreakIteratorProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI BreakIteratorProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import java.text.BreakIterator;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
import com.foo.BreakIteratorProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class BreakIteratorProviderTest extends ProviderTest {
com.foo.BreakIteratorProviderImpl bip = new com.foo.BreakIteratorProviderImpl();
BreakIteratorProviderImpl bip = new BreakIteratorProviderImpl();
List<Locale> availloc = Arrays.asList(BreakIterator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(bip.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getBreakIteratorProvider().getAvailableLocales());
private static final int CHARACTER_INDEX = 0;
private static final int WORD_INDEX = 1;
private static final int LINE_INDEX = 2;
private static final int SENTENCE_INDEX = 3;
public static void main(String[] s) {
new BreakIteratorProviderTest();
}
@ -98,4 +112,4 @@ public class BreakIteratorProviderTest extends ProviderTest {
}
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8062588 8165804
# @summary BreakIteratorProvider tests
# @run shell ExecTest.sh foo BreakIteratorProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,16 +20,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 7058207 8000986 8062588 8210406
* @summary CalendarDataProvider tests
* @library providersrc/foobarutils
* providersrc/barprovider
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI CalendarDataProviderTest
*/
import java.text.*;
import java.util.*;
import static java.util.Calendar.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import com.bar.CalendarDataProviderImpl;
import java.util.Calendar;
import java.util.Locale;
import static java.util.Calendar.WEDNESDAY;
/**
* Test case for CalendarDataProvider.
@ -51,7 +57,6 @@ public class CalendarDataProviderTest {
void test() {
Locale kids = new Locale("ja", "JP", "kids"); // test provider's supported locale
Calendar kcal = Calendar.getInstance(kids);
Calendar jcal = Calendar.getInstance(Locale.JAPAN);
// check the week parameters
checkResult("firstDayOfWeek", kcal.getFirstDayOfWeek(), WEDNESDAY);
@ -64,4 +69,4 @@ public class CalendarDataProviderTest {
throw new RuntimeException(s);
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 7058207 8000986 8062588
# @summary CalendarDataProvider tests
# @run shell ExecTest.sh bar CalendarDataProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,17 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 8000986 8062588 8210406
* @summary CalendarNameProvider tests
* @library providersrc/foobarutils
* providersrc/barprovider
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI CalendarNameProviderTest
*/
import java.text.*;
import java.util.*;
import static java.util.Calendar.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import com.bar.CalendarNameProviderImpl;
import static java.util.Calendar.ALL_STYLES;
import static java.util.Calendar.DAY_OF_MONTH;
import static java.util.Calendar.DAY_OF_WEEK;
import static java.util.Calendar.DECEMBER;
import static java.util.Calendar.HOUR_OF_DAY;
import static java.util.Calendar.JANUARY;
import static java.util.Calendar.LONG_STANDALONE;
import static java.util.Calendar.MONTH;
import static java.util.Calendar.SATURDAY;
import static java.util.Calendar.SHORT_STANDALONE;
import static java.util.Calendar.SUNDAY;
/**
* Test case for CalendarNameProvider.
*
@ -101,4 +121,4 @@ public class CalendarNameProviderTest {
throw new RuntimeException(s);
}
}
}
}

@ -1,27 +0,0 @@
#
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# @test
# @bug 8000986 8062588
# @summary CalendarNameProvider tests
# @run shell ExecTest.sh bar CalendarNameProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,13 +20,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 6388652 8062588 8210406
* @summary Checks whether providers can be loaded from classpath.
* @library providersrc/foobarutils
* providersrc/barprovider
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI ClasspathTest
*/
import java.text.*;
import java.util.*;
import sun.util.resources.*;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
public class ClasspathTest {
@ -45,4 +53,4 @@ public class ClasspathTest {
throw new RuntimeException("LSS providers were NOT loaded from the class path.");
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 6388652 8062588
# @summary Checks whether providers can be loaded from classpath.
# @run shell ExecTest.sh bar ClasspathTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,18 +20,40 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8062588 8210406
* @summary CollatorProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI CollatorProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.Collator;
import java.text.ParseException;
import java.text.RuleBasedCollator;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import com.foo.CollatorProviderImpl;
import sun.util.locale.provider.AvailableLanguageTags;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class CollatorProviderTest extends ProviderTest {
com.foo.CollatorProviderImpl cp = new com.foo.CollatorProviderImpl();
CollatorProviderImpl cp = new CollatorProviderImpl();
List<Locale> availloc = Arrays.asList(Collator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(cp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@ -94,4 +116,4 @@ public class CollatorProviderTest extends ProviderTest {
checkValidity(target, jresResult, providersResult, result, jreSupportsLocale);
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8062588
# @summary CollatorProvider tests
# @run shell ExecTest.sh foo CollatorProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,14 +20,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 7199750 8000997 8062588 8210406
* @summary CurrencyNameProvider tests
* @library providersrc/foobarutils
* providersrc/barprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyNameProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Currency;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import com.bar.CurrencyNameProviderImpl;
import com.bar.CurrencyNameProviderImpl2;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
import sun.util.resources.OpenListResourceBundle;
public class CurrencyNameProviderTest extends ProviderTest {
@ -47,8 +69,8 @@ public class CurrencyNameProviderTest extends ProviderTest {
}
void test1() {
com.bar.CurrencyNameProviderImpl cnp = new com.bar.CurrencyNameProviderImpl();
com.bar.CurrencyNameProviderImpl2 cnp2 = new com.bar.CurrencyNameProviderImpl2();
CurrencyNameProviderImpl cnp = new CurrencyNameProviderImpl();
CurrencyNameProviderImpl2 cnp2 = new CurrencyNameProviderImpl2();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getCurrencyNameProvider().getAvailableLocales());
@ -163,4 +185,4 @@ public class CurrencyNameProviderTest extends ProviderTest {
Locale.setDefault(defloc);
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 7199750 8000997 8062588
# @summary CurrencyNameProvider tests
# @run shell ExecTest.sh bar CurrencyNameProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,18 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 7003643 8062588 8210406
* @summary DateFormatProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.DateFormat;
import java.text.Format;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import com.foo.DateFormatProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatProviderTest extends ProviderTest {
com.foo.DateFormatProviderImpl dfp = new com.foo.DateFormatProviderImpl();
DateFormatProviderImpl dfp = new DateFormatProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@ -181,4 +204,4 @@ public class DateFormatProviderTest extends ProviderTest {
}
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 7003643 8062588
# @summary DateFormatProvider tests
# @run shell ExecTest.sh foo DateFormatProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,18 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 7200341 8062588 8210406
* @summary DateFormatSymbolsProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatSymbolsProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.DateFormatSymbols;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import com.foo.DateFormatSymbolsProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatSymbolsProviderTest extends ProviderTest {
com.foo.DateFormatSymbolsProviderImpl dfsp = new com.foo.DateFormatSymbolsProviderImpl();
DateFormatSymbolsProviderImpl dfsp = new DateFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@ -137,4 +156,4 @@ public class DateFormatSymbolsProviderTest extends ProviderTest {
}
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 7200341 8062588
# @summary DateFormatSymbolsProvider tests
# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,18 +20,33 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8062588 8210406
* @summary DecimalFormatSymbolsProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI DecimalFormatSymbolsProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.DecimalFormatSymbols;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.foo.DecimalFormatSymbolsProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
public class DecimalFormatSymbolsProviderTest extends ProviderTest {
com.foo.DecimalFormatSymbolsProviderImpl dfsp = new com.foo.DecimalFormatSymbolsProviderImpl();
DecimalFormatSymbolsProviderImpl dfsp = new DecimalFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DecimalFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@ -92,4 +107,4 @@ public class DecimalFormatSymbolsProviderTest extends ProviderTest {
}
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8062588
# @summary DecimalFormatSymbolsProvider tests
# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest

@ -1,145 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
#
#
# This script is the actual launcher of each locale service provider test.
# fooprovider.jar contains localized object providers and barprovider.jar
# contains localized name providers. This way, we can test providers that
# can relate to each other (such as, DateFormatSymbolsProvider and
# TimeZoneNameProvider) separately.
#
# Parameters:
# providersToTest: [foo|bar|foobar]
# java class name: <class name>
# java security policy file: (Optional. Installs security manager if exists)
if [ "${TESTSRC}" = "" ]
then
echo "TESTSRC not set. Test cannot execute. Failed."
exit 1
fi
echo "TESTSRC=${TESTSRC}"
if [ "${TESTJAVA}" = "" ]
then
echo "TESTJAVA not set. Test cannot execute. Failed."
exit 1
fi
if [ "${COMPILEJAVA}" = "" ]
then
COMPILEJAVA="${TESTJAVA}"
fi
echo "TESTJAVA=${TESTJAVA}"
if [ "${TESTCLASSES}" = "" ]
then
echo "TESTCLASSES not set. Test cannot execute. Failed."
exit 1
fi
echo "TESTCLASSES=${TESTCLASSES}"
echo "CLASSPATH=${CLASSPATH}"
# set platform-dependent variables
OS=`uname -s`
case "$OS" in
SunOS | Linux | Darwin | AIX )
PS=":"
FS="/"
;;
Windows* | CYGWIN* )
PS=";"
FS="\\"
;;
* )
echo "Unrecognized system!"
exit 1;
;;
esac
case "$1" in
"foo" )
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
;;
"bar" )
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
;;
"foobar" )
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
;;
esac
EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \
--add-exports java.base/sun.util.resources=ALL-UNNAMED"
# compile
cp ${TESTSRC}${FS}ProviderTest.java .
cp ${TESTSRC}${FS}$2.java .
COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRA_OPTS} \
-XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java"
echo ${COMPILE}
${COMPILE}
result=$?
if [ $result -eq 0 ]
then
echo "Compilation of the test case was successful."
else
echo "Compilation of the test case failed."
# Cleanup
rm -f ${TESTCLASSES}${FS}$2*.class
rm -f ${TESTCLASSES}${FS}fooprovider.jar
rm -f ${TESTCLASSES}${FS}barprovider.jar
exit $result
fi
# security options
if [ "$3" != "" ]
then
SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3"
fi
# run
RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} -Djava.locale.providers=JRE,SPI $2 "
echo ${RUNCMD}
${RUNCMD}
result=$?
if [ $result -eq 0 ]
then
echo "Execution successful"
else
echo "Execution of the test case failed."
fi
# Cleanup
rm -f ${TESTCLASSES}${FS}$2*.class
rm -f ${TESTCLASSES}${FS}fooprovider.jar
rm -f ${TESTCLASSES}${FS}barprovider.jar
exit $result

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,30 +20,58 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8062588 8210406
* @summary Generic tests for the pluggable locales feature
* @library providersrc/foobarutils
* providersrc/barprovider
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* @build com.foobar.Utils
* com.bar.*
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI GenericTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import com.bar.CalendarDataProviderImpl;
import com.bar.CalendarNameProviderImpl;
import com.bar.CurrencyNameProviderImpl;
import com.bar.CurrencyNameProviderImpl2;
import com.bar.GenericTimeZoneNameProviderImpl;
import com.bar.LocaleNameProviderImpl;
import com.bar.TimeZoneNameProviderImpl;
import com.foo.BreakIteratorProviderImpl;
import com.foo.CollatorProviderImpl;
import com.foo.DateFormatProviderImpl;
import com.foo.DateFormatSymbolsProviderImpl;
import com.foo.DecimalFormatSymbolsProviderImpl;
import com.foo.NumberFormatProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
public class GenericTest {
// test providers
com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
CollatorProviderImpl collatorP = new CollatorProviderImpl();
DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new GenericTest();
@ -108,4 +136,4 @@ public class GenericTest {
s2.addAll(s1);
return s2.toString();
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8062588
# @summary Generic tests for the pluggable locales feature
# @run shell ExecTest.sh foobar GenericTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,14 +20,30 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8000273 8062588 8210406
* @summary LocaleNameProvider tests
* @library providersrc/foobarutils
* providersrc/barprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI LocaleNameProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import com.bar.LocaleNameProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
import sun.util.resources.OpenListResourceBundle;
public class LocaleNameProviderTest extends ProviderTest {
@ -41,7 +57,7 @@ public class LocaleNameProviderTest extends ProviderTest {
}
void checkAvailLocValidityTest() {
com.bar.LocaleNameProviderImpl lnp = new com.bar.LocaleNameProviderImpl();
LocaleNameProviderImpl lnp = new LocaleNameProviderImpl();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getLocaleNameProvider().getAvailableLocales());
@ -121,10 +137,10 @@ public class LocaleNameProviderTest extends ProviderTest {
if (YY_suffix.getVariant().equals(retVrnt)) {
System.out.println(message);
return;
}
}
message = "variantFallbackTest() failed. Returned variant: "+retVrnt;
}
throw new RuntimeException(message);
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8000273 8062588
# @summary LocaleNameProvider tests
# @run shell ExecTest.sh bar LocaleNameProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,20 +20,38 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 7003643 8062588 8210406
* @summary NumberFormatProvider tests
* @library providersrc/foobarutils
* providersrc/fooprovider
* @modules java.base/sun.util.locale.provider
* @build com.foobar.Utils
* com.foo.*
* @run main/othervm -Djava.locale.providers=JRE,SPI NumberFormatProviderTest
*/
import java.text.*;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Currency;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.foo.FooNumberFormat;
import com.foo.NumberFormatProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
public class NumberFormatProviderTest extends ProviderTest {
com.foo.NumberFormatProviderImpl nfp = new com.foo.NumberFormatProviderImpl();
NumberFormatProviderImpl nfp = new NumberFormatProviderImpl();
List<Locale> availloc = Arrays.asList(NumberFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(nfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@ -201,4 +219,4 @@ public class NumberFormatProviderTest extends ProviderTest {
}
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 7003643 8062588
# @summary NumberFormatProvider tests
# @run shell ExecTest.sh foo NumberFormatProviderTest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,25 +20,59 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 8075545 8210406
* @summary Check whether RuntimePermission("localeServiceProvider") is
* handled correctly.
* @library providersrc/foobarutils
* providersrc/barprovider
* providersrc/fooprovider
* @build com.foobar.Utils
* com.bar.*
* com.foo.*
* @run main/othervm PermissionTest
* @run main/othervm/fail/java.security.policy=dummy.policy
* -Djava.security.manager
* -Djava.locale.providers=JRE,SPI
* PermissionTest
* @run main/othervm/java.security.policy=localeServiceProvider.policy
* -Djava.security.manager
* -Djava.locale.providers=JRE,SPI
* PermissionTest
*/
import com.bar.CalendarDataProviderImpl;
import com.bar.CalendarNameProviderImpl;
import com.bar.CurrencyNameProviderImpl;
import com.bar.CurrencyNameProviderImpl2;
import com.bar.GenericTimeZoneNameProviderImpl;
import com.bar.LocaleNameProviderImpl;
import com.bar.TimeZoneNameProviderImpl;
import com.foo.BreakIteratorProviderImpl;
import com.foo.CollatorProviderImpl;
import com.foo.DateFormatProviderImpl;
import com.foo.DateFormatSymbolsProviderImpl;
import com.foo.DecimalFormatSymbolsProviderImpl;
import com.foo.NumberFormatProviderImpl;
public class PermissionTest{
// Make sure provider impls can be instantiated under a security manager.ZZ
com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
CollatorProviderImpl collatorP = new CollatorProviderImpl();
DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new PermissionTest();

@ -1,31 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 8075545
# @summary Check whether RuntimePermission("localeServiceProvider") is
# handled correctly
# @run shell ExecTest.sh foobar PermissionTest
# @run shell/fail ExecTest.sh foobar PermissionTest dummy
# @run shell ExecTest.sh foobar PermissionTest localeServiceProvider.policy

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,19 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*
* @test
* @bug 4052440 8003267 8062588 8210406
* @summary TimeZoneNameProvider tests
* @library providersrc/foobarutils
* providersrc/barprovider
* @modules java.base/sun.util.locale.provider
* java.base/sun.util.resources
* @build com.foobar.Utils
* com.bar.*
* @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameProviderTest
*/
import java.text.*;
import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.format.TextStyle;
import java.util.*;
import sun.util.locale.provider.*;
import sun.util.resources.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.TimeZone;
import com.bar.TimeZoneNameProviderImpl;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.ResourceBundleBasedAdapter;
import sun.util.resources.OpenListResourceBundle;
public class TimeZoneNameProviderTest extends ProviderTest {
com.bar.TimeZoneNameProviderImpl tznp = new com.bar.TimeZoneNameProviderImpl();
TimeZoneNameProviderImpl tznp = new TimeZoneNameProviderImpl();
public static void main(String[] s) {
new TimeZoneNameProviderTest();
@ -248,4 +270,4 @@ public class TimeZoneNameProviderTest extends ProviderTest {
throw new RuntimeException("Generic name fallback failed. got: "+generic);
}
}
}
}

@ -1,28 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# @test
# @bug 4052440 8003267 8062588
# @summary TimeZoneNameProvider tests
# @run shell ExecTest.sh bar TimeZoneNameProviderTest

@ -1,78 +0,0 @@
#
#
#
DESTDIR=..
FOODIR=foo-contents
BARDIR=bar-contents
all: $(DESTDIR)/fooprovider.jar $(DESTDIR)/barprovider.jar
FOOSERVICES = \
java.text.spi.BreakIteratorProvider \
java.text.spi.CollatorProvider \
java.text.spi.DateFormatProvider \
java.text.spi.DateFormatSymbolsProvider \
java.text.spi.DecimalFormatSymbolsProvider \
java.text.spi.NumberFormatProvider
BARSERVICES = \
java.util.spi.CurrencyNameProvider \
java.util.spi.TimeZoneNameProvider \
java.util.spi.LocaleNameProvider \
java.util.spi.CalendarDataProvider \
java.util.spi.CalendarNameProvider
FOOFILES_JAVA = \
BreakIteratorProviderImpl.java \
CollatorProviderImpl.java \
DateFormatProviderImpl.java \
DateFormatSymbolsProviderImpl.java \
DecimalFormatSymbolsProviderImpl.java \
NumberFormatProviderImpl.java \
FooDateFormat.java \
FooNumberFormat.java \
Utils.java
BARFILES_JAVA = \
CurrencyNameProviderImpl.java \
CurrencyNameProviderImpl2.java \
TimeZoneNameProviderImpl.java \
GenericTimeZoneNameProviderImpl.java \
LocaleNameProviderImpl.java \
CalendarDataProviderImpl.java \
CalendarNameProviderImpl.java \
Utils.java
BARFILES_PROPERTIES = \
LocaleNames.properties \
LocaleNames_ja.properties \
LocaleNames_ja_JP_osaka.properties \
LocaleNames_ja_JP_kyoto.properties \
LocaleNames_xx.properties
$(DESTDIR)/fooprovider.jar: $(FOOSERVICES) $(FOOFILES_JAVA)
rm -rf $(FOODIR)
mkdir -p $(FOODIR)
mkdir -p $(FOODIR)/META-INF
mkdir -p $(FOODIR)/META-INF/services
$(BINDIR)/javac -d $(FOODIR) $(FOOFILES_JAVA)
cp $(FOOSERVICES) $(FOODIR)/META-INF/services
rm -f $(DESTDIR)/fooprovider.jar
$(BINDIR)/jar cvf $(DESTDIR)/fooprovider.jar -C $(FOODIR) .
$(DESTDIR)/barprovider.jar: $(BARSERVICES) $(BARFILES_JAVA) $(BARFILES_PROPERTIES)
rm -rf $(BARDIR)
mkdir -p $(BARDIR)
mkdir -p $(BARDIR)/META-INF
mkdir -p $(BARDIR)/META-INF/services
$(BINDIR)/javac -d $(BARDIR) $(BARFILES_JAVA)
cp $(BARSERVICES) $(BARDIR)/META-INF/services
cp $(BARFILES_PROPERTIES) $(BARDIR)/com/bar
rm -f $(DESTDIR)/barprovider.jar
$(BINDIR)/jar cvf $(DESTDIR)/barprovider.jar -C $(BARDIR) .
clean:
rm -rf $(BARDIR) $(FOODIR)
.PHONY: all clean