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 2022/01/27 01:14:28 UTC
[shardingsphere] branch master updated: Move createEncryptConditions logic to EncryptSQLRewriteContextDecorator (#15096)
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 2fc131a Move createEncryptConditions logic to EncryptSQLRewriteContextDecorator (#15096)
2fc131a is described below
commit 2fc131a8ad98d609d07a4015a8d6b7ca7ea7a7dd
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Thu Jan 27 09:13:24 2022 +0800
Move createEncryptConditions logic to EncryptSQLRewriteContextDecorator (#15096)
---
.../rewrite/aware/EncryptConditionsAware.java | 35 ++++++++++++++++++++++
.../context/EncryptSQLRewriteContextDecorator.java | 19 ++++++++++--
.../parameter/EncryptParameterRewriterBuilder.java | 7 +++++
.../impl/EncryptPredicateParameterRewriter.java | 21 +++++--------
.../rewrite/token/EncryptTokenGenerateBuilder.java | 17 ++++++-----
.../EncryptPredicateRightValueTokenGenerator.java | 17 ++++-------
.../EncryptParameterRewriterBuilderTest.java | 4 +--
.../token/EncryptTokenGenerateBuilderTest.java | 2 +-
8 files changed, 83 insertions(+), 39 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/aware/EncryptConditionsAware.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/aware/EncryptConditionsAware.java
new file mode 100644
index 0000000..71a4b3a
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/aware/EncryptConditionsAware.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.encrypt.rewrite.aware;
+
+import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
+
+import java.util.Collection;
+
+/**
+ * Encrypt conditions aware.
+ */
+public interface EncryptConditionsAware {
+
+ /**
+ * Set encrypt conditions.
+ *
+ * @param encryptConditions encrypt conditions
+ */
+ void setEncryptConditions(Collection<EncryptCondition> encryptConditions);
+}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/context/EncryptSQLRewriteContextDecorator.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/context/EncryptSQLRewriteContextDecorator.java
index 0cbbbb4..6cd4939 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/context/EncryptSQLRewriteContextDecorator.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/context/EncryptSQLRewriteContextDecorator.java
@@ -18,16 +18,22 @@
package org.apache.shardingsphere.encrypt.rewrite.context;
import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
+import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
+import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine;
import org.apache.shardingsphere.encrypt.rewrite.parameter.EncryptParameterRewriterBuilder;
import org.apache.shardingsphere.encrypt.rewrite.token.EncryptTokenGenerateBuilder;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
+import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
+import org.apache.shardingsphere.infra.binder.type.WhereAvailable;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContext;
import org.apache.shardingsphere.infra.rewrite.context.SQLRewriteContextDecorator;
import org.apache.shardingsphere.infra.rewrite.parameter.rewriter.ParameterRewriter;
import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.predicate.WhereSegment;
import java.util.Collection;
+import java.util.Collections;
/**
* SQL rewrite context decorator for encrypt.
@@ -37,13 +43,20 @@ public final class EncryptSQLRewriteContextDecorator implements SQLRewriteContex
@SuppressWarnings("rawtypes")
@Override
public void decorate(final EncryptRule encryptRule, final ConfigurationProperties props, final SQLRewriteContext sqlRewriteContext, final RouteContext routeContext) {
+ Collection<EncryptCondition> encryptConditions = getEncryptConditions(encryptRule, sqlRewriteContext);
if (!sqlRewriteContext.getParameters().isEmpty()) {
- Collection<ParameterRewriter> parameterRewriters = new EncryptParameterRewriterBuilder(encryptRule,
- sqlRewriteContext.getSchema(), sqlRewriteContext.getSqlStatementContext()).getParameterRewriters();
+ Collection<ParameterRewriter> parameterRewriters = new EncryptParameterRewriterBuilder(
+ encryptRule, sqlRewriteContext.getSchema(), sqlRewriteContext.getSqlStatementContext(), encryptConditions).getParameterRewriters();
rewriteParameters(sqlRewriteContext, parameterRewriters);
}
encryptRule.setUpEncryptorSchema(sqlRewriteContext.getSchema());
- sqlRewriteContext.addSQLTokenGenerators(new EncryptTokenGenerateBuilder(encryptRule, sqlRewriteContext.getSqlStatementContext()).getSQLTokenGenerators());
+ sqlRewriteContext.addSQLTokenGenerators(new EncryptTokenGenerateBuilder(encryptRule, sqlRewriteContext.getSqlStatementContext(), encryptConditions).getSQLTokenGenerators());
+ }
+
+ private Collection<EncryptCondition> getEncryptConditions(final EncryptRule encryptRule, final SQLRewriteContext sqlRewriteContext) {
+ SQLStatementContext<?> sqlStatementContext = sqlRewriteContext.getSqlStatementContext();
+ Collection<WhereSegment> whereSegments = sqlStatementContext instanceof WhereAvailable ? ((WhereAvailable) sqlStatementContext).getWhereSegments() : Collections.emptyList();
+ return whereSegments.isEmpty() ? Collections.emptyList() : new EncryptConditionEngine(encryptRule, sqlRewriteContext.getSchema()).createEncryptConditions(sqlStatementContext);
}
@SuppressWarnings({"rawtypes", "unchecked"})
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilder.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilder.java
index 62e205b..c5bb810 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilder.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilder.java
@@ -18,7 +18,9 @@
package org.apache.shardingsphere.encrypt.rewrite.parameter;
import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware;
import org.apache.shardingsphere.encrypt.rewrite.aware.QueryWithCipherColumnAware;
+import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
import org.apache.shardingsphere.encrypt.rewrite.parameter.impl.EncryptAssignmentParameterRewriter;
import org.apache.shardingsphere.encrypt.rewrite.parameter.impl.EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter;
import org.apache.shardingsphere.encrypt.rewrite.parameter.impl.EncryptInsertValueParameterRewriter;
@@ -47,6 +49,8 @@ public final class EncryptParameterRewriterBuilder implements ParameterRewriterB
private final SQLStatementContext<?> sqlStatementContext;
+ private final Collection<EncryptCondition> encryptConditions;
+
@SuppressWarnings("rawtypes")
@Override
public Collection<ParameterRewriter> getParameterRewriters() {
@@ -82,6 +86,9 @@ public final class EncryptParameterRewriterBuilder implements ParameterRewriterB
if (toBeAddedParameterRewriter instanceof QueryWithCipherColumnAware) {
((QueryWithCipherColumnAware) toBeAddedParameterRewriter).setQueryWithCipherColumn(encryptRule.isQueryWithCipherColumn());
}
+ if (toBeAddedParameterRewriter instanceof EncryptConditionsAware) {
+ ((EncryptConditionsAware) toBeAddedParameterRewriter).setEncryptConditions(encryptConditions);
+ }
if (toBeAddedParameterRewriter.isNeedRewrite(sqlStatementContext)) {
parameterRewriters.add(toBeAddedParameterRewriter);
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptPredicateParameterRewriter.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptPredicateParameterRewriter.java
index 8e9bda2..3038dc7 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptPredicateParameterRewriter.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptPredicateParameterRewriter.java
@@ -18,18 +18,17 @@
package org.apache.shardingsphere.encrypt.rewrite.parameter.impl;
import lombok.Setter;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware;
import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
-import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.aware.EncryptRuleAware;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.statement.dml.util.DMLStatementContextHelper;
+import org.apache.shardingsphere.infra.binder.type.WhereAvailable;
import org.apache.shardingsphere.infra.exception.ShardingSphereException;
-import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.rewrite.parameter.builder.ParameterBuilder;
import org.apache.shardingsphere.infra.rewrite.parameter.builder.impl.StandardParameterBuilder;
import org.apache.shardingsphere.infra.rewrite.parameter.rewriter.ParameterRewriter;
-import org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.SchemaMetaDataAware;
import java.util.Collection;
import java.util.List;
@@ -40,23 +39,19 @@ import java.util.Map.Entry;
* Predicate parameter rewriter for encrypt.
*/
@Setter
-public final class EncryptPredicateParameterRewriter implements ParameterRewriter<SQLStatementContext>, SchemaMetaDataAware, EncryptRuleAware {
-
- private ShardingSphereSchema schema;
+public final class EncryptPredicateParameterRewriter implements ParameterRewriter<SQLStatementContext>, EncryptRuleAware, EncryptConditionsAware {
private EncryptRule encryptRule;
+ private Collection<EncryptCondition> encryptConditions;
+
@Override
public boolean isNeedRewrite(final SQLStatementContext sqlStatementContext) {
- return true;
+ return sqlStatementContext instanceof WhereAvailable && !((WhereAvailable) sqlStatementContext).getWhereSegments().isEmpty();
}
@Override
public void rewrite(final ParameterBuilder parameterBuilder, final SQLStatementContext sqlStatementContext, final List<Object> parameters) {
- Collection<EncryptCondition> encryptConditions = new EncryptConditionEngine(encryptRule, schema).createEncryptConditions(sqlStatementContext);
- if (encryptConditions.isEmpty()) {
- return;
- }
String schemaName = DMLStatementContextHelper.getSchemaName(sqlStatementContext);
for (EncryptCondition each : encryptConditions) {
boolean queryWithCipherColumn = encryptRule.isQueryWithCipherColumn(each.getTableName());
@@ -77,11 +72,11 @@ public final class EncryptPredicateParameterRewriter implements ParameterRewrite
}
private void checkSortable(final EncryptCondition encryptCondition, final List<Object> values) {
- values.stream().forEach(each -> {
+ for (Object each : values) {
if (encryptCondition.isSortable() && !(each instanceof Number)) {
throw new ShardingSphereException("The SQL clause is unsupported in encrypt rule as not sortable encrypted values.");
}
- });
+ }
}
private void encryptParameters(final ParameterBuilder parameterBuilder, final Map<Integer, Integer> positionIndexes, final List<Object> encryptValues) {
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java
index 5907046..5009550 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilder.java
@@ -17,7 +17,10 @@
package org.apache.shardingsphere.encrypt.rewrite.token;
+import lombok.RequiredArgsConstructor;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware;
import org.apache.shardingsphere.encrypt.rewrite.aware.QueryWithCipherColumnAware;
+import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.impl.AssistQueryAndPlainInsertColumnsTokenGenerator;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.impl.EncryptAlterTableTokenGenerator;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.impl.EncryptAssignmentTokenGenerator;
@@ -42,19 +45,14 @@ import java.util.LinkedList;
/**
* SQL token generator builder for encrypt.
*/
+@RequiredArgsConstructor
public final class EncryptTokenGenerateBuilder implements SQLTokenGeneratorBuilder {
private final EncryptRule encryptRule;
- private final boolean queryWithCipherColumn;
-
private final SQLStatementContext<?> sqlStatementContext;
- public EncryptTokenGenerateBuilder(final EncryptRule encryptRule, final SQLStatementContext<?> sqlStatementContext) {
- this.encryptRule = encryptRule;
- this.queryWithCipherColumn = encryptRule.isQueryWithCipherColumn();
- this.sqlStatementContext = sqlStatementContext;
- }
+ private final Collection<EncryptCondition> encryptConditions;
@Override
public Collection<SQLTokenGenerator> getSQLTokenGenerators() {
@@ -79,7 +77,10 @@ public final class EncryptTokenGenerateBuilder implements SQLTokenGeneratorBuild
((EncryptRuleAware) toBeAddedSQLTokenGenerator).setEncryptRule(encryptRule);
}
if (toBeAddedSQLTokenGenerator instanceof QueryWithCipherColumnAware) {
- ((QueryWithCipherColumnAware) toBeAddedSQLTokenGenerator).setQueryWithCipherColumn(queryWithCipherColumn);
+ ((QueryWithCipherColumnAware) toBeAddedSQLTokenGenerator).setQueryWithCipherColumn(encryptRule.isQueryWithCipherColumn());
+ }
+ if (toBeAddedSQLTokenGenerator instanceof EncryptConditionsAware) {
+ ((EncryptConditionsAware) toBeAddedSQLTokenGenerator).setEncryptConditions(encryptConditions);
}
if (toBeAddedSQLTokenGenerator.isGenerateSQLToken(sqlStatementContext)) {
sqlTokenGenerators.add(toBeAddedSQLTokenGenerator);
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptPredicateRightValueTokenGenerator.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptPredicateRightValueTokenGenerator.java
index 957224e..e4aa83c 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptPredicateRightValueTokenGenerator.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/impl/EncryptPredicateRightValueTokenGenerator.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.encrypt.rewrite.token.generator.impl;
import lombok.Setter;
+import org.apache.shardingsphere.encrypt.rewrite.aware.EncryptConditionsAware;
import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptCondition;
-import org.apache.shardingsphere.encrypt.rewrite.condition.EncryptConditionEngine;
import org.apache.shardingsphere.encrypt.rewrite.condition.impl.EncryptInCondition;
import org.apache.shardingsphere.encrypt.rewrite.token.generator.BaseEncryptSQLTokenGenerator;
import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptPredicateEqualRightValueToken;
@@ -27,14 +27,11 @@ import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptPredicateInRi
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.statement.dml.util.DMLStatementContextHelper;
import org.apache.shardingsphere.infra.binder.type.WhereAvailable;
-import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
import org.apache.shardingsphere.infra.rewrite.sql.token.generator.CollectionSQLTokenGenerator;
import org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.ParametersAware;
-import org.apache.shardingsphere.infra.rewrite.sql.token.generator.aware.SchemaMetaDataAware;
import org.apache.shardingsphere.infra.rewrite.sql.token.pojo.SQLToken;
import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@@ -45,12 +42,12 @@ import java.util.Optional;
* Predicate right value token generator for encrypt.
*/
@Setter
-public final class EncryptPredicateRightValueTokenGenerator extends BaseEncryptSQLTokenGenerator implements CollectionSQLTokenGenerator, SchemaMetaDataAware, ParametersAware {
-
- private ShardingSphereSchema schema;
+public final class EncryptPredicateRightValueTokenGenerator extends BaseEncryptSQLTokenGenerator implements CollectionSQLTokenGenerator, ParametersAware, EncryptConditionsAware {
private List<Object> parameters;
+ private Collection<EncryptCondition> encryptConditions;
+
@Override
protected boolean isGenerateSQLTokenForEncrypt(final SQLStatementContext sqlStatementContext) {
return sqlStatementContext instanceof WhereAvailable && !((WhereAvailable) sqlStatementContext).getWhereSegments().isEmpty();
@@ -58,11 +55,7 @@ public final class EncryptPredicateRightValueTokenGenerator extends BaseEncryptS
@Override
public Collection<SQLToken> generateSQLTokens(final SQLStatementContext sqlStatementContext) {
- Collection<EncryptCondition> encryptConditions = new EncryptConditionEngine(getEncryptRule(), schema).createEncryptConditions(sqlStatementContext);
- return encryptConditions.isEmpty() ? Collections.emptyList() : generateSQLTokens(DMLStatementContextHelper.getSchemaName(sqlStatementContext), encryptConditions);
- }
-
- private Collection<SQLToken> generateSQLTokens(final String schemaName, final Collection<EncryptCondition> encryptConditions) {
+ String schemaName = DMLStatementContextHelper.getSchemaName(sqlStatementContext);
Collection<SQLToken> result = new LinkedHashSet<>();
for (EncryptCondition each : encryptConditions) {
result.add(generateSQLToken(schemaName, each));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilderTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilderTest.java
index 0c0c039..db40bcd 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilderTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameter/EncryptParameterRewriterBuilderTest.java
@@ -46,7 +46,7 @@ public final class EncryptParameterRewriterBuilderTest {
ShardingSphereSchema shardingSphereSchema = mock(ShardingSphereSchema.class);
SQLStatementContext<?> sqlStatementContext = mock(SelectStatementContext.class, RETURNS_DEEP_STUBS);
when(sqlStatementContext.getTablesContext().getTableNames()).thenReturn(Collections.singletonList("t_order"));
- Collection<ParameterRewriter> actual = new EncryptParameterRewriterBuilder(encryptRule, shardingSphereSchema, sqlStatementContext).getParameterRewriters();
+ Collection<ParameterRewriter> actual = new EncryptParameterRewriterBuilder(encryptRule, shardingSphereSchema, sqlStatementContext, Collections.emptyList()).getParameterRewriters();
assertThat(actual.size(), is(1));
ParameterRewriter parameterRewriter = actual.iterator().next();
assertThat(parameterRewriter, instanceOf(EncryptPredicateParameterRewriter.class));
@@ -60,7 +60,7 @@ public final class EncryptParameterRewriterBuilderTest {
ShardingSphereSchema shardingSphereSchema = mock(ShardingSphereSchema.class);
SQLStatementContext<?> sqlStatementContext = mock(SelectStatementContext.class, RETURNS_DEEP_STUBS);
when(sqlStatementContext.getTablesContext().getTableNames()).thenReturn(Collections.singletonList("t_order"));
- Collection<ParameterRewriter> actual = new EncryptParameterRewriterBuilder(encryptRule, shardingSphereSchema, sqlStatementContext).getParameterRewriters();
+ Collection<ParameterRewriter> actual = new EncryptParameterRewriterBuilder(encryptRule, shardingSphereSchema, sqlStatementContext, Collections.emptyList()).getParameterRewriters();
assertThat(actual.size(), is(0));
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilderTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilderTest.java
index e8bb237..00a6861 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilderTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/EncryptTokenGenerateBuilderTest.java
@@ -67,7 +67,7 @@ public final class EncryptTokenGenerateBuilderTest {
when(selectStatementContext.getGroupByContext().getItems()).thenReturn(Collections.emptyList());
when(selectStatementContext.isContainsJoinQuery()).thenReturn(true);
when(selectStatementContext.getWhereSegments()).thenReturn(Collections.emptyList());
- EncryptTokenGenerateBuilder encryptTokenGenerateBuilder = new EncryptTokenGenerateBuilder(encryptRule, selectStatementContext);
+ EncryptTokenGenerateBuilder encryptTokenGenerateBuilder = new EncryptTokenGenerateBuilder(encryptRule, selectStatementContext, Collections.emptyList());
Collection<SQLTokenGenerator> sqlTokenGenerators = encryptTokenGenerateBuilder.getSQLTokenGenerators();
assertThat(sqlTokenGenerators.size(), is(3));
Iterator<SQLTokenGenerator> iterator = sqlTokenGenerators.iterator();