You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/05/27 11:55:28 UTC
[shardingsphere] branch master updated: Fix EncryptTableRuleConfigurationYamlSwapper swapToYamlConfiguration loss of the name (#18000)
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 295a7f98a6a Fix EncryptTableRuleConfigurationYamlSwapper swapToYamlConfiguration loss of the name (#18000)
295a7f98a6a is described below
commit 295a7f98a6ad6ecd2bd9c0c3be3b4af73de5c2d4
Author: zhaoguhong <zh...@163.com>
AuthorDate: Fri May 27 19:55:21 2022 +0800
Fix EncryptTableRuleConfigurationYamlSwapper swapToYamlConfiguration loss of the name (#18000)
---
.../yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapper.java | 1 +
.../swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapper.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapper.java
index 80fe439af4a..c223034f7ea 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapper.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapper.java
@@ -40,6 +40,7 @@ public final class EncryptTableRuleConfigurationYamlSwapper implements YamlConfi
for (EncryptColumnRuleConfiguration each : data.getColumns()) {
result.getColumns().put(each.getLogicColumn(), columnYamlSwapper.swapToYamlConfiguration(each));
}
+ result.setName(data.getName());
result.setQueryWithCipherColumn(data.getQueryWithCipherColumn());
return result;
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
index 62adebab4da..d14fe1fd5ad 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
@@ -31,6 +31,7 @@ import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public final class EncryptTableRuleConfigurationYamlSwapperTest {
@@ -42,8 +43,10 @@ public final class EncryptTableRuleConfigurationYamlSwapperTest {
new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "test_encryptor_1", null),
new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "test_encryptor_2", null),
new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "test_encryptor_3", null));
- EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigs, null);
+ EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigs, true);
YamlEncryptTableRuleConfiguration actualYamlEncryptTableRuleConfig = tableRuleConfigYamlSwapper.swapToYamlConfiguration(encryptTableRuleConfig);
+ assertThat(actualYamlEncryptTableRuleConfig.getName(), is("test_table"));
+ assertTrue(actualYamlEncryptTableRuleConfig.getQueryWithCipherColumn());
Map<String, YamlEncryptColumnRuleConfiguration> actualColumns = actualYamlEncryptTableRuleConfig.getColumns();
assertThat(actualColumns.size(), is(3));
YamlEncryptColumnRuleConfiguration actualYamlEncryptColumnRuleConfigFirst = actualColumns.get("encrypt_column_1");