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 2e1d38d138d Remove default toConfiguration method on EncryptAlgorithm
(#32273)
2e1d38d138d is described below
commit 2e1d38d138d010037100ed8d1fc5f97244fc7bf7
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Jul 26 00:46:46 2024 +0800
Remove default toConfiguration method on EncryptAlgorithm (#32273)
---
.../org/apache/shardingsphere/encrypt/spi/EncryptAlgorithm.java | 6 +-----
.../encrypt/fixture/CoreEncryptAlgorithmFixture.java | 8 ++++++++
.../encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java | 8 ++++++++
.../encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java | 8 ++++++++
.../distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java | 8 ++++++++
.../e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java | 8 ++++++++
.../fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java | 8 ++++++++
.../test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java | 6 ++++++
.../fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java | 6 ++++++
.../fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java | 8 ++++++++
.../encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java | 8 ++++++++
.../fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java | 8 ++++++++
.../algorithm/TestQueryAssistedShardingEncryptAlgorithm.java | 8 ++++++++
13 files changed, 93 insertions(+), 5 deletions(-)
diff --git
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithm.java
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithm.java
index 573880131aa..5c4f02d83fe 100644
---
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithm.java
+++
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithm.java
@@ -21,8 +21,6 @@ import
org.apache.shardingsphere.infra.algorithm.core.ShardingSphereAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import java.util.Properties;
-
/**
* Encrypt algorithm.
*/
@@ -58,7 +56,5 @@ public interface EncryptAlgorithm extends
ShardingSphereAlgorithm {
*
* @return converted configuration
*/
- default AlgorithmConfiguration toConfiguration() {
- return new AlgorithmConfiguration(getType(), new Properties());
- }
+ AlgorithmConfiguration toConfiguration();
}
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java
index 1a817ef8bda..7d62173e97b 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package org.apache.shardingsphere.encrypt.fixture;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class CoreEncryptAlgorithmFixture implements EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class CoreEncryptAlgorithmFixture implements
EncryptAlgorithm {
return "decryptValue";
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "CORE.FIXTURE";
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java
index d91d66573c8..f3663b9a84e 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryAssistedEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package org.apache.shardingsphere.encrypt.fixture;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class CoreQueryAssistedEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class CoreQueryAssistedEncryptAlgorithmFixture
implements EncryptAl
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "CORE.QUERY_ASSISTED.FIXTURE";
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java
index 6295a91591e..1cefb3cafa7 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/fixture/CoreQueryLikeEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package org.apache.shardingsphere.encrypt.fixture;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class CoreQueryLikeEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class CoreQueryLikeEncryptAlgorithmFixture
implements EncryptAlgori
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "CORE.QUERY_LIKE.FIXTURE";
diff --git
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java
index 5a331f4553e..7e447fffd0d 100644
---
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java
+++
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/fixture/DistSQLEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.encrypt.distsql.handler.fixture;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class DistSQLEncryptAlgorithmFixture implements EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class DistSQLEncryptAlgorithmFixture implements
EncryptAlgorithm {
return "decryptValue";
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "DISTSQL.FIXTURE";
diff --git
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java
index 22e04596b5c..dff59a9ee0f 100644
---
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java
+++
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.e2e.driver.fixture.encrypt;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class JDBCEncryptAlgorithmFixture implements EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class JDBCEncryptAlgorithmFixture implements
EncryptAlgorithm {
return "decryptValue";
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "JDBC.FIXTURE";
diff --git
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java
index 76835ff8537..79d77506d9e 100644
---
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java
+++
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/encrypt/JDBCQueryAssistedEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.e2e.driver.fixture.encrypt;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class JDBCQueryAssistedEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class JDBCQueryAssistedEncryptAlgorithmFixture
implements EncryptAl
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "JDBC.QUERY_ASSISTED.FIXTURE";
diff --git
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
index 51ab4fa60b5..ffc7120d5e8 100644
---
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
+++
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
@@ -22,6 +22,7 @@ import lombok.Getter;
import lombok.SneakyThrows;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
@@ -161,6 +162,11 @@ public final class ITEncryptLikeAlgorithmFixture
implements EncryptAlgorithm {
return (char) (((originalChar + delta) & mask) + start);
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "IT.ENCRYPT.LIKE.FIXTURE";
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
index 12f9dd31a48..052719702c0 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
@@ -22,6 +22,7 @@ import lombok.Getter;
import lombok.SneakyThrows;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
@@ -161,6 +162,11 @@ public final class RewriteEncryptLikeAlgorithmFixture
implements EncryptAlgorith
return (char) (((originalChar + delta) & mask) + start);
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "IT.ENCRYPT.LIKE.FIXTURE";
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java
index 3cc88541078..29fb67a65e1 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class RewriteNormalEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -43,6 +46,11 @@ public final class RewriteNormalEncryptAlgorithmFixture
implements EncryptAlgori
return cipherValue.toString().replaceAll("encrypt_", "");
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "REWRITE.NORMAL.FIXTURE";
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java
index e3c1a88245c..dfa3ef5c6f2 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryAssistedEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class RewriteQueryAssistedEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -40,6 +43,11 @@ public final class
RewriteQueryAssistedEncryptAlgorithmFixture implements Encryp
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "REWRITE.ASSISTED_QUERY.FIXTURE";
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java
index 21913c0ac51..e5cbe26f3ad 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class RewriteQueryLikeEncryptAlgorithmFixture implements
EncryptAlgorithm {
@@ -37,6 +40,11 @@ public final class RewriteQueryLikeEncryptAlgorithmFixture
implements EncryptAlg
throw new UnsupportedOperationException(String.format("Algorithm `%s`
is unsupported to decrypt", getType()));
}
+ @Override
+ public AlgorithmConfiguration toConfiguration() {
+ return new AlgorithmConfiguration(getType(), new Properties());
+ }
+
@Override
public String getType() {
return "REWRITE.LIKE_QUERY.FIXTURE";
diff --git
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java
index 3bbf6ee4846..dc1ee63771f 100644
---
a/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java
+++
b/test/native/src/test/java/org/apache/shardingsphere/test/natived/jdbc/commons/algorithm/TestQueryAssistedShardingEncryptAlgorithm.java
@@ -20,8 +20,11 @@ package
org.apache.shardingsphere.test.natived.jdbc.commons.algorithm;
import lombok.Getter;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
+import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
+import java.util.Properties;
+
@Getter
public final class TestQueryAssistedShardingEncryptAlgorithm implements
EncryptAlgorithm {
@@ -37,6 +40,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(), new Properties());
+ }
+
@Override
public String getType() {
return "assistedTest";