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 625fc3a0cff0d..f5c01069f9530 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 @@ -38,8 +38,7 @@ public final class TestQueryAssistedShardingEncryptAlgorithm implements EncryptA @Override public void init(final Properties props) { this.properties = props; - EncryptAlgorithmMetaData algorithmMetaData = new EncryptAlgorithmMetaData(); - algorithmMetaData.setSupportDecrypt(false); + EncryptAlgorithmMetaData algorithmMetaData = new EncryptAlgorithmMetaData(false, true, false); metaData = algorithmMetaData; } diff --git a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java index cff0d7a4d1fa1..01cc3876eb1f6 100644 --- a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java +++ b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/spi/EncryptAlgorithmMetaData.java @@ -18,20 +18,18 @@ package org.apache.shardingsphere.encrypt.spi; import lombok.Getter; -import lombok.Setter; +import lombok.RequiredArgsConstructor; /** * Encrypt algorithm meta data. */ +@RequiredArgsConstructor @Getter public final class EncryptAlgorithmMetaData { - @Setter - private boolean supportDecrypt = true; + private final boolean supportDecrypt; - @Setter - private boolean supportEquivalentFilter = true; + private final boolean supportEquivalentFilter; - @Setter - private boolean supportLike; + private final boolean supportLike; } diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java index 448b747a85a2e..09a88ef31dcf2 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithm.java @@ -42,9 +42,7 @@ public final class MD5AssistedEncryptAlgorithm implements EncryptAlgorithm { @Override public void init(final Properties props) { this.salt = props.getProperty(SALT_KEY, ""); - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, false); } @Override diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java index 7884987bdb1ce..bfb4c762f3116 100644 --- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java +++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java @@ -57,7 +57,7 @@ public final class AESEncryptAlgorithm implements EncryptAlgorithm { @Override public void init(final Properties props) { - metaData = new EncryptAlgorithmMetaData(); + metaData = new EncryptAlgorithmMetaData(true, true, false); secretKey = createSecretKey(props); } 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 5b7a199da87ab..c1b0d9898ee90 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 @@ -25,7 +25,7 @@ @Getter public final class CoreEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final EncryptContext encryptContext) { 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 7943f6bfa777e..a2aedc3fff97a 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 @@ -31,9 +31,7 @@ public final class CoreQueryAssistedEncryptAlgorithmFixture implements EncryptAl @Override public void init(final Properties props) { - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, false); } @Override 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 ca2231bb0a1b2..9aa87c4e59257 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 @@ -31,11 +31,7 @@ public final class CoreQueryLikeEncryptAlgorithmFixture implements EncryptAlgori @Override public void init(final Properties props) { - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportLike(true); - encryptAlgorithmMetaData.setSupportDecrypt(false); - encryptAlgorithmMetaData.setSupportEquivalentFilter(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, false, true); } @Override 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 60b7cb9658b6c..5f1e84472e870 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 @@ -25,7 +25,7 @@ @Getter public final class DistSQLEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final EncryptContext encryptContext) { 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 114b7c7d3a0e7..f3e607abe065c 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 @@ -25,7 +25,7 @@ @Getter public final class JDBCEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final EncryptContext encryptContext) { 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 f5405383ef2da..31b18b45865a9 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 @@ -31,9 +31,7 @@ public final class JDBCQueryAssistedEncryptAlgorithmFixture implements EncryptAl @Override public void init(final Properties props) { - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, false); } @Override 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 2e86de97152e0..855e2a10da478 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 @@ -69,10 +69,7 @@ public void init(final Properties props) { mask = createMask(props); start = createStart(props); charIndexes = createCharIndexes(props); - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportLike(true); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, true); } private int createDelta(final Properties props) { 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 69c204bbc268e..fffc98c1342da 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 @@ -25,7 +25,7 @@ @Getter public final class RewriteNormalEncryptAlgorithmFixture implements EncryptAlgorithm { - private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(); + private final EncryptAlgorithmMetaData metaData = new EncryptAlgorithmMetaData(true, true, false); @Override public String encrypt(final Object plainValue, final EncryptContext encryptContext) { 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 34e0818aed46c..166accbf0980b 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 @@ -31,9 +31,7 @@ public final class RewriteQueryAssistedEncryptAlgorithmFixture implements Encryp @Override public void init(final Properties props) { - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, false); } @Override 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 61bd34ba5414d..7e2115b49ffec 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 @@ -31,10 +31,7 @@ public final class RewriteQueryLikeEncryptAlgorithmFixture implements EncryptAlg @Override public void init(final Properties props) { - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportLike(true); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, true); } @Override 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 41ffd1e571202..c0d4a9700a4ba 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 @@ -34,9 +34,7 @@ public final class TestQueryAssistedShardingEncryptAlgorithm implements EncryptA @Override public void init(final Properties props) { this.properties = props; - EncryptAlgorithmMetaData encryptAlgorithmMetaData = new EncryptAlgorithmMetaData(); - encryptAlgorithmMetaData.setSupportDecrypt(false); - metaData = encryptAlgorithmMetaData; + metaData = new EncryptAlgorithmMetaData(false, true, false); } @Override