Path: blob/master/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseTests.java
41152 views
/*1* Copyright (c) 2018, 2021, 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* @summary tests Japanese Calendar.26* @bug 4609228 818764927* @modules java.base/sun.util28* java.base/sun.util.calendar29* @compile30* CalendarAdapter.java31* CalendarTestEngine.java32* CalendarTestException.java33* Exceptions.java34* GregorianAdapter.java35* Result.java36* Symbol.java37* Variable.java38* @run main/othervm/timeout=120 JapaneseTests39*/4041import java.io.File;42import java.io.FilenameFilter;43import java.nio.file.Path;44import java.nio.file.Paths;45import java.util.ArrayList;46import java.util.Arrays;47import java.util.List;4849public class JapaneseTests {5051private static List<String> SET_LENIENT = Arrays.asList(52"japanese_minmax.cts",53"japanese_add.cts",54"japanese_roll.cts",55"japanese_exceptions.cts");56private static List<String> DEFAULT_LENIENT = Arrays.asList(57"japanese.cts",58"japanese_normalization.cts");5960private static Path srcPath = Paths.get(System.getProperty("test.src"));6162public static void main(String[] args) throws Throwable {63List<String> tzList = getFileNameList("timezones");64List<String> modeList = getFileNameList("params");6566for (String jaTest: DEFAULT_LENIENT) {67for (String tz : tzList) {68String[] ts = { srcPath + "/timezones/" + tz,69srcPath + "/japanese/" + jaTest};70CalendarTestEngine.main(ts);71}72}7374for (String jaTest: SET_LENIENT) {75for (String tz : tzList) {76for (String mode : modeList) {77String[] ts = { srcPath + "/timezones/" + tz,78srcPath + "/params/" + mode,79srcPath + "/japanese/" + jaTest };80CalendarTestEngine.main(ts);81}82}83}84}8586private static List<String> getFileNameList(String type ){87List<String> fileList = new ArrayList<>();88File dir = new File(srcPath + "/"+ type);89File[] testFiles = dir.listFiles(new FilenameFilter() {90public boolean accept(File dir, String name) {91return name.toLowerCase().endsWith(".cts");92}93});94for (File f:testFiles) {95fileList.add(f.getName());96}97return fileList;98}99}100101102