You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/07/04 14:35:42 UTC
(shardingsphere) branch master updated: Refactor EncryptShowCreateTableMergedResultTest (#35885)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 4078a877666 Refactor EncryptShowCreateTableMergedResultTest (#35885)
4078a877666 is described below
commit 4078a8776669f9147b09c8432e2533c3731ba441
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Jul 4 22:35:36 2025 +0800
Refactor EncryptShowCreateTableMergedResultTest (#35885)
---
.../dal/show/EncryptShowCreateTableMergedResultTest.java | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/EncryptShowCreateTableMergedResultTest.java b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/EncryptShowCreateTableMergedResultTest.java
index f49f84d54fc..4a6a3038904 100644
--- a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/EncryptShowCreateTableMergedResultTest.java
+++ b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/merge/dal/show/EncryptShowCreateTableMergedResultTest.java
@@ -36,9 +36,8 @@ import org.apache.shardingsphere.sql.parser.api.CacheOption;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.SQLStatementAttributes;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.TableInResultSetSQLStatementAttribute;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
+import org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowCreateTableStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -184,12 +183,8 @@ class EncryptShowCreateTableMergedResultTest {
}
private EncryptShowCreateTableMergedResult createMergedResult(final MergedResult mergedResult, final String tableName, final EncryptRule rule) {
- CommonSQLStatementContext sqlStatementContext = mock(CommonSQLStatementContext.class, RETURNS_DEEP_STUBS);
- SQLStatement sqlStatement = mock(SQLStatement.class, RETURNS_DEEP_STUBS);
- when(sqlStatement.getAttributes()).thenReturn(new SQLStatementAttributes(new TableInResultSetSQLStatementAttribute(2)));
- when(sqlStatementContext.getSqlStatement()).thenReturn(sqlStatement);
- when(sqlStatementContext.getTablesContext().getSimpleTables()).thenReturn(Collections.singleton(new SimpleTableSegment(new TableNameSegment(1, 4, new IdentifierValue(tableName)))));
- when(sqlStatementContext.getDatabaseType()).thenReturn(databaseType);
+ SQLStatement sqlStatement = new MySQLShowCreateTableStatement(new SimpleTableSegment(new TableNameSegment(1, 4, new IdentifierValue(tableName))));
+ CommonSQLStatementContext sqlStatementContext = new CommonSQLStatementContext(databaseType, sqlStatement);
RuleMetaData globalRuleMetaData = mock(RuleMetaData.class);
when(globalRuleMetaData.getSingleRule(SQLParserRule.class)).thenReturn(new SQLParserRule(new SQLParserRuleConfiguration(new CacheOption(128, 1024L), new CacheOption(2000, 65535L))));
return new EncryptShowCreateTableMergedResult(globalRuleMetaData, mergedResult, sqlStatementContext, rule);