You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/05/30 14:03:38 UTC
[shardingsphere] branch master updated: fix shadow-raw-jdbc-example
and shadow-spring-boot-example (#10550)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 443daa0 fix shadow-raw-jdbc-example and shadow-spring-boot-example (#10550)
443daa0 is described below
commit 443daa0b62b8d7517162a9a6de173af171c5789a
Author: Raigor <ra...@gmail.com>
AuthorDate: Sun May 30 22:03:05 2021 +0800
fix shadow-raw-jdbc-example and shadow-spring-boot-example (#10550)
* Fixes #10519, update proxy-example config
* fix DDL
* For #10545, fix shadow-raw-jdbc-example and shadow-spring-boot-example
---
.../fixture/TestQueryAssistedShardingEncryptAlgorithm.java | 9 ++++++++-
examples/pom.xml | 7 +++++++
.../example/shadow/table/raw/jdbc/factory/DataSourceFactory.java | 2 +-
.../shadow/table/raw/jdbc/factory/YamlDataSourceFactory.java | 2 +-
.../resources/application-encrypt-shadow-databases.properties | 3 ++-
.../application-readwrite-splitting-shadow-databases.properties | 4 ++--
.../resources/application-sharding-shadow-databases.properties | 4 ++--
examples/src/resources/manual_schema.sql | 6 ++++++
8 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/fixture/TestQueryAssistedShardingEncryptAlgorithm.java b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/fixture/TestQueryAssistedShardingEncryptAlgorithm.java
index 989b8c0..aea7814 100644
--- a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/fixture/TestQueryAssistedShardingEncryptAlgorithm.java
+++ b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/fixture/TestQueryAssistedShardingEncryptAlgorithm.java
@@ -18,9 +18,16 @@
package org.apache.shardingsphere.example.fixture;
import org.apache.shardingsphere.encrypt.spi.QueryAssistedEncryptAlgorithm;
+import lombok.Getter;
+import lombok.Setter;
+import java.util.Properties;
public final class TestQueryAssistedShardingEncryptAlgorithm implements QueryAssistedEncryptAlgorithm {
-
+
+ @Getter
+ @Setter
+ private Properties props;
+
@Override
public void init() {
}
diff --git a/examples/pom.xml b/examples/pom.xml
index 6f4feb0..e8a96cb 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -50,6 +50,7 @@
<h2.version>1.4.196</h2.version>
<slf4j.version>1.7.7</slf4j.version>
<logback.version>1.2.0</logback.version>
+ <lombok.version>1.18.16</lombok.version>
<mybatis.version>3.4.2</mybatis.version>
<mybatis-spring.version>1.3.0</mybatis-spring.version>
@@ -295,6 +296,12 @@
<dependencies>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP-java7</artifactId>
<version>${hikari-cp.version}</version>
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/DataSourceFactory.java b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/DataSourceFactory.java
index 61fae6c..6951a1e 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/DataSourceFactory.java
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/DataSourceFactory.java
@@ -36,7 +36,7 @@ public final class DataSourceFactory {
return new ShardingShadowDatabasesConfiguration().getDataSource();
case ENCRYPT_SHADOW:
return new EncryptShadowDatabasesConfiguration().getDataSource();
- case READWRITE_SPLITTING:
+ case READWRITE_SPLITTING_SHADOW:
return new ReadwriteSplittingShadowDatabasesConfiguration().getDataSource();
default:
throw new UnsupportedOperationException(shardingType.name());
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/YamlDataSourceFactory.java b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/YamlDataSourceFactory.java
index 4e44088..128e78f 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/YamlDataSourceFactory.java
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/shadow/table/raw/jdbc/factory/YamlDataSourceFactory.java
@@ -35,7 +35,7 @@ public final class YamlDataSourceFactory {
return YamlShardingSphereDataSourceFactory.createDataSource(getFile("/META-INF/shadow-databases.yaml"));
case ENCRYPT_SHADOW:
return YamlShardingSphereDataSourceFactory.createDataSource(getFile("/META-INF/encrypt-shadow-databases.yaml"));
- case READWRITE_SPLITTING:
+ case READWRITE_SPLITTING_SHADOW:
return YamlShardingSphereDataSourceFactory.createDataSource(getFile("/META-INF/readwrite-splitting-shadow-databases.yaml"));
default:
throw new UnsupportedOperationException(shardingType.name());
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-encrypt-shadow-databases.properties b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-encrypt-shadow-databases.properties
index 40b8917..6c49a99 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-encrypt-shadow-databases.properties
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-encrypt-shadow-databases.properties
@@ -30,7 +30,8 @@ spring.shardingsphere.datasource.shadow_ds.username=root
spring.shardingsphere.datasource.shadow_ds.password=
spring.shardingsphere.rules.shadow.column=shadow
-spring.shardingsphere.rules.shadow.shadow-mappings.ds=shadow_ds
+spring.shardingsphere.rules.shadow.sourceDataSourceNames=ds
+spring.shardingsphere.rules.shadow.shadowDataSourceNames=shadow_ds
spring.shardingsphere.rules.encrypt.encryptors.name_encryptor.type=AES
spring.shardingsphere.rules.encrypt.encryptors.name_encryptor.props.aes-key-value=123456
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-readwrite-splitting-shadow-databases.properties b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-readwrite-splitting-shadow-databases.properties
index b76db4f..ad890c1 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-readwrite-splitting-shadow-databases.properties
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-readwrite-splitting-shadow-databases.properties
@@ -42,8 +42,8 @@ spring.shardingsphere.datasource.shadow_read_ds.username=root
spring.shardingsphere.datasource.shadow_read_ds.password=
spring.shardingsphere.rules.shadow.column=shadow
-spring.shardingsphere.rules.shadow.shadow-mappings.write_ds=shadow_write_ds
-spring.shardingsphere.rules.shadow.shadow-mappings.read_ds=shadow_read_ds
+spring.shardingsphere.rules.shadow.sourceDataSourceNames=write_ds
+spring.shardingsphere.rules.shadow.shadowDataSourceNames=shadow_write_ds
spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin.type=ROUND_ROBIN
spring.shardingsphere.rules.readwrite-splitting.data-sources.pr_ds.write-data-source-name=write_ds
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-sharding-shadow-databases.properties b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-sharding-shadow-databases.properties
index aafbd40..37aa428 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-sharding-shadow-databases.properties
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/shadow-example/shadow-spring-boot-example/src/main/resources/application-sharding-shadow-databases.properties
@@ -42,8 +42,8 @@ spring.shardingsphere.datasource.shadow_ds_1.username=root
spring.shardingsphere.datasource.shadow_ds_1.password=
spring.shardingsphere.rules.shadow.column=shadow
-spring.shardingsphere.rules.shadow.shadow-mappings.ds_0=shadow_ds_0
-spring.shardingsphere.rules.shadow.shadow-mappings.ds_1=shadow_ds_1
+spring.shardingsphere.rules.shadow.sourceDataSourceNames=ds_0,ds_1
+spring.shardingsphere.rules.shadow.shadowDataSourceNames=shadow_ds_0,shadow_ds_1
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-column=user_id
spring.shardingsphere.rules.sharding.default-database-strategy.standard.sharding-algorithm-name=database_inline
diff --git a/examples/src/resources/manual_schema.sql b/examples/src/resources/manual_schema.sql
index 1d16b6a..a49f9b5 100644
--- a/examples/src/resources/manual_schema.sql
+++ b/examples/src/resources/manual_schema.sql
@@ -31,7 +31,10 @@ DROP SCHEMA IF EXISTS demo_write_ds_1_read_0;
DROP SCHEMA IF EXISTS demo_write_ds_1_read_1;
DROP SCHEMA IF EXISTS shadow_demo_ds;
+DROP SCHEMA IF EXISTS shadow_demo_ds_0;
+DROP SCHEMA IF EXISTS shadow_demo_ds_1;
+DROP SCHEMA IF EXISTS demo_shadow_write_ds;
DROP SCHEMA IF EXISTS demo_shadow_read_ds;
DROP SCHEMA IF EXISTS demo_read_ds;
@@ -51,7 +54,10 @@ CREATE SCHEMA IF NOT EXISTS demo_write_ds_1_read_0;
CREATE SCHEMA IF NOT EXISTS demo_write_ds_1_read_1;
CREATE SCHEMA IF NOT EXISTS shadow_demo_ds;
+CREATE SCHEMA IF NOT EXISTS shadow_demo_ds_0;
+CREATE SCHEMA IF NOT EXISTS shadow_demo_ds_1;
+CREATE SCHEMA IF NOT EXISTS demo_shadow_write_ds;
CREATE SCHEMA IF NOT EXISTS demo_shadow_read_ds;
CREATE SCHEMA IF NOT EXISTS demo_read_ds;