This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 11bca5a6bdb Support XML-driven JDBC DistSQL bootstrap native
validation (#40115)
11bca5a6bdb is described below
commit 11bca5a6bdbe429d68558d9c207d22b98d5b6538
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Oct 9 19:02:05 2026 +0800
Support XML-driven JDBC DistSQL bootstrap native validation (#40115)
* Fix CI defaults for fork pull requests
* Add JDBC DistSQL bootstrap CI coverage
* Support XML-driven JDBC DistSQL bootstrap native validation
---
.../type/scenario/path/ScenarioCommonPath.java | 16 +-
.../type/scenario/path/ScenarioDataPath.java | 7 +
.../e2e/sql/cases/SQLE2ETestCasesXMLLoader.java | 3 +
.../reachability-metadata.json | 243 +++++++++++++++++++++
4 files changed, 268 insertions(+), 1 deletion(-)
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioCommonPath.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioCommonPath.java
index b1956507e7f..7188cc25d0c 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioCommonPath.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioCommonPath.java
@@ -19,9 +19,11 @@ package
org.apache.shardingsphere.test.e2e.env.runtime.type.scenario.path;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import java.io.File;
import java.net.URL;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Scenario common path.
@@ -42,7 +44,11 @@ public final class ScenarioCommonPath {
* Check folder existed.
*/
public void checkFolderExisted() {
-
assertNotNull(Thread.currentThread().getContextClassLoader().getResource(scenarioDirectory),
String.format("Scenario folder `%s` must exist.", scenarioDirectory));
+ if
("runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"))) {
+ assertTrue(new File("src/test/resources",
scenarioDirectory).isDirectory(), String.format("Scenario folder `%s` must
exist.", scenarioDirectory));
+ } else {
+
assertNotNull(Thread.currentThread().getContextClassLoader().getResource(scenarioDirectory),
String.format("Scenario folder `%s` must exist.", scenarioDirectory));
+ }
}
/**
@@ -57,6 +63,9 @@ public final class ScenarioCommonPath {
}
private boolean isFileExisted(final String fileName) {
+ if
("runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"))) {
+ return new File("src/test/resources", String.join("/",
scenarioDirectory, fileName)).isFile();
+ }
return null !=
Thread.currentThread().getContextClassLoader().getResource(String.join("/",
scenarioDirectory, fileName));
}
@@ -71,6 +80,11 @@ public final class ScenarioCommonPath {
private String getFile(final String fileName) {
String scenarioFile = String.join("/", scenarioDirectory, fileName);
+ if
("runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"))) {
+ File result = new File("src/test/resources", scenarioFile);
+ assertTrue(result.isFile(), String.format("File `%s` must exist.",
scenarioFile));
+ return result.getAbsolutePath();
+ }
URL url =
Thread.currentThread().getContextClassLoader().getResource(scenarioFile);
assertNotNull(url, String.format("File `%s` must exist.",
scenarioFile));
return url.getFile();
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioDataPath.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioDataPath.java
index 61e089b0f66..42aad249bf9 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioDataPath.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/scenario/path/ScenarioDataPath.java
@@ -19,10 +19,12 @@ package
org.apache.shardingsphere.test.e2e.env.runtime.type.scenario.path;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import java.io.File;
import java.net.URL;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Scenario data path.
@@ -63,6 +65,11 @@ public final class ScenarioDataPath {
private String getFile(final String fileName) {
String path = String.join("/", scenarioDirectory, fileName);
+ if
("runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"))) {
+ File result = new File("src/test/resources", path);
+ assertTrue(result.isFile(), String.format("File `%s` must exist.",
path));
+ return result.getAbsolutePath();
+ }
URL url =
Thread.currentThread().getContextClassLoader().getResource(path);
assertNotNull(url, String.format("File `%s` must exist.", path));
return url.getFile();
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 17119f8b1bf..6b617510609 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
@@ -74,6 +74,9 @@ public final class SQLE2ETestCasesXMLLoader {
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
private Collection<SQLE2ETestCaseContext> loadE2ETestCaseContexts(final
SQLCommandType sqlCommandType) {
+ if
("runtime".equals(System.getProperty("org.graalvm.nativeimage.imagecode"))) {
+ return
loadE2ETestCaseContexts(Paths.get("src/test/resources/cases").toAbsolutePath().toUri().toURL(),
sqlCommandType);
+ }
URL url =
Thread.currentThread().getContextClassLoader().getResource("cases/");
if (null != url) {
return loadE2ETestCaseContexts(url, sqlCommandType);
diff --git
a/test/e2e/sql/src/test/resources/META-INF/native-image/shardingsphere-test-e2e-sql/reachability-metadata.json
b/test/e2e/sql/src/test/resources/META-INF/native-image/shardingsphere-test-e2e-sql/reachability-metadata.json
new file mode 100644
index 00000000000..3e4bac91f08
--- /dev/null
+++
b/test/e2e/sql/src/test/resources/META-INF/native-image/shardingsphere-test-e2e-sql/reachability-metadata.json
@@ -0,0 +1,243 @@
+{
+ "reflection": [
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.env.runtime.type.scenario.database.DatabaseEnvironment",
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.env.runtime.type.scenario.database.DatabaseEnvironmentAttribute"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type": "org.apache.shardingsphere.test.e2e.sql.cases.SQLE2ETestCases",
+ "fields": [
+ {
+ "name": "testCases"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.casse.SQLE2ETestCase",
+ "fields": [
+ {
+ "name": "adapters"
+ },
+ {
+ "name": "assertions"
+ },
+ {
+ "name": "dbTypes"
+ },
+ {
+ "name": "scenarioComments"
+ },
+ {
+ "name": "scenarioTypes"
+ },
+ {
+ "name": "sql"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.casse.assertion.SQLE2ETestCaseAssertion",
+ "fields": [
+ {
+ "name": "assertionSQL"
+ },
+ {
+ "name": "destroySQL"
+ },
+ {
+ "name": "expectedDataFile"
+ },
+ {
+ "name": "initialSQL"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.casse.assertion.SQLE2ETestCaseAssertionSQL",
+ "fields": [
+ {
+ "name": "sql"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type": "org.apache.shardingsphere.test.e2e.sql.cases.dataset.DataSet",
+ "fields": [
+ {
+ "name": "metaDataList"
+ },
+ {
+ "name": "rows"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.dataset.metadata.DataSetColumn",
+ "fields": [
+ {
+ "name": "name"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.dataset.metadata.DataSetIndex"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.dataset.metadata.DataSetMetaData",
+ "fields": [
+ {
+ "name": "columns"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type":
"org.apache.shardingsphere.test.e2e.sql.cases.dataset.row.DataSetRow",
+ "fields": [
+ {
+ "name": "values"
+ }
+ ],
+ "methods": [
+ {
+ "name": "<init>",
+ "parameterTypes": []
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type": "com.sun.xml.bind.v2.ContextFactory",
+ "methods": [
+ {
+ "name": "createContext",
+ "parameterTypes": [
+ "java.lang.Class[]",
+ "java.util.Map"
+ ]
+ }
+ ]
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "type": {
+ "proxy": [
+ "javax.xml.bind.annotation.XmlAccessorType",
+ "com.sun.xml.bind.v2.model.annotation.Locatable"
+ ]
+ }
+ }
+ ],
+ "resources": [
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "glob": "env/e2e-env.properties"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "glob": "container/mysql/init-sql/00-common-init-authority.sql"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "glob": "container/mysql/init-sql/99-common-check-ready.sql"
+ },
+ {
+ "condition": {
+ "typeReached":
"org.apache.shardingsphere.test.e2e.sql.it.distsql.rdl.RDLE2EIT"
+ },
+ "glob": "META-INF/services/javax.xml.bind.JAXBContext"
+ }
+ ]
+}