This is an automated email from the ASF dual-hosted git repository.

FlyingZC pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 5483aed2480 Minor refactor SQLE2ETestCasesXMLLoader (#38750)
5483aed2480 is described below

commit 5483aed2480d0a07f5c665d8908a6de91aa8c3e4
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Fri May 29 15:26:04 2026 +0800

    Minor refactor SQLE2ETestCasesXMLLoader (#38750)
---
 .../test/e2e/sql/cases/SQLE2ETestCasesXMLLoader.java           | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/cases/SQLE2ETestCasesXMLLoader.java
 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/cases/SQLE2ETestCasesXMLLoader.java
index ff292ca413b..1e4f5c8296f 100644
--- 
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/cases/SQLE2ETestCasesXMLLoader.java
+++ 
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/sql/cases/SQLE2ETestCasesXMLLoader.java
@@ -36,10 +36,10 @@ import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -74,8 +74,12 @@ public final class SQLE2ETestCasesXMLLoader {
     
     @SneakyThrows({IOException.class, URISyntaxException.class, 
JAXBException.class})
     private Collection<SQLE2ETestCaseContext> loadE2ETestCaseContexts(final 
SQLCommandType sqlCommandType) {
-        URL url = 
Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource("cases/"));
-        return loadE2ETestCaseContexts(url, sqlCommandType);
+        URL url = 
Thread.currentThread().getContextClassLoader().getResource("cases/");
+        if (null != url) {
+            return loadE2ETestCaseContexts(url, sqlCommandType);
+        }
+        Path fallbackCasesPath = 
Paths.get(SQLE2ETestCasesXMLLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI()).resolve("cases");
+        return Files.exists(fallbackCasesPath) ? 
loadE2ETestCaseContexts(fallbackCasesPath.toUri().toURL(), sqlCommandType) : 
Collections.emptyList();
     }
     
     private Collection<SQLE2ETestCaseContext> loadE2ETestCaseContexts(final 
URL url, final SQLCommandType sqlCommandType) throws IOException, 
URISyntaxException, JAXBException {

Reply via email to