This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 3b916f32888 Merge shardingsphere-standalone-mode-repository-jdbc
module(#25057) (#25161)
3b916f32888 is described below
commit 3b916f32888b5b710b80b0ffdc445d679737dc79
Author: Cong Hu <[email protected]>
AuthorDate: Fri May 12 17:23:18 2023 +0800
Merge shardingsphere-standalone-mode-repository-jdbc module(#25057)
(#25161)
* Merge shardingsphere-standalone-mode-repository-jdbc module(#25057)
* checkStyle problems fixed(#25057)
* Complete the attributes "isDefault" and "driverClassName" (#25057)
* Complete test (#25057)
* Complete documentation (#25057)
* Complete documentation and pom (#25057)
* Complete License (#25057)
* Complete test (#25057)
* add javadoc and final for JDBCRepositoryProviderLoader (#25057)
* Resolve the access problem to src/main/resources in unit tests (#25057)
---------
Co-authored-by: 胡聪 <[email protected]>
---
docs/document/content/dev-manual/mode.cn.md | 6 +-
.../optional-plugins/_index.cn.md | 2 +-
.../optional-plugins/_index.en.md | 2 +-
jdbc/core/pom.xml | 2 +-
.../repository/provider/jdbc/core/pom.xml | 49 ---------
.../jdbc/provider/JDBCRepositoryProvider.java | 70 ------------
.../fixture/JDBCRepositoryProviderFixture.java | 63 -----------
.../standalone/repository/provider/jdbc/h2/pom.xml | 54 ----------
.../standalone/h2/H2JDBCRepositoryProvider.java | 66 ------------
...standalone.jdbc.provider.JDBCRepositoryProvider | 18 ----
.../repository/provider/jdbc/mysql/pom.xml | 55 ----------
.../jdbc/mysql/MySQLJDBCRepositoryProvider.java | 61 -----------
...standalone.jdbc.provider.JDBCRepositoryProvider | 18 ----
.../standalone/repository/provider/jdbc/pom.xml | 58 ++++++++--
.../repository/standalone/jdbc/JDBCRepository.java | 17 +--
.../jdbc/props/JDBCRepositoryProperties.java | 0
.../jdbc/props/JDBCRepositoryPropertyKey.java | 0
.../jdbc/provider/JDBCRepositoryProvider.java | 87 +++++++++++++++
.../provider/JDBCRepositoryProviderLoader.java | 118 +++++++++++++++++++++
.../resources/JAXB/JDBCRepositoryProvider/H2.xml} | 25 ++---
.../JAXB/JDBCRepositoryProvider/MySQL.xml} | 25 ++---
...pository.standalone.StandalonePersistRepository | 0
.../standalone/jdbc/JDBCRepositoryTest.java | 40 +++----
.../jdbc/provider}/H2JDBCRepositoryTest.java | 2 +-
.../JDBCRepositoryProviderLoaderTest.java} | 24 +++--
.../provider}/MySQLJDBCRepositoryProviderTest.java | 20 ++--
.../JAXB/JDBCRepositoryProvider/FIXTURE.xml} | 25 ++---
...standalone.jdbc.provider.JDBCRepositoryProvider | 0
.../{h2 => }/src/test/resources/logback-test.xml | 0
proxy/bootstrap/pom.xml | 2 +-
30 files changed, 347 insertions(+), 562 deletions(-)
diff --git a/docs/document/content/dev-manual/mode.cn.md
b/docs/document/content/dev-manual/mode.cn.md
index 99e7dca114d..87c50714d2a 100644
--- a/docs/document/content/dev-manual/mode.cn.md
+++ b/docs/document/content/dev-manual/mode.cn.md
@@ -17,9 +17,9 @@ chapter = true
### 已知实现
-| *配置标识* | *详细说明* | *全限定类名*
|
-|--------|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| H2 | 基于 H2 的持久化 |
[`org.apache.shardingsphere.mode.repository.standalone.h2.H2Repository`](https://github.com/apache/shardingsphere/blob/master/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java)
|
+| *配置标识* | *详细说明* | *全限定类名*
|
+|--------|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| JDBC | 基于 JDBC 的持久化 |
[`org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository`](https://github.com/apache/shardingsphere/blob/master/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java)
|
## ClusterPersistRepository
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
index c4f89977dec..dcad5bf9e9c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.cn.md
@@ -31,7 +31,7 @@ ShardingSphere 默认情况下仅包含核心 SPI 的实现,在 Git Source 存
下以 `groupId:artifactId` 的表现形式列出所有的可选插件。
- 单机模式配置信息持久化定义
- -
`org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc-mysql`,基于
MySQL 的持久化
+ -
`org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc`,基于
JDBC 的持久化
- 集群模式配置信息持久化定义
-
`org.apache.shardingsphere:shardingsphere-cluster-mode-repository-nacos`,基于
Nacos 的持久化实现
-
`org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`,基于
Consul 的持久化实现
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
index dd23b7f8d39..f052fe77509 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/optional-plugins/_index.en.md
@@ -31,7 +31,7 @@ If ShardingSphere Proxy needs to use optional plugins, you
need to download the
All optional plugins are listed below in the form of `groupId:artifactId`.
- Standalone mode configuration information persistence definition
- -
`org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc-mysql`,
MySQL based persistence
+ -
`org.apache.shardingsphere:shardingsphere-standalone-mode-repository-jdbc`,
JDBC based persistence
- Cluster mode configuration information persistence definition
- `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-nacos`,
Nacos based persistence
- `org.apache.shardingsphere:shardingsphere-cluster-mode-repository-consul`,
Consul based persistence
diff --git a/jdbc/core/pom.xml b/jdbc/core/pom.xml
index 3743336fbb8..0c26ad784f0 100644
--- a/jdbc/core/pom.xml
+++ b/jdbc/core/pom.xml
@@ -112,7 +112,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-h2</artifactId>
+
<artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/mode/type/standalone/repository/provider/jdbc/core/pom.xml
b/mode/type/standalone/repository/provider/jdbc/core/pom.xml
deleted file mode 100644
index eef10a0865f..00000000000
--- a/mode/type/standalone/repository/provider/jdbc/core/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
- <version>5.3.3-SNAPSHOT</version>
- </parent>
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-core</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-test-util</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.zaxxer</groupId>
- <artifactId>HikariCP</artifactId>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
b/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
deleted file mode 100644
index 9d4c2c2b80a..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
-
-import org.apache.shardingsphere.infra.util.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPI;
-
-/**
- * JDBC repository provider.
- */
-@SingletonSPI
-public interface JDBCRepositoryProvider extends TypedSPI {
-
- /**
- * Create table SQL.
- *
- * @return SQL to create table
- */
- String createTableSQL();
-
- /**
- * Select by key SQL.
- *
- * @return SQL to select table
- */
- String selectByKeySQL();
-
- /**
- * Select by parent key SQL.
- *
- * @return SQL to select table
- */
- String selectByParentKeySQL();
-
- /**
- * Insert SQL.
- *
- * @return SQL to insert table
- */
- String insertSQL();
-
- /**
- * Update SQL.
- *
- * @return SQL to update table
- */
- String updateSQL();
-
- /**
- * Delete SQL.
- *
- * @return SQL to delete table
- */
- String deleteSQL();
-}
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/fixture/JDBCRepositoryProviderFixture.java
b/mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/fixture/JDBCRepositoryProviderFixture.java
deleted file mode 100644
index 14f9496a5e0..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/fixture/JDBCRepositoryProviderFixture.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.repository.standalone.jdbc.fixture;
-
-import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider;
-
-public final class JDBCRepositoryProviderFixture implements
JDBCRepositoryProvider {
-
- @Override
- public String createTableSQL() {
- return "CREATE TABLE IF NOT EXISTS `repository`(id varchar(36) PRIMARY
KEY, `key` TEXT, `value` TEXT, parent TEXT)";
- }
-
- @Override
- public String selectByKeySQL() {
- return "SELECT `value` FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String selectByParentKeySQL() {
- return "SELECT `key` FROM `repository` WHERE parent = ?";
- }
-
- @Override
- public String insertSQL() {
- return "INSERT INTO `repository` VALUES(?, ?, ?, ?)";
- }
-
- @Override
- public String updateSQL() {
- return "UPDATE `repository` SET `value` = ? WHERE `key` = ?";
- }
-
- @Override
- public String deleteSQL() {
- return "DELETE FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String getType() {
- return "FIXTURE";
- }
-
- @Override
- public boolean isDefault() {
- return true;
- }
-}
diff --git a/mode/type/standalone/repository/provider/jdbc/h2/pom.xml
b/mode/type/standalone/repository/provider/jdbc/h2/pom.xml
deleted file mode 100644
index 34236fdbcc8..00000000000
--- a/mode/type/standalone/repository/provider/jdbc/h2/pom.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
- <version>5.3.3-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-standalone-mode-repository-jdbc-h2</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-test-util</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryProvider.java
b/mode/type/standalone/repository/provider/jdbc/h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryProvider.java
deleted file mode 100644
index cf9ed902e05..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/main/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.repository.standalone.h2;
-
-import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider;
-
-/**
- * H2 JDBC repository provider.
- */
-public final class H2JDBCRepositoryProvider implements JDBCRepositoryProvider {
-
- @Override
- public String createTableSQL() {
- return "CREATE TABLE IF NOT EXISTS `repository`(id varchar(36) PRIMARY
KEY, `key` TEXT, `value` TEXT, parent TEXT)";
- }
-
- @Override
- public String selectByKeySQL() {
- return "SELECT `value` FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String selectByParentKeySQL() {
- return "SELECT `key` FROM `repository` WHERE parent = ?";
- }
-
- @Override
- public String insertSQL() {
- return "INSERT INTO `repository` VALUES(?, ?, ?, ?)";
- }
-
- @Override
- public String updateSQL() {
- return "UPDATE `repository` SET `value` = ? WHERE `key` = ?";
- }
-
- @Override
- public String deleteSQL() {
- return "DELETE FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String getType() {
- return "H2";
- }
-
- @Override
- public boolean isDefault() {
- return true;
- }
-}
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
b/mode/type/standalone/repository/provider/jdbc/h2/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
deleted file mode 100644
index 1ce78f6ecc8..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.mode.repository.standalone.h2.H2JDBCRepositoryProvider
diff --git a/mode/type/standalone/repository/provider/jdbc/mysql/pom.xml
b/mode/type/standalone/repository/provider/jdbc/mysql/pom.xml
deleted file mode 100644
index 42d8fc3fb02..00000000000
--- a/mode/type/standalone/repository/provider/jdbc/mysql/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
- <version>5.3.3-SNAPSHOT</version>
- </parent>
-
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-mysql</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-test-util</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/mode/type/standalone/repository/provider/jdbc/mysql/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProvider.java
b/mode/type/standalone/repository/provider/jdbc/mysql/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProvider.java
deleted file mode 100644
index 297667db9af..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/mysql/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.repository.standalone.jdbc.mysql;
-
-import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider;
-
-/**
- * MySQL JDBC repository provider.
- */
-public final class MySQLJDBCRepositoryProvider implements
JDBCRepositoryProvider {
-
- @Override
- public String createTableSQL() {
- return "CREATE TABLE IF NOT EXISTS `repository`(id varchar(36) PRIMARY
KEY, `key` TEXT, `value` TEXT, parent TEXT)";
- }
-
- @Override
- public String selectByKeySQL() {
- return "SELECT `value` FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String selectByParentKeySQL() {
- return "SELECT `key` FROM `repository` WHERE parent = ? ORDER BY `key`
ASC";
- }
-
- @Override
- public String insertSQL() {
- return "INSERT INTO `repository` VALUES(?, ?, ?, ?)";
- }
-
- @Override
- public String updateSQL() {
- return "UPDATE `repository` SET `value` = ? WHERE `key` = ?";
- }
-
- @Override
- public String deleteSQL() {
- return "DELETE FROM `repository` WHERE `key` = ?";
- }
-
- @Override
- public String getType() {
- return "MySQL";
- }
-}
diff --git
a/mode/type/standalone/repository/provider/jdbc/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
b/mode/type/standalone/repository/provider/jdbc/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
deleted file mode 100644
index 489eb10272b..00000000000
---
a/mode/type/standalone/repository/provider/jdbc/mysql/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.mode.repository.standalone.jdbc.mysql.MySQLJDBCRepositoryProvider
diff --git a/mode/type/standalone/repository/provider/jdbc/pom.xml
b/mode/type/standalone/repository/provider/jdbc/pom.xml
index 05fdb3f4a39..81b4ee1db15 100644
--- a/mode/type/standalone/repository/provider/jdbc/pom.xml
+++ b/mode/type/standalone/repository/provider/jdbc/pom.xml
@@ -25,11 +25,57 @@
<version>5.3.3-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
- <packaging>pom</packaging>
- <modules>
- <module>core</module>
- <module>h2</module>
- <module>mysql</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-standalone-mode-repository-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-util</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>javax.activation-api</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
similarity index 92%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
rename to
mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
index 6c12bebe236..c7161aa2b05 100644
---
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepository.java
@@ -21,11 +21,11 @@ import com.google.common.base.Strings;
import com.zaxxer.hikari.HikariDataSource;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository;
import
org.apache.shardingsphere.mode.repository.standalone.jdbc.props.JDBCRepositoryProperties;
import
org.apache.shardingsphere.mode.repository.standalone.jdbc.props.JDBCRepositoryPropertyKey;
import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider;
+import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProviderLoader;
import java.sql.Connection;
import java.sql.PreparedStatement;
@@ -56,8 +56,9 @@ public final class JDBCRepository implements
StandalonePersistRepository {
@Override
public void init(final Properties props) {
JDBCRepositoryProperties jdbcRepositoryProps = new
JDBCRepositoryProperties(props);
- provider = TypedSPILoader.getService(JDBCRepositoryProvider.class,
jdbcRepositoryProps.getValue(JDBCRepositoryPropertyKey.PROVIDER));
+ provider =
JDBCRepositoryProviderLoader.load(jdbcRepositoryProps.getValue(JDBCRepositoryPropertyKey.PROVIDER));
dataSource = new HikariDataSource();
+ dataSource.setDriverClassName(provider.getDriverClassName());
dataSource.setJdbcUrl(jdbcRepositoryProps.getValue(JDBCRepositoryPropertyKey.JDBC_URL));
dataSource.setUsername(jdbcRepositoryProps.getValue(JDBCRepositoryPropertyKey.USERNAME));
dataSource.setPassword(jdbcRepositoryProps.getValue(JDBCRepositoryPropertyKey.PASSWORD));
@@ -69,7 +70,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
statement.execute("DROP TABLE IF EXISTS `repository`");
}
// Finish TODO
- statement.execute(provider.createTableSQL());
+ statement.execute(provider.getCreateTableSQL());
}
}
@@ -77,7 +78,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
public String getDirectly(final String key) {
try (
Connection connection = dataSource.getConnection();
- PreparedStatement preparedStatement =
connection.prepareStatement(provider.selectByKeySQL())) {
+ PreparedStatement preparedStatement =
connection.prepareStatement(provider.getSelectByKeySQL())) {
preparedStatement.setString(1, key);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (resultSet.next()) {
@@ -94,7 +95,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
public List<String> getChildrenKeys(final String key) {
try (
Connection connection = dataSource.getConnection();
- PreparedStatement preparedStatement =
connection.prepareStatement(provider.selectByParentKeySQL())) {
+ PreparedStatement preparedStatement =
connection.prepareStatement(provider.getSelectByParentKeySQL())) {
preparedStatement.setString(1, key);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
List<String> resultChildren = new LinkedList<>();
@@ -151,7 +152,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
private void insert(final String key, final String value, final String
parent) throws SQLException {
try (
Connection connection = dataSource.getConnection();
- PreparedStatement preparedStatement =
connection.prepareStatement(provider.insertSQL())) {
+ PreparedStatement preparedStatement =
connection.prepareStatement(provider.getInsertSQL())) {
preparedStatement.setString(1, UUID.randomUUID().toString());
preparedStatement.setString(2, key);
preparedStatement.setString(3, value);
@@ -164,7 +165,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
public void update(final String key, final String value) {
try (
Connection connection = dataSource.getConnection();
- PreparedStatement preparedStatement =
connection.prepareStatement(provider.updateSQL())) {
+ PreparedStatement preparedStatement =
connection.prepareStatement(provider.getUpdateSQL())) {
preparedStatement.setString(1, value);
preparedStatement.setString(2, key);
preparedStatement.executeUpdate();
@@ -177,7 +178,7 @@ public final class JDBCRepository implements
StandalonePersistRepository {
public void delete(final String key) {
try (
Connection connection = dataSource.getConnection();
- PreparedStatement preparedStatement =
connection.prepareStatement(provider.deleteSQL())) {
+ PreparedStatement preparedStatement =
connection.prepareStatement(provider.getDeleteSQL())) {
preparedStatement.setString(1, key);
preparedStatement.executeUpdate();
} catch (final SQLException ex) {
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
similarity index 100%
copy from
mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
copy to
mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryPropertyKey.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryPropertyKey.java
similarity index 100%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryPropertyKey.java
rename to
mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryPropertyKey.java
diff --git
a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
new file mode 100644
index 00000000000..313e9805f93
--- /dev/null
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProvider.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
+
+import lombok.Getter;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * JDBC repository provider.
+ */
+@XmlRootElement(name = "sql")
+@Getter
+public class JDBCRepositoryProvider {
+
+ /**
+ * JDBCRepositoryProvider type.
+ */
+ @XmlAttribute(name = "type", required = true)
+ private String type;
+
+ /**
+ * JDBCRepositoryProvider driverClassName.
+ */
+ @XmlAttribute(name = "driver-class-name", required = true)
+ private String driverClassName;
+
+ /**
+ * Whether it is the default provider.
+ */
+ @XmlAttribute(name = "is-default")
+ private Boolean isDefault = false;
+
+ /**
+ * Create table SQL.
+ */
+ @XmlElement(name = "create-table", required = true)
+ private String createTableSQL;
+
+ /**
+ * Select by key SQL.
+ */
+ @XmlElement(name = "select-by-key", required = true)
+ private String selectByKeySQL;
+
+ /**
+ * Select by parent key SQL.
+ */
+ @XmlElement(name = "select-by-parent", required = true)
+ private String selectByParentKeySQL;
+
+ /**
+ * Insert SQL.
+ */
+ @XmlElement(name = "insert", required = true)
+ private String insertSQL;
+
+ /**
+ * Update SQL.
+ */
+ @XmlElement(name = "update", required = true)
+ private String updateSQL;
+
+ /**
+ * Delete SQL.
+ */
+ @XmlElement(name = "delete", required = true)
+ private String deleteSQL;
+
+}
diff --git
a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoader.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoader.java
new file mode 100644
index 00000000000..9c19565a852
--- /dev/null
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoader.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
+
+import lombok.SneakyThrows;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Enumeration;
+import java.util.Objects;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * JDBC repository provider Loader.
+ */
+public final class JDBCRepositoryProviderLoader {
+
+ private static final String ROOT_DIRECTORY =
"JAXB/JDBCRepositoryProvider/";
+
+ private static final String FILE_EXTENSION = ".xml";
+
+ /**
+ * Load JDBCRepositoryProvider.
+ *
+ * @param type type of JDBCRepositoryProvider
+ * @return loaded JDBCRepositoryProvider
+ */
+ @SneakyThrows({JAXBException.class, IOException.class,
URISyntaxException.class})
+ public static JDBCRepositoryProvider load(final String type) {
+ File file = new
File(JDBCRepositoryProviderLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath());
+ return file.isFile() ? loadFromJar(file, type) :
loadFromDirectory(type);
+ }
+
+ private static JDBCRepositoryProvider loadFromDirectory(final String type)
throws URISyntaxException, IOException {
+ Enumeration<URL> urls =
JDBCRepositoryProviderLoader.class.getClassLoader().getResources(ROOT_DIRECTORY);
+ if (null == urls) {
+ return null;
+ }
+ final JDBCRepositoryProvider[] result = new JDBCRepositoryProvider[1];
+ final boolean[] gotIt = new boolean[1];
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ Files.walkFileTree(Paths.get(url.toURI()), new
SimpleFileVisitor<Path>() {
+
+ @SneakyThrows(JAXBException.class)
+ @Override
+ public FileVisitResult visitFile(final Path file, final
BasicFileAttributes attributes) throws IOException {
+ if (file.toString().endsWith(FILE_EXTENSION)) {
+ JDBCRepositoryProvider provider =
(JDBCRepositoryProvider)
JAXBContext.newInstance(JDBCRepositoryProvider.class).createUnmarshaller()
+
.unmarshal(Files.newInputStream(file.toFile().toPath()));
+ if (Objects.equals(provider.getIsDefault(), true)) {
+ result[0] = provider;
+ }
+ if (Objects.equals(provider.getType(), type)) {
+ result[0] = provider;
+ gotIt[0] = true;
+ return FileVisitResult.TERMINATE;
+ }
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ if (gotIt[0]) {
+ return result[0];
+ }
+ }
+ return result[0];
+ }
+
+ private static JDBCRepositoryProvider loadFromJar(final File file, final
String type) throws JAXBException, IOException {
+ JDBCRepositoryProvider defaultProvider = null;
+ try (JarFile jar = new JarFile(file)) {
+ Enumeration<JarEntry> entries = jar.entries();
+ while (entries.hasMoreElements()) {
+ String name = entries.nextElement().getName();
+ if (!name.startsWith(ROOT_DIRECTORY) ||
!name.endsWith(FILE_EXTENSION)) {
+ continue;
+ }
+ final InputStream inputStream =
JDBCRepositoryProviderLoader.class.getClassLoader().getResourceAsStream(name);
+ JDBCRepositoryProvider provider = (JDBCRepositoryProvider)
JAXBContext.newInstance(JDBCRepositoryProvider.class).createUnmarshaller().unmarshal(inputStream);
+ if (Objects.equals(provider.getIsDefault(), true)) {
+ defaultProvider = provider;
+ }
+ if (Objects.equals(provider.getType(), type)) {
+ return provider;
+ }
+ }
+ }
+ return defaultProvider;
+ }
+}
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
b/mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/H2.xml
similarity index 56%
copy from
mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
copy to
mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/H2.xml
index d90fc4a7156..e2eab06f60a 100644
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/H2.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -16,18 +16,11 @@
~ limitations under the License.
-->
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="org.apache.shardingsphere" level="warn" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="error" />
- <appender-ref ref="console" />
- </root>
-</configuration>
+<sql type="H2" driver-class-name="org.h2.Driver" is-default="true">
+ <create-table>CREATE TABLE IF NOT EXISTS `repository`(id varchar(36)
PRIMARY KEY, `key` TEXT, `value` TEXT, parent TEXT)</create-table>
+ <select-by-key>SELECT `value` FROM `repository` WHERE `key` =
?</select-by-key>
+ <select-by-parent>SELECT `key` FROM `repository` WHERE parent =
?</select-by-parent>
+ <insert>INSERT INTO `repository` VALUES(?, ?, ?, ?)</insert>
+ <update>UPDATE `repository` SET `value` = ? WHERE `key` = ?</update>
+ <delete>DELETE FROM `repository` WHERE `key` = ?</delete>
+</sql>
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
b/mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/MySQL.xml
similarity index 55%
copy from
mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
copy to
mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/MySQL.xml
index d90fc4a7156..82151e20774 100644
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/resources/JAXB/JDBCRepositoryProvider/MySQL.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -16,18 +16,11 @@
~ limitations under the License.
-->
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="org.apache.shardingsphere" level="warn" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="error" />
- <appender-ref ref="console" />
- </root>
-</configuration>
+<sql type="MySQL" driver-class-name="com.mysql.jdbc.Driver">
+ <create-table>CREATE TABLE IF NOT EXISTS `repository`(id varchar(36)
PRIMARY KEY, `key` TEXT, `value` TEXT, parent TEXT)</create-table>
+ <select-by-key>SELECT `value` FROM `repository` WHERE `key` =
?</select-by-key>
+ <select-by-parent>SELECT `key` FROM `repository` WHERE parent = ? ORDER BY
`key` ASC</select-by-parent>
+ <insert>INSERT INTO `repository` VALUES(?, ?, ?, ?)</insert>
+ <update>UPDATE `repository` SET `value` = ? WHERE `key` = ?</update>
+ <delete>DELETE FROM `repository` WHERE `key` = ?</delete>
+</sql>
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository
b/mode/type/standalone/repository/provider/jdbc/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository
similarity index 100%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository
rename to
mode/type/standalone/repository/provider/jdbc/src/main/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepository
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
similarity index 82%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
rename to
mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
index fadf52d118f..7520e33123b 100644
---
a/mode/type/standalone/repository/provider/jdbc/core/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/JDBCRepositoryTest.java
@@ -18,7 +18,8 @@
package org.apache.shardingsphere.mode.repository.standalone.jdbc;
import com.zaxxer.hikari.HikariDataSource;
-import
org.apache.shardingsphere.mode.repository.standalone.jdbc.fixture.JDBCRepositoryProviderFixture;
+import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider;
+import
org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProviderLoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
import org.junit.jupiter.api.AfterEach;
@@ -49,7 +50,7 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class JDBCRepositoryTest {
- private final JDBCRepositoryProviderFixture fixture = new
JDBCRepositoryProviderFixture();
+ private JDBCRepositoryProvider fixture;
@Mock
private Connection mockJdbcConnection;
@@ -81,6 +82,7 @@ class JDBCRepositoryTest {
new Property("password", ""),
new Property("provider", "FIXTURE"));
repository.init(props);
+ fixture = JDBCRepositoryProviderLoader.load("FIXTURE");
}
@AfterEach
@@ -90,14 +92,14 @@ class JDBCRepositoryTest {
@Test
void assertInit() throws Exception {
- verify(mockStatement).execute(fixture.createTableSQL());
+ verify(mockStatement).execute(fixture.getCreateTableSQL());
}
@Test
void assertGet() throws Exception {
String key = "key";
String value = "value";
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(true);
when(mockResultSet.getString("value")).thenReturn(value);
@@ -108,7 +110,7 @@ class JDBCRepositoryTest {
@Test
void assertGetFailure() throws Exception {
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(false);
String actual = repository.getDirectly("key");
@@ -117,7 +119,7 @@ class JDBCRepositoryTest {
@Test
void assertPersistAndGetChildrenKeys() throws Exception {
-
when(mockJdbcConnection.prepareStatement(fixture.selectByParentKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByParentKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(true, true, true, false);
when(mockResultSet.getString("key")).thenReturn("parent1/test1",
"parent1/test2", "");
@@ -128,7 +130,7 @@ class JDBCRepositoryTest {
@Test
void assertPersistAndGetChildrenKeysFailure() throws Exception {
-
when(mockJdbcConnection.prepareStatement(fixture.selectByParentKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByParentKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(false);
List<String> actual = repository.getChildrenKeys("key");
@@ -139,8 +141,8 @@ class JDBCRepositoryTest {
void assertPersistWithUpdateForSimpleKeys() throws Exception {
final String key = "key";
final String value = "value";
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
-
when(mockJdbcConnection.prepareStatement(fixture.updateSQL())).thenReturn(mockPreparedStatementForPersist);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getUpdateSQL())).thenReturn(mockPreparedStatementForPersist);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(true);
when(mockResultSet.getString("value")).thenReturn("oldValue");
@@ -156,8 +158,8 @@ class JDBCRepositoryTest {
void assertPersistForDirectory() throws Exception {
final String key = "/parent/child/test1";
final String value = "test1_content";
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
-
when(mockJdbcConnection.prepareStatement(fixture.insertSQL())).thenReturn(mockPreparedStatementForPersist);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getInsertSQL())).thenReturn(mockPreparedStatementForPersist);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
repository.persist(key, value);
int depthOfDirectory = (int) key.chars().filter(ch -> ch ==
'/').count();
@@ -192,11 +194,11 @@ class JDBCRepositoryTest {
@Test
void assertPersistFailureDuringUpdate() throws Exception {
final String key = "key";
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(true);
when(mockResultSet.getString("value")).thenReturn("oldValue");
-
when(mockJdbcConnection.prepareStatement(fixture.updateSQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getUpdateSQL())).thenReturn(mockPreparedStatement);
repository.persist(key, "value");
verify(mockPreparedStatementForPersist, times(0)).executeUpdate();
}
@@ -205,8 +207,8 @@ class JDBCRepositoryTest {
void assertPersistWithInsertForSimpleKeys() throws Exception {
final String key = "key";
final String value = "value";
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
-
when(mockJdbcConnection.prepareStatement(fixture.insertSQL())).thenReturn(mockPreparedStatementForPersist);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getInsertSQL())).thenReturn(mockPreparedStatementForPersist);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(false);
repository.persist(key, value);
@@ -220,10 +222,10 @@ class JDBCRepositoryTest {
@Test
void assertPersistFailureDuringInsert() throws Exception {
-
when(mockJdbcConnection.prepareStatement(fixture.selectByKeySQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getSelectByKeySQL())).thenReturn(mockPreparedStatement);
when(mockPreparedStatement.executeQuery()).thenReturn(mockResultSet);
when(mockResultSet.next()).thenReturn(false);
-
when(mockJdbcConnection.prepareStatement(fixture.insertSQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getInsertSQL())).thenReturn(mockPreparedStatement);
repository.persist("key", "value");
verify(mockPreparedStatementForPersist, times(0)).executeUpdate();
}
@@ -231,7 +233,7 @@ class JDBCRepositoryTest {
@Test
void assertDelete() throws Exception {
String key = "key";
-
when(mockJdbcConnection.prepareStatement(fixture.deleteSQL())).thenReturn(mockPreparedStatement);
+
when(mockJdbcConnection.prepareStatement(fixture.getDeleteSQL())).thenReturn(mockPreparedStatement);
repository.delete(key);
verify(mockPreparedStatement).setString(1, key);
verify(mockPreparedStatement).executeUpdate();
@@ -240,7 +242,7 @@ class JDBCRepositoryTest {
@Test
void assertDeleteFailure() throws Exception {
String key = "key";
-
when(mockJdbcConnection.prepareStatement(fixture.deleteSQL())).thenReturn(mockPreparedStatementForPersist);
+
when(mockJdbcConnection.prepareStatement(fixture.getDeleteSQL())).thenReturn(mockPreparedStatementForPersist);
repository.delete(key);
verify(mockPreparedStatement, times(0)).executeUpdate();
}
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryTest.java
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/H2JDBCRepositoryTest.java
similarity index 97%
rename from
mode/type/standalone/repository/provider/jdbc/h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryTest.java
rename to
mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/H2JDBCRepositoryTest.java
index 6a6442e76ef..3e1b562787f 100644
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/java/org/apache/shardingsphere/mode/repository/standalone/h2/H2JDBCRepositoryTest.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/H2JDBCRepositoryTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.repository.standalone.h2;
+package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
import
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoaderTest.java
similarity index 60%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
rename to
mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoaderTest.java
index 577d5070a18..f1433bff6ed 100644
---
a/mode/type/standalone/repository/provider/jdbc/core/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/props/JDBCRepositoryProperties.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/JDBCRepositoryProviderLoaderTest.java
@@ -15,18 +15,24 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.repository.standalone.jdbc.props;
+package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
-import org.apache.shardingsphere.infra.util.props.TypedProperties;
+import org.junit.jupiter.api.Test;
-import java.util.Properties;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
-/**
- * JDBC repository properties.
- */
-public class JDBCRepositoryProperties extends
TypedProperties<JDBCRepositoryPropertyKey> {
+class JDBCRepositoryProviderLoaderTest {
+
+ @Test
+ void assertLoadFixtureProvider() {
+ final JDBCRepositoryProvider fixture =
JDBCRepositoryProviderLoader.load("FIXTURE");
+ assertThat(fixture.getType(), is("FIXTURE"));
+ }
- public JDBCRepositoryProperties(final Properties props) {
- super(JDBCRepositoryPropertyKey.class, props);
+ @Test
+ void assertLoadDefaultProvider() {
+ final JDBCRepositoryProvider fixture =
JDBCRepositoryProviderLoader.load("nonexistent");
+ assertThat(fixture.getType(), is("H2"));
}
}
diff --git
a/mode/type/standalone/repository/provider/jdbc/mysql/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProviderTest.java
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/MySQLJDBCRepositoryProviderTest.java
similarity index 82%
rename from
mode/type/standalone/repository/provider/jdbc/mysql/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProviderTest.java
rename to
mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/MySQLJDBCRepositoryProviderTest.java
index f259a2e72ea..8e5b490d4c6 100644
---
a/mode/type/standalone/repository/provider/jdbc/mysql/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/mysql/MySQLJDBCRepositoryProviderTest.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/test/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/provider/MySQLJDBCRepositoryProviderTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.mode.repository.standalone.jdbc.mysql;
+package org.apache.shardingsphere.mode.repository.standalone.jdbc.provider;
import com.zaxxer.hikari.HikariDataSource;
import
org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository;
@@ -56,7 +56,7 @@ class MySQLJDBCRepositoryProviderTest {
private MockedConstruction<HikariDataSource> construction;
- private final MySQLJDBCRepositoryProvider provider = new
MySQLJDBCRepositoryProvider();
+ private final JDBCRepositoryProvider provider =
JDBCRepositoryProviderLoader.load("MySQL");
private final JDBCRepository repository = new JDBCRepository();
@@ -76,9 +76,9 @@ class MySQLJDBCRepositoryProviderTest {
@Test
void assertPersistAndGet() throws SQLException {
-
when(connection.prepareStatement(provider.selectByKeySQL())).thenReturn(preparedStatement);
-
when(connection.prepareStatement(provider.insertSQL())).thenReturn(preparedStatement);
-
when(connection.prepareStatement(provider.updateSQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getSelectByKeySQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getInsertSQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getUpdateSQL())).thenReturn(preparedStatement);
when(preparedStatement.executeQuery()).thenReturn(resultSet);
when(resultSet.next()).thenReturn(false, true, true);
when(resultSet.getString("value")).thenReturn("test1_content",
"test1_content", "modify_content");
@@ -90,9 +90,9 @@ class MySQLJDBCRepositoryProviderTest {
@Test
void assertPersistAndGetChildrenKeys() throws SQLException {
-
when(connection.prepareStatement(provider.selectByKeySQL())).thenReturn(preparedStatement);
-
when(connection.prepareStatement(provider.insertSQL())).thenReturn(preparedStatement);
-
when(connection.prepareStatement(provider.selectByParentKeySQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getSelectByKeySQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getInsertSQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getSelectByParentKeySQL())).thenReturn(preparedStatement);
when(preparedStatement.executeQuery()).thenReturn(resultSet);
when(resultSet.next()).thenReturn(false, false, false, false, true,
true, false);
when(resultSet.getString("key")).thenReturn("test1", "test2");
@@ -105,8 +105,8 @@ class MySQLJDBCRepositoryProviderTest {
@Test
void assertDelete() throws SQLException {
-
when(connection.prepareStatement(provider.selectByKeySQL())).thenReturn(preparedStatement);
-
when(connection.prepareStatement(provider.deleteSQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getSelectByKeySQL())).thenReturn(preparedStatement);
+
when(connection.prepareStatement(provider.getDeleteSQL())).thenReturn(preparedStatement);
when(preparedStatement.executeQuery()).thenReturn(resultSet);
when(resultSet.next()).thenReturn(false);
repository.delete("/testPath");
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
b/mode/type/standalone/repository/provider/jdbc/src/test/resources/JAXB/JDBCRepositoryProvider/FIXTURE.xml
similarity index 56%
copy from
mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
copy to
mode/type/standalone/repository/provider/jdbc/src/test/resources/JAXB/JDBCRepositoryProvider/FIXTURE.xml
index d90fc4a7156..6fe8b60ddff 100644
---
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
+++
b/mode/type/standalone/repository/provider/jdbc/src/test/resources/JAXB/JDBCRepositoryProvider/FIXTURE.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
@@ -16,18 +16,11 @@
~ limitations under the License.
-->
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="org.apache.shardingsphere" level="warn" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="error" />
- <appender-ref ref="console" />
- </root>
-</configuration>
+<sql type="FIXTURE" driver-class-name="org.h2.Driver">
+ <create-table>CREATE TABLE IF NOT EXISTS `repository`(id varchar(36)
PRIMARY KEY, `key` TEXT, `value` TEXT, parent TEXT)</create-table>
+ <select-by-key>SELECT `value` FROM `repository` WHERE `key` =
?</select-by-key>
+ <select-by-parent>SELECT `key` FROM `repository` WHERE parent =
?</select-by-parent>
+ <insert>INSERT INTO `repository` VALUES(?, ?, ?, ?)</insert>
+ <update>UPDATE `repository` SET `value` = ? WHERE `key` = ?</update>
+ <delete>DELETE FROM `repository` WHERE `key` = ?</delete>
+</sql>
diff --git
a/mode/type/standalone/repository/provider/jdbc/core/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
b/mode/type/standalone/repository/provider/jdbc/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
similarity index 100%
rename from
mode/type/standalone/repository/provider/jdbc/core/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
rename to
mode/type/standalone/repository/provider/jdbc/src/test/resources/META-INF/services/org.apache.shardingsphere.mode.repository.standalone.jdbc.provider.JDBCRepositoryProvider
diff --git
a/mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
b/mode/type/standalone/repository/provider/jdbc/src/test/resources/logback-test.xml
similarity index 100%
rename from
mode/type/standalone/repository/provider/jdbc/h2/src/test/resources/logback-test.xml
rename to
mode/type/standalone/repository/provider/jdbc/src/test/resources/logback-test.xml
diff --git a/proxy/bootstrap/pom.xml b/proxy/bootstrap/pom.xml
index 180efa7cc36..094634fb320 100644
--- a/proxy/bootstrap/pom.xml
+++ b/proxy/bootstrap/pom.xml
@@ -80,7 +80,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
-
<artifactId>shardingsphere-standalone-mode-repository-jdbc-h2</artifactId>
+
<artifactId>shardingsphere-standalone-mode-repository-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>