@@ -0,0 +1,3363 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.shardingsphere.test.sql.parser.integrate.loader;%0A%0Aimport lombok.AccessLevel;%0Aimport lombok.NoArgsConstructor;%0Aimport lombok.SneakyThrows;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.net.URISyntaxException;%0Aimport java.net.URL;%0Aimport java.nio.file.FileVisitResult;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport java.nio.file.SimpleFileVisitor;%0Aimport java.nio.file.attribute.BasicFileAttributes;%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport java.util.Enumeration;%0Aimport java.util.LinkedList;%0Aimport java.util.jar.JarEntry;%0Aimport java.util.jar.JarFile;%0A%0A/**%0A * Test case file loader.%0A */%0A@NoArgsConstructor(access = AccessLevel.PRIVATE)%0Apublic final class TestCaseFileLoader %7B%0A    %0A    private static final String FILE_EXTENSION = %22.xml%22;%0A    %0A    /**%0A     * Load test case file names from jar.%0A     * %0A     * @param file jar file%0A     * @param path test cases path%0A     * @return test case file names%0A     */%0A    @SneakyThrows(IOException.class)%0A    public static Collection%3CString%3E loadFileNamesFromJar(final File file, final String path) %7B%0A        Collection%3CString%3E result = new LinkedList%3C%3E();%0A        try (JarFile jar = new JarFile(file)) %7B%0A            Enumeration%3CJarEntry%3E entries = jar.entries();%0A            while (entries.hasMoreElements()) %7B%0A                String name = entries.nextElement().getName();%0A                if (name.startsWith(path) && name.endsWith(FILE_EXTENSION)) %7B%0A                    result.add(name);%0A                %7D%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A    %0A    /**%0A     * Load test case files from target directory.%0A     *%0A     * @param path test cases path%0A     * @return test case files%0A     */%0A    @SneakyThrows(%7BURISyntaxException.class, IOException.class%7D)%0A    public static Collection%3CFile%3E loadFilesFromTargetDirectory(final String path) %7B%0A        URL url = TestCaseFileLoader.class.getClassLoader().getResource(path);%0A        if (null == url) %7B%0A            return Collections.emptyList();%0A        %7D%0A        Collection%3CFile%3E result = new LinkedList%3C%3E();%0A        Files.walkFileTree(Paths.get(url.toURI()), new SimpleFileVisitor%3CPath%3E() %7B%0A            %0A            @Override%0A            public FileVisitResult visitFile(final Path file, final BasicFileAttributes attributes) %7B%0A                if (file.endsWith(FILE_EXTENSION)) %7B%0A                    result.add(file.toFile());%0A                %7D%0A                return FileVisitResult.CONTINUE;%0A            %7D%0A        %7D);%0A        return result;%0A    %7D%0A%7D%0A

Add TestCaseFileLoader