Pace2Car commented on code in PR #24688:
URL: https://github.com/apache/shardingsphere/pull/24688#discussion_r1141827737
##########
features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java:
##########
@@ -76,14 +79,23 @@ public void assertCheckSQLStatementWithIncompleteDataType()
{
@Test
public void assertCreateEncryptRuleWithIfNotExists() {
EncryptRuleConfiguration currentRuleConfig = getCurrentRuleConfig();
- CreateEncryptRuleStatement sqlStatement = createSQLStatement(true,
"AES");
+ CreateEncryptRuleStatement sqlStatement =
createAESEncryptRuleSQLStatement(true);
updater.checkSQLStatement(database, sqlStatement, currentRuleConfig);
EncryptRuleConfiguration toBeCreatedRuleConfig =
updater.buildToBeCreatedRuleConfiguration(currentRuleConfig, sqlStatement);
updater.updateCurrentRuleConfiguration(currentRuleConfig,
toBeCreatedRuleConfig);
assertThat(currentRuleConfig.getTables().size(), is(2));
assertTrue(currentRuleConfig.getEncryptors().isEmpty());
}
+ private CreateEncryptRuleStatement createAESEncryptRuleSQLStatement(final
boolean ifNotExists) {
+ EncryptColumnSegment tEncryptColumnSegment = new
EncryptColumnSegment("user_id", "user_cipher", "user_plain", "assisted_column",
"like_column",
+ new AlgorithmSegment("AES", PropertiesBuilder.build(new
Property("aes-key-value", "abc"))), null, null, null);
+ EncryptRuleSegment tEncryptRuleSegment = new
EncryptRuleSegment("t_encrypt", Collections.singleton(tEncryptColumnSegment),
null);
+ Collection<EncryptRuleSegment> rules = new LinkedList<>();
Review Comment:
It may call `removeIf` when use `ifNotExists`, so it can not be singleton.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]