Path: blob/master/test/jdk/java/util/PluggableLocale/PermissionTest.java
41149 views
/*1* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 8075545 821040626* @summary Check whether RuntimePermission("localeServiceProvider") is27* handled correctly.28* @library providersrc/foobarutils29* providersrc/barprovider30* providersrc/fooprovider31* @build com.foobar.Utils32* com.bar.*33* com.foo.*34* @run main/othervm PermissionTest35* @run main/othervm/fail/java.security.policy=dummy.policy36* -Djava.security.manager37* -Djava.locale.providers=JRE,SPI38* PermissionTest39* @run main/othervm/java.security.policy=localeServiceProvider.policy40* -Djava.security.manager41* -Djava.locale.providers=JRE,SPI42* PermissionTest43*/4445import com.bar.CalendarDataProviderImpl;46import com.bar.CalendarNameProviderImpl;47import com.bar.CurrencyNameProviderImpl;48import com.bar.CurrencyNameProviderImpl2;49import com.bar.GenericTimeZoneNameProviderImpl;50import com.bar.LocaleNameProviderImpl;51import com.bar.TimeZoneNameProviderImpl;52import com.foo.BreakIteratorProviderImpl;53import com.foo.CollatorProviderImpl;54import com.foo.DateFormatProviderImpl;55import com.foo.DateFormatSymbolsProviderImpl;56import com.foo.DecimalFormatSymbolsProviderImpl;57import com.foo.NumberFormatProviderImpl;5859public class PermissionTest{6061// Make sure provider impls can be instantiated under a security manager.ZZ62BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();63CollatorProviderImpl collatorP = new CollatorProviderImpl();64DateFormatProviderImpl dateFP = new DateFormatProviderImpl();65DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();66DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();67NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();68CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();69CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();70LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();71TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();72GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();73CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();74CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();7576public static void main(String[] s) {77new PermissionTest();78}79}808182