Path: blob/master/test/jdk/java/util/Calendar/CalendarTestScripts/JapaneseRollTests.java
41152 views
/*1* Copyright (c) 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* @summary tests Japanese Calendar.26* @bug 460922827* @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* JapaneseRollDayOfWeekTestGenerator.java39* @run main/timeout=120/othervm JapaneseRollTests40*/4142import java.io.File;43import java.io.FilenameFilter;44import java.nio.file.Path;45import java.nio.file.Paths;46import java.util.ArrayList;47import java.util.Arrays;48import java.util.List;4950public class JapaneseRollTests {51private static List<String> TZ_TEST_LIST = Arrays.asList(52"tz_japan.cts", "tz_pst.cts");53private static Path srcPath = Paths.get(System.getProperty("test.src"));54private static Path testPath = Paths.get(System.getProperty("test.classes"));5556public static void main(String[] args) throws Throwable {57List<String> modeList = getFileNameList("params");58//Test only 3 years by default59String[] jpyear ={"3"};60JapaneseRollDayOfWeekTestGenerator.generateTestScript(jpyear);6162for (String tz : TZ_TEST_LIST) {63for(String mode:modeList){64String[] ts = { srcPath + "/timezones/" + tz,65srcPath + "/params/" + mode,66testPath + "/rolldow.cts"};6768CalendarTestEngine.main(ts);69}70}71}7273private static List<String> getFileNameList(String type ){74List<String> fileList = new ArrayList<>();75File dir = new File(srcPath + "/"+ type);76File[] testFiles = dir.listFiles(new FilenameFilter() {77public boolean accept(File dir, String name) {78return name.toLowerCase().endsWith(".cts");79}80});81for (File f:testFiles) {82fileList.add(f.getName());83}8485return fileList;86}87}888990