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 ef8aefe342d Fix encrypt/shadow example generator templates for new SPI
signatures (#37547)
ef8aefe342d is described below
commit ef8aefe342d614f6a94a70dbf238f3b74e689b47
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Dec 26 22:30:40 2025 +0800
Fix encrypt/shadow example generator templates for new SPI signatures
(#37547)
---
.../java/TestQueryAssistedShardingEncryptAlgorithm.ftl | 11 +++++++++++
.../src/main/resources/template/java/config/Configuration.ftl | 2 +-
.../src/main/resources/template/java/config/shadow.ftl | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/TestQueryAssistedShardingEncryptAlgorithm.ftl
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/TestQueryAssistedShardingEncryptAlgorithm.ftl
index e8e9f70f4bf..bd5ee9e0268 100644
---
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/TestQueryAssistedShardingEncryptAlgorithm.ftl
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/TestQueryAssistedShardingEncryptAlgorithm.ftl
@@ -21,6 +21,7 @@ package
org.apache.shardingsphere.example.${package}.${framework?replace('-', '.
import lombok.Getter;
import lombok.Setter;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
@@ -42,6 +43,11 @@ public final class TestQueryAssistedShardingEncryptAlgorithm
implements EncryptA
metaData = algorithmMetaData;
}
+ @Override
+ public EncryptAlgorithmMetaData getMetaData() {
+ return metaData;
+ }
+
@Override
public String encrypt(final Object plainValue, final AlgorithmSQLContext
algorithmSQLContext) {
return "assistedEncryptValue";
@@ -52,6 +58,11 @@ public final class TestQueryAssistedShardingEncryptAlgorithm
implements EncryptA
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), properties);
+ }
+
@Override
public String getType() {
return "assistedTest";
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/Configuration.ftl
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/Configuration.ftl
index fc48b28e6ae..3f89c68c80b 100644
---
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/Configuration.ftl
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/Configuration.ftl
@@ -54,7 +54,7 @@ import
org.apache.shardingsphere.shadow.config.ShadowRuleConfiguration;
import
org.apache.shardingsphere.shadow.config.datasource.ShadowDataSourceConfiguration;
import org.apache.shardingsphere.shadow.config.table.ShadowTableConfiguration;
import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
-import org.apache.shardingsphere.sql.parser.api.CacheOption;
+import org.apache.shardingsphere.sql.parser.engine.api.CacheOption;
</#if>
<#if feature?contains("mask")>
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
diff --git
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/shadow.ftl
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/shadow.ftl
index f5ab02f5a91..0b349af0ee8 100644
---
a/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/shadow.ftl
+++
b/examples/shardingsphere-jdbc-example-generator/src/main/resources/template/java/config/shadow.ftl
@@ -25,7 +25,7 @@
}
private RuleConfiguration createSQLParserRuleConfiguration() {
- return new SQLParserRuleConfiguration(true, new CacheOption(128,
1024L), new CacheOption(2000, 65535L));
+ return new SQLParserRuleConfiguration(new CacheOption(128, 1024L), new
CacheOption(2000, 65535L));
}
private Map<String, ShadowTableConfiguration> createShadowTables() {