This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 7b5babadf97 Rmove <I, O> from encrypt algorithm (#28439)
7b5babadf97 is described below
commit 7b5babadf973c321f06dfa1f2d6ecd144d3220aa
Author: Chuxin Chen <[email protected]>
AuthorDate: Fri Sep 15 13:42:40 2023 +0800
Rmove <I, O> from encrypt algorithm (#28439)
* remove <I, O> from encrypt algorithm
* remove <I, O> from encrypt algorithm
---
.../api/encrypt/assisted/AssistedEncryptAlgorithm.java | 5 +----
.../encrypt/api/encrypt/like/LikeEncryptAlgorithm.java | 5 +----
.../api/encrypt/standard/StandardEncryptAlgorithm.java | 7 ++-----
.../shardingsphere/encrypt/spi/EncryptAlgorithm.java | 7 ++-----
.../algorithm/assisted/MD5AssistedEncryptAlgorithm.java | 2 +-
.../algorithm/like/CharDigestLikeEncryptAlgorithm.java | 4 ++--
.../encrypt/algorithm/standard/AESEncryptAlgorithm.java | 8 ++++----
.../encrypt/algorithm/standard/RC4EncryptAlgorithm.java | 6 +++---
.../token/generator/EncryptAlterTableTokenGenerator.java | 6 +++---
.../rewrite/token/util/EncryptTokenGeneratorUtils.java | 16 ++++++++--------
.../apache/shardingsphere/encrypt/rule/EncryptRule.java | 12 +-----------
.../apache/shardingsphere/encrypt/rule/EncryptTable.java | 5 ++---
.../rule/column/item/AssistedQueryColumnItem.java | 3 ---
.../encrypt/rule/column/item/CipherColumnItem.java | 4 ----
.../encrypt/rule/column/item/LikeQueryColumnItem.java | 3 ---
.../assisted/MD5AssistedEncryptAlgorithmTest.java | 5 ++---
.../like/CharDigestLikeEncryptAlgorithmTest.java | 15 +++++++--------
.../algorithm/standard/AESEncryptAlgorithmTest.java | 7 +++----
.../algorithm/standard/RC4EncryptAlgorithmTest.java | 7 +++----
.../encrypt/fixture/CoreEncryptAlgorithmFixture.java | 6 +++---
.../CoreQueryAssistedEncryptAlgorithmFixture.java | 2 +-
.../fixture/CoreQueryLikeEncryptAlgorithmFixture.java | 4 ++--
.../fixture/encrypt/JDBCEncryptAlgorithmFixture.java | 6 +++---
.../JDBCQueryAssistedEncryptAlgorithmFixture.java | 2 +-
.../encrypt/RewriteNormalEncryptAlgorithmFixture.java | 8 ++++----
.../RewriteQueryAssistedEncryptAlgorithmFixture.java | 2 +-
.../encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java | 4 ++--
27 files changed, 62 insertions(+), 99 deletions(-)
diff --git
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/assisted/AssistedEncryptAlgorithm.java
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/assisted/AssistedEncryptAlgorithm.java
index 7fc39fa4c85..17f57b1c40f 100644
---
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/assisted/AssistedEncryptAlgorithm.java
+++
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/assisted/AssistedEncryptAlgorithm.java
@@ -21,9 +21,6 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
/**
* Assisted encrypt algorithm.
- *
- * @param <I> type of plain value
- * @param <O> type of cipher value
*/
-public interface AssistedEncryptAlgorithm<I, O> extends EncryptAlgorithm<I, O>
{
+public interface AssistedEncryptAlgorithm extends EncryptAlgorithm {
}
diff --git
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/like/LikeEncryptAlgorithm.java
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/like/LikeEncryptAlgorithm.java
index d79902da884..a534a530ab7 100644
---
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/like/LikeEncryptAlgorithm.java
+++
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/like/LikeEncryptAlgorithm.java
@@ -21,9 +21,6 @@ import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
/**
* Like encrypt algorithm.
- *
- * @param <I> type of plain value
- * @param <O> type of cipher value
*/
-public interface LikeEncryptAlgorithm<I, O> extends EncryptAlgorithm<I, O> {
+public interface LikeEncryptAlgorithm extends EncryptAlgorithm {
}
diff --git
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/standard/StandardEncryptAlgorithm.java
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/standard/StandardEncryptAlgorithm.java
index 7b2de2ed64e..69c5102592a 100644
---
a/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/standard/StandardEncryptAlgorithm.java
+++
b/features/encrypt/api/src/main/java/org/apache/shardingsphere/encrypt/api/encrypt/standard/StandardEncryptAlgorithm.java
@@ -22,11 +22,8 @@ import
org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
/**
* Standard encrypt algorithm.
- *
- * @param <I> type of plain value
- * @param <O> type of cipher value
*/
-public interface StandardEncryptAlgorithm<I, O> extends EncryptAlgorithm<I, O>
{
+public interface StandardEncryptAlgorithm extends EncryptAlgorithm {
/**
* Decrypt.
@@ -35,5 +32,5 @@ public interface StandardEncryptAlgorithm<I, O> extends
EncryptAlgorithm<I, O> {
* @param encryptContext encrypt context
* @return plain value
*/
- I decrypt(O cipherValue, EncryptContext encryptContext);
+ Object decrypt(Object cipherValue, EncryptContext encryptContext);
}
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 b7611f40fbf..27839f7e09c 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
@@ -22,11 +22,8 @@ import
org.apache.shardingsphere.infra.algorithm.ShardingSphereAlgorithm;
/**
* Encrypt algorithm.
- *
- * @param <I> type of plain value
- * @param <O> type of cipher value
*/
-public interface EncryptAlgorithm<I, O> extends ShardingSphereAlgorithm {
+public interface EncryptAlgorithm extends ShardingSphereAlgorithm {
/**
* Encrypt.
@@ -35,5 +32,5 @@ public interface EncryptAlgorithm<I, O> extends
ShardingSphereAlgorithm {
* @param encryptContext encrypt context
* @return cipher value
*/
- O encrypt(I plainValue, EncryptContext encryptContext);
+ Object encrypt(Object plainValue, EncryptContext encryptContext);
}
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 6568c0faa1a..11f43bb3c0e 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
@@ -28,7 +28,7 @@ import java.util.Properties;
* MD5 assisted encrypt algorithm.
*/
@EqualsAndHashCode
-public final class MD5AssistedEncryptAlgorithm implements
AssistedEncryptAlgorithm<Object, String> {
+public final class MD5AssistedEncryptAlgorithm implements
AssistedEncryptAlgorithm {
private static final String SALT_KEY = "salt";
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
index b98345721b5..4b64d855695 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithm.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.encrypt.algorithm.like;
import com.google.common.base.Strings;
import lombok.EqualsAndHashCode;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
import
org.apache.shardingsphere.encrypt.exception.algorithm.EncryptAlgorithmInitializationException;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import java.io.IOException;
import java.io.InputStream;
@@ -37,7 +37,7 @@ import java.util.stream.IntStream;
* Char digest like encrypt algorithm.
*/
@EqualsAndHashCode
-public final class CharDigestLikeEncryptAlgorithm implements
LikeEncryptAlgorithm<Object, String> {
+public final class CharDigestLikeEncryptAlgorithm implements
LikeEncryptAlgorithm {
private static final String DELTA_KEY = "delta";
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 e18c60c5660..6433d355598 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
@@ -22,9 +22,9 @@ import lombok.EqualsAndHashCode;
import lombok.SneakyThrows;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import
org.apache.shardingsphere.encrypt.exception.algorithm.EncryptAlgorithmInitializationException;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import javax.crypto.Cipher;
@@ -42,7 +42,7 @@ import java.util.Properties;
* AES encrypt algorithm.
*/
@EqualsAndHashCode
-public final class AESEncryptAlgorithm implements
StandardEncryptAlgorithm<Object, String> {
+public final class AESEncryptAlgorithm implements StandardEncryptAlgorithm {
private static final String AES_KEY = "aes-key-value";
@@ -75,11 +75,11 @@ public final class AESEncryptAlgorithm implements
StandardEncryptAlgorithm<Objec
@SneakyThrows(GeneralSecurityException.class)
@Override
- public Object decrypt(final String cipherValue, final EncryptContext
encryptContext) {
+ public Object decrypt(final Object cipherValue, final EncryptContext
encryptContext) {
if (null == cipherValue) {
return null;
}
- byte[] result =
getCipher(Cipher.DECRYPT_MODE).doFinal(Base64.getDecoder().decode(cipherValue.trim()));
+ byte[] result =
getCipher(Cipher.DECRYPT_MODE).doFinal(Base64.getDecoder().decode(cipherValue.toString().trim()));
return new String(result, StandardCharsets.UTF_8);
}
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithm.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithm.java
index c121aabb9b0..1bc3e2169e5 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithm.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithm.java
@@ -31,7 +31,7 @@ import java.util.Properties;
* RC4 encrypt algorithm.
*/
@EqualsAndHashCode
-public final class RC4EncryptAlgorithm implements
StandardEncryptAlgorithm<Object, String> {
+public final class RC4EncryptAlgorithm implements StandardEncryptAlgorithm {
private static final String RC4_KEY = "rc4-key-value";
@@ -59,8 +59,8 @@ public final class RC4EncryptAlgorithm implements
StandardEncryptAlgorithm<Objec
}
@Override
- public Object decrypt(final String cipherValue, final EncryptContext
encryptContext) {
- return null == cipherValue ? null : new
String(crypt(Base64.decodeBase64(cipherValue)), StandardCharsets.UTF_8);
+ public Object decrypt(final Object cipherValue, final EncryptContext
encryptContext) {
+ return null == cipherValue ? null : new
String(crypt(Base64.decodeBase64(cipherValue.toString())),
StandardCharsets.UTF_8);
}
/*
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
index 33e07a8cbca..6fa11e1e4ec 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAlterTableTokenGenerator.java
@@ -31,11 +31,11 @@ import
org.apache.shardingsphere.encrypt.rule.column.item.AssistedQueryColumnIte
import org.apache.shardingsphere.encrypt.rule.column.item.LikeQueryColumnItem;
import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.ddl.AlterTableStatementContext;
+import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.rewrite.sql.token.generator.CollectionSQLTokenGenerator;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.Substitutable;
import
org.apache.shardingsphere.infra.rewrite.sql.token.pojo.generic.RemoveToken;
-import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.ColumnDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.alter.AddColumnDefinitionSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.column.alter.ChangeColumnDefinitionSegment;
@@ -176,8 +176,8 @@ public final class EncryptAlterTableTokenGenerator
implements CollectionSQLToken
}
private void isSameEncryptColumn(final EncryptTable encryptTable, final
String previousColumnName, final String columnName) {
- Optional<StandardEncryptAlgorithm<?, ?>> previousEncryptor =
encryptTable.findEncryptor(previousColumnName);
- Optional<StandardEncryptAlgorithm<?, ?>> currentEncryptor =
encryptTable.findEncryptor(columnName);
+ Optional<StandardEncryptAlgorithm> previousEncryptor =
encryptTable.findEncryptor(previousColumnName);
+ Optional<StandardEncryptAlgorithm> currentEncryptor =
encryptTable.findEncryptor(columnName);
if (!previousEncryptor.isPresent() && !currentEncryptor.isPresent()) {
return;
}
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/util/EncryptTokenGeneratorUtils.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/util/EncryptTokenGeneratorUtils.java
index f3ad417f780..96f8b2ce5fb 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/util/EncryptTokenGeneratorUtils.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/util/EncryptTokenGeneratorUtils.java
@@ -51,8 +51,8 @@ public final class EncryptTokenGeneratorUtils {
if (!(each.getLeft() instanceof ColumnSegment) ||
!(each.getRight() instanceof ColumnSegment)) {
continue;
}
- EncryptAlgorithm<?, ?> leftColumnEncryptor =
getColumnEncryptor(((ColumnSegment) each.getLeft()).getColumnBoundedInfo(),
encryptRule);
- EncryptAlgorithm<?, ?> rightColumnEncryptor =
getColumnEncryptor(((ColumnSegment) each.getRight()).getColumnBoundedInfo(),
encryptRule);
+ EncryptAlgorithm leftColumnEncryptor =
getColumnEncryptor(((ColumnSegment) each.getLeft()).getColumnBoundedInfo(),
encryptRule);
+ EncryptAlgorithm rightColumnEncryptor =
getColumnEncryptor(((ColumnSegment) each.getRight()).getColumnBoundedInfo(),
encryptRule);
if (!isSameEncryptor(leftColumnEncryptor, rightColumnEncryptor)) {
return false;
}
@@ -69,8 +69,8 @@ public final class EncryptTokenGeneratorUtils {
*/
public static boolean isAllUsingConditionsUseSameEncryptor(final
Collection<ColumnSegment> usingColumns, final EncryptRule encryptRule) {
for (ColumnSegment each : usingColumns) {
- EncryptAlgorithm<?, ?> leftColumnEncryptor =
getColumnEncryptor(each.getColumnBoundedInfo(), encryptRule);
- EncryptAlgorithm<?, ?> rightColumnEncryptor =
getColumnEncryptor(each.getOtherUsingColumnBoundedInfo(), encryptRule);
+ EncryptAlgorithm leftColumnEncryptor =
getColumnEncryptor(each.getColumnBoundedInfo(), encryptRule);
+ EncryptAlgorithm rightColumnEncryptor =
getColumnEncryptor(each.getOtherUsingColumnBoundedInfo(), encryptRule);
if (!isSameEncryptor(leftColumnEncryptor, rightColumnEncryptor)) {
return false;
}
@@ -78,7 +78,7 @@ public final class EncryptTokenGeneratorUtils {
return true;
}
- private static boolean isSameEncryptor(final EncryptAlgorithm<?, ?>
leftColumnEncryptor, final EncryptAlgorithm<?, ?> rightColumnEncryptor) {
+ private static boolean isSameEncryptor(final EncryptAlgorithm
leftColumnEncryptor, final EncryptAlgorithm rightColumnEncryptor) {
if (null != leftColumnEncryptor && null != rightColumnEncryptor) {
if
(!leftColumnEncryptor.getType().equals(rightColumnEncryptor.getType())) {
return false;
@@ -88,7 +88,7 @@ public final class EncryptTokenGeneratorUtils {
return null == leftColumnEncryptor && null == rightColumnEncryptor;
}
- private static EncryptAlgorithm<?, ?> getColumnEncryptor(final
ColumnSegmentBoundedInfo columnBoundedInfo, final EncryptRule encryptRule) {
+ private static EncryptAlgorithm getColumnEncryptor(final
ColumnSegmentBoundedInfo columnBoundedInfo, final EncryptRule encryptRule) {
String tableName = columnBoundedInfo.getOriginalTable().getValue();
String columnName = columnBoundedInfo.getOriginalColumn().getValue();
if (!encryptRule.findEncryptTable(tableName).isPresent() ||
!encryptRule.getEncryptTable(tableName).isEncryptColumn(columnName)) {
@@ -115,12 +115,12 @@ public final class EncryptTokenGeneratorUtils {
Iterator<Projection> projectionIterator = projections.iterator();
while (insertColumnsIterator.hasNext()) {
ColumnSegment columnSegment = insertColumnsIterator.next();
- EncryptAlgorithm<?, ?> leftColumnEncryptor =
getColumnEncryptor(columnSegment.getColumnBoundedInfo(), encryptRule);
+ EncryptAlgorithm leftColumnEncryptor =
getColumnEncryptor(columnSegment.getColumnBoundedInfo(), encryptRule);
Projection projection = projectionIterator.next();
ColumnSegmentBoundedInfo columnBoundedInfo = projection instanceof
ColumnProjection
? new ColumnSegmentBoundedInfo(null, null,
((ColumnProjection) projection).getOriginalTable(), ((ColumnProjection)
projection).getOriginalColumn())
: new ColumnSegmentBoundedInfo(new
IdentifierValue(projection.getColumnLabel()));
- EncryptAlgorithm<?, ?> rightColumnEncryptor =
getColumnEncryptor(columnBoundedInfo, encryptRule);
+ EncryptAlgorithm rightColumnEncryptor =
getColumnEncryptor(columnBoundedInfo, encryptRule);
if (!isSameEncryptor(leftColumnEncryptor, rightColumnEncryptor)) {
return false;
}
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
index 4badc977b4d..f4548d0f970 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptRule.java
@@ -29,10 +29,10 @@ import
org.apache.shardingsphere.encrypt.exception.algorithm.MismatchedEncryptAl
import
org.apache.shardingsphere.encrypt.exception.metadata.EncryptTableNotFoundException;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
+import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.rule.identifier.scope.DatabaseRule;
import org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule;
import org.apache.shardingsphere.infra.rule.identifier.type.TableNamesMapper;
-import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import java.util.LinkedHashMap;
@@ -56,11 +56,8 @@ public final class EncryptRule implements DatabaseRule,
TableContainedRule {
public EncryptRule(final String databaseName, final
EncryptRuleConfiguration ruleConfig) {
this.databaseName = databaseName;
configuration = ruleConfig;
- @SuppressWarnings("rawtypes")
Map<String, StandardEncryptAlgorithm> standardEncryptors = new
LinkedHashMap<>();
- @SuppressWarnings("rawtypes")
Map<String, AssistedEncryptAlgorithm> assistedEncryptors = new
LinkedHashMap<>();
- @SuppressWarnings("rawtypes")
Map<String, LikeEncryptAlgorithm> likeEncryptors = new
LinkedHashMap<>();
ruleConfig.getEncryptors().forEach((key, value) -> putAllEncryptors(
key, TypedSPILoader.getService(EncryptAlgorithm.class,
value.getType(), value.getProps()), standardEncryptors, assistedEncryptors,
likeEncryptors));
@@ -82,11 +79,8 @@ public final class EncryptRule implements DatabaseRule,
TableContainedRule {
public EncryptRule(final String databaseName, final
CompatibleEncryptRuleConfiguration ruleConfig) {
this.databaseName = databaseName;
configuration = ruleConfig;
- @SuppressWarnings("rawtypes")
Map<String, StandardEncryptAlgorithm> standardEncryptors = new
LinkedHashMap<>();
- @SuppressWarnings("rawtypes")
Map<String, AssistedEncryptAlgorithm> assistedEncryptors = new
LinkedHashMap<>();
- @SuppressWarnings("rawtypes")
Map<String, LikeEncryptAlgorithm> likeEncryptors = new
LinkedHashMap<>();
ruleConfig.getEncryptors().forEach((key, value) -> putAllEncryptors(
key, TypedSPILoader.getService(EncryptAlgorithm.class,
value.getType(), value.getProps()), standardEncryptors, assistedEncryptors,
likeEncryptors));
@@ -99,7 +93,6 @@ public final class EncryptRule implements DatabaseRule,
TableContainedRule {
}
}
- @SuppressWarnings("rawtypes")
private void putAllEncryptors(final String encryptorName, final
EncryptAlgorithm algorithm, final Map<String, StandardEncryptAlgorithm>
standardEncryptors,
final Map<String, AssistedEncryptAlgorithm>
assistedEncryptors, final Map<String, LikeEncryptAlgorithm> likeEncryptors) {
if (algorithm instanceof StandardEncryptAlgorithm) {
@@ -113,19 +106,16 @@ public final class EncryptRule implements DatabaseRule,
TableContainedRule {
}
}
- @SuppressWarnings("rawtypes")
private void checkStandardEncryptorType(final
EncryptColumnRuleConfiguration columnRuleConfig, final Map<String,
StandardEncryptAlgorithm> standardEncryptors) {
ShardingSpherePreconditions.checkState(standardEncryptors.containsKey(columnRuleConfig.getCipher().getEncryptorName()),
() -> new
MismatchedEncryptAlgorithmTypeException(databaseName, "Cipher",
columnRuleConfig.getCipher().getEncryptorName(),
StandardEncryptAlgorithm.class.getSimpleName()));
}
- @SuppressWarnings("rawtypes")
private void checkAssistedQueryEncryptorType(final
EncryptColumnRuleConfiguration columnRuleConfig, final Map<String,
AssistedEncryptAlgorithm> assistedEncryptors) {
columnRuleConfig.getAssistedQuery().ifPresent(optional ->
ShardingSpherePreconditions.checkState(assistedEncryptors.containsKey(optional.getEncryptorName()),
() -> new
MismatchedEncryptAlgorithmTypeException(databaseName, "Assisted query",
optional.getEncryptorName(), AssistedEncryptAlgorithm.class.getSimpleName())));
}
- @SuppressWarnings("rawtypes")
private void checkLikeQueryEncryptorType(final
EncryptColumnRuleConfiguration columnRuleConfig, final Map<String,
LikeEncryptAlgorithm> likeEncryptors) {
columnRuleConfig.getLikeQuery().ifPresent(optional ->
ShardingSpherePreconditions.checkState(likeEncryptors.containsKey(optional.getEncryptorName()),
() -> new
MismatchedEncryptAlgorithmTypeException(databaseName, "Like query",
optional.getEncryptorName(), LikeEncryptAlgorithm.class.getSimpleName())));
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
index 073718b5a74..e230de7450d 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
@@ -64,7 +64,6 @@ public final class EncryptTable {
return result;
}
- @SuppressWarnings("rawtypes")
private EncryptColumn createEncryptColumn(final
EncryptColumnRuleConfiguration config, final Map<String,
StandardEncryptAlgorithm> standardEncryptors,
final Map<String,
AssistedEncryptAlgorithm> assistedEncryptors, final Map<String,
LikeEncryptAlgorithm> likeEncryptors) {
EncryptColumn result = new EncryptColumn(config.getName(), new
CipherColumnItem(config.getCipher().getName(),
standardEncryptors.get(config.getCipher().getEncryptorName())));
@@ -83,8 +82,8 @@ public final class EncryptTable {
* @param logicColumnName logic column name
* @return found encryptor
*/
- public Optional<StandardEncryptAlgorithm<?, ?>> findEncryptor(final String
logicColumnName) {
- return columns.containsKey(logicColumnName) ?
Optional.of((StandardEncryptAlgorithm<?, ?>)
columns.get(logicColumnName).getCipher().getEncryptor()) : Optional.empty();
+ public Optional<StandardEncryptAlgorithm> findEncryptor(final String
logicColumnName) {
+ return columns.containsKey(logicColumnName) ?
Optional.of(columns.get(logicColumnName).getCipher().getEncryptor()) :
Optional.empty();
}
/**
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/AssistedQueryColumnItem.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/AssistedQueryColumnItem.java
index 4270fa69abb..9c69ed86c5d 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/AssistedQueryColumnItem.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/AssistedQueryColumnItem.java
@@ -36,7 +36,6 @@ public final class AssistedQueryColumnItem {
private final String name;
@Getter
- @SuppressWarnings("rawtypes")
private final AssistedEncryptAlgorithm encryptor;
/**
@@ -49,7 +48,6 @@ public final class AssistedQueryColumnItem {
* @param originalValue original value
* @return assisted query values
*/
- @SuppressWarnings("unchecked")
public Object encrypt(final String databaseName, final String schemaName,
final String tableName, final String logicColumnName, final Object
originalValue) {
if (null == originalValue) {
return null;
@@ -68,7 +66,6 @@ public final class AssistedQueryColumnItem {
* @param originalValues original values
* @return assisted query values
*/
- @SuppressWarnings("unchecked")
public List<Object> encrypt(final String databaseName, final String
schemaName, final String tableName, final String logicColumnName, final
List<Object> originalValues) {
EncryptContext context = EncryptContextBuilder.build(databaseName,
schemaName, tableName, logicColumnName);
List<Object> result = new LinkedList<>();
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/CipherColumnItem.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/CipherColumnItem.java
index fd2bc7ba9a2..16a799e4062 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/CipherColumnItem.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/CipherColumnItem.java
@@ -35,7 +35,6 @@ public final class CipherColumnItem {
private final String name;
- @SuppressWarnings("rawtypes")
private final StandardEncryptAlgorithm encryptor;
/**
@@ -48,7 +47,6 @@ public final class CipherColumnItem {
* @param originalValue original value
* @return encrypted value
*/
- @SuppressWarnings("unchecked")
public Object encrypt(final String databaseName, final String schemaName,
final String tableName, final String logicColumnName, final Object
originalValue) {
if (null == originalValue) {
return null;
@@ -67,7 +65,6 @@ public final class CipherColumnItem {
* @param originalValues original values
* @return encrypted values
*/
- @SuppressWarnings("unchecked")
public List<Object> encrypt(final String databaseName, final String
schemaName, final String tableName, final String logicColumnName, final
List<Object> originalValues) {
EncryptContext context = EncryptContextBuilder.build(databaseName,
schemaName, tableName, logicColumnName);
List<Object> result = new LinkedList<>();
@@ -87,7 +84,6 @@ public final class CipherColumnItem {
* @param cipherValue cipher value
* @return decrypted value
*/
- @SuppressWarnings("unchecked")
public Object decrypt(final String databaseName, final String schemaName,
final String tableName, final String logicColumnName, final Object cipherValue)
{
if (null == cipherValue) {
return null;
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/LikeQueryColumnItem.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/LikeQueryColumnItem.java
index 5a0ebbf5a67..4003f6853cb 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/LikeQueryColumnItem.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/column/item/LikeQueryColumnItem.java
@@ -35,7 +35,6 @@ public final class LikeQueryColumnItem {
@Getter
private final String name;
- @SuppressWarnings("rawtypes")
private final LikeEncryptAlgorithm encryptor;
/**
@@ -48,7 +47,6 @@ public final class LikeQueryColumnItem {
* @param originalValue original value
* @return like query values
*/
- @SuppressWarnings("unchecked")
public Object encrypt(final String databaseName, final String schemaName,
final String tableName, final String logicColumnName, final Object
originalValue) {
if (null == originalValue) {
return null;
@@ -67,7 +65,6 @@ public final class LikeQueryColumnItem {
* @param originalValues original values
* @return like query values
*/
- @SuppressWarnings("unchecked")
public List<Object> encrypt(final String databaseName, final String
schemaName, final String tableName, final String logicColumnName, final
List<Object> originalValues) {
EncryptContext context = EncryptContextBuilder.build(databaseName,
schemaName, tableName, logicColumnName);
List<Object> result = new LinkedList<>();
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithmTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithmTest.java
index b50a481f6d9..f2c2207a747 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithmTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/assisted/MD5AssistedEncryptAlgorithmTest.java
@@ -33,12 +33,11 @@ import static org.mockito.Mockito.mock;
class MD5AssistedEncryptAlgorithmTest {
- private AssistedEncryptAlgorithm<Object, String> encryptAlgorithm;
+ private AssistedEncryptAlgorithm encryptAlgorithm;
- @SuppressWarnings("unchecked")
@BeforeEach
void setUp() {
- encryptAlgorithm = (AssistedEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class, "MD5");
+ encryptAlgorithm = (AssistedEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class, "MD5");
}
@Test
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithmTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithmTest.java
index cc8bcc49b86..63e3b8f4b09 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithmTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/like/CharDigestLikeEncryptAlgorithmTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.encrypt.algorithm.like;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
@@ -33,18 +33,17 @@ import static org.mockito.Mockito.mock;
class CharDigestLikeEncryptAlgorithmTest {
- private LikeEncryptAlgorithm<Object, String> englishLikeEncryptAlgorithm;
+ private LikeEncryptAlgorithm englishLikeEncryptAlgorithm;
- private LikeEncryptAlgorithm<Object, String> chineseLikeEncryptAlgorithm;
+ private LikeEncryptAlgorithm chineseLikeEncryptAlgorithm;
- private LikeEncryptAlgorithm<Object, String> koreanLikeEncryptAlgorithm;
+ private LikeEncryptAlgorithm koreanLikeEncryptAlgorithm;
- @SuppressWarnings("unchecked")
@BeforeEach
void setUp() {
- englishLikeEncryptAlgorithm = (LikeEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class, "CHAR_DIGEST_LIKE");
- chineseLikeEncryptAlgorithm = (LikeEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class, "CHAR_DIGEST_LIKE");
- koreanLikeEncryptAlgorithm = (LikeEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class,
+ englishLikeEncryptAlgorithm = (LikeEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class, "CHAR_DIGEST_LIKE");
+ chineseLikeEncryptAlgorithm = (LikeEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class, "CHAR_DIGEST_LIKE");
+ koreanLikeEncryptAlgorithm = (LikeEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class,
"CHAR_DIGEST_LIKE", PropertiesBuilder.build(new
Property("dict", "한국어시험"), new Property("start", "44032")));
}
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
index 39b63f86a10..766a877538d 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
@@ -18,10 +18,10 @@
package org.apache.shardingsphere.encrypt.algorithm.standard;
import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import
org.apache.shardingsphere.encrypt.exception.algorithm.EncryptAlgorithmInitializationException;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
@@ -42,12 +42,11 @@ import static org.mockito.Mockito.times;
class AESEncryptAlgorithmTest {
- private StandardEncryptAlgorithm<Object, String> encryptAlgorithm;
+ private StandardEncryptAlgorithm encryptAlgorithm;
- @SuppressWarnings("unchecked")
@BeforeEach
void setUp() {
- encryptAlgorithm = (StandardEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class, "AES",
PropertiesBuilder.build(new Property("aes-key-value", "test")));
+ encryptAlgorithm = (StandardEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class, "AES",
PropertiesBuilder.build(new Property("aes-key-value", "test")));
}
@Test
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithmTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithmTest.java
index 09304e4cb69..a87b3591f29 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithmTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/RC4EncryptAlgorithmTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.encrypt.algorithm.standard;
+import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import
org.apache.shardingsphere.encrypt.exception.algorithm.EncryptAlgorithmInitializationException;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
-import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
@@ -38,12 +38,11 @@ import static org.mockito.Mockito.mock;
class RC4EncryptAlgorithmTest {
- private StandardEncryptAlgorithm<Object, String> encryptAlgorithm;
+ private StandardEncryptAlgorithm encryptAlgorithm;
- @SuppressWarnings("unchecked")
@BeforeEach
void setUp() {
- encryptAlgorithm = (StandardEncryptAlgorithm<Object, String>)
TypedSPILoader.getService(EncryptAlgorithm.class, "RC4",
PropertiesBuilder.build(new Property("rc4-key-value", "test-sharding")));
+ encryptAlgorithm = (StandardEncryptAlgorithm)
TypedSPILoader.getService(EncryptAlgorithm.class, "RC4",
PropertiesBuilder.build(new Property("rc4-key-value", "test-sharding")));
}
@Test
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 dedd55e1164..3e332ac8e0c 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
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.encrypt.fixture;
-import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
-public final class CoreEncryptAlgorithmFixture implements
StandardEncryptAlgorithm<Object, String> {
+public final class CoreEncryptAlgorithmFixture implements
StandardEncryptAlgorithm {
@Override
public String encrypt(final Object plainValue, final EncryptContext
encryptContext) {
@@ -28,7 +28,7 @@ public final class CoreEncryptAlgorithmFixture implements
StandardEncryptAlgorit
}
@Override
- public Object decrypt(final String cipherValue, final EncryptContext
encryptContext) {
+ public Object decrypt(final Object cipherValue, final EncryptContext
encryptContext) {
return "decryptValue";
}
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 e1cb1138e4e..38e2ab8b39a 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,7 +20,7 @@ package org.apache.shardingsphere.encrypt.fixture;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.assisted.AssistedEncryptAlgorithm;
-public final class CoreQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm<Object, String> {
+public final class CoreQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm {
@Override
public String encrypt(final Object plainValue, final EncryptContext
encryptContext) {
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 f9bce86ec61..6fb9e9aa211 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
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.encrypt.fixture;
-import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
-public final class CoreQueryLikeEncryptAlgorithmFixture implements
LikeEncryptAlgorithm<Object, String> {
+public final class CoreQueryLikeEncryptAlgorithmFixture implements
LikeEncryptAlgorithm {
@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 7b88cb7af67..294bd23ef9e 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
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.test.e2e.driver.fixture.encrypt;
-import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
-public final class JDBCEncryptAlgorithmFixture implements
StandardEncryptAlgorithm<Object, String> {
+public final class JDBCEncryptAlgorithmFixture implements
StandardEncryptAlgorithm {
@Override
public String encrypt(final Object plainValue, final EncryptContext
encryptContext) {
@@ -28,7 +28,7 @@ public final class JDBCEncryptAlgorithmFixture implements
StandardEncryptAlgorit
}
@Override
- public Object decrypt(final String cipherValue, final EncryptContext
encryptContext) {
+ public Object decrypt(final Object cipherValue, final EncryptContext
encryptContext) {
return "decryptValue";
}
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 bcfc186e8c5..516fcb9419d 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,7 +20,7 @@ package
org.apache.shardingsphere.test.e2e.driver.fixture.encrypt;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.assisted.AssistedEncryptAlgorithm;
-public final class JDBCQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm<Object, String> {
+public final class JDBCQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm {
@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/RewriteNormalEncryptAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteNormalEncryptAlgorithmFixture.java
index 8c6398531ac..00f04881178 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
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
-import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import
org.apache.shardingsphere.encrypt.api.encrypt.standard.StandardEncryptAlgorithm;
-public final class RewriteNormalEncryptAlgorithmFixture implements
StandardEncryptAlgorithm<Object, String> {
+public final class RewriteNormalEncryptAlgorithmFixture implements
StandardEncryptAlgorithm {
@Override
public String encrypt(final Object plainValue, final EncryptContext
encryptContext) {
@@ -31,11 +31,11 @@ public final class RewriteNormalEncryptAlgorithmFixture
implements StandardEncry
}
@Override
- public Object decrypt(final String cipherValue, final EncryptContext
encryptContext) {
+ public Object decrypt(final Object cipherValue, final EncryptContext
encryptContext) {
if (null == cipherValue) {
return null;
}
- return cipherValue.replaceAll("encrypt_", "");
+ return cipherValue.toString().replaceAll("encrypt_", "");
}
@Override
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 1381a68fe1c..bec30f18926 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,7 +20,7 @@ package
org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
import
org.apache.shardingsphere.encrypt.api.encrypt.assisted.AssistedEncryptAlgorithm;
-public final class RewriteQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm<Object, String> {
+public final class RewriteQueryAssistedEncryptAlgorithmFixture implements
AssistedEncryptAlgorithm {
@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/RewriteQueryLikeEncryptAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteQueryLikeEncryptAlgorithmFixture.java
index 2ab6a4dce13..6ee95b055ea 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
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.test.it.rewrite.fixture.encrypt;
-import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
import org.apache.shardingsphere.encrypt.api.context.EncryptContext;
+import org.apache.shardingsphere.encrypt.api.encrypt.like.LikeEncryptAlgorithm;
-public final class RewriteQueryLikeEncryptAlgorithmFixture implements
LikeEncryptAlgorithm<Object, String> {
+public final class RewriteQueryLikeEncryptAlgorithmFixture implements
LikeEncryptAlgorithm {
@Override
public String encrypt(final Object plainValue, final EncryptContext
encryptContext) {