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/04/11 06:59:14 UTC
(shardingsphere) branch master updated: Refactor ShardingSQLRewriterIT (#35165)
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 2fe7cfd1cdf Refactor ShardingSQLRewriterIT (#35165)
2fe7cfd1cdf is described below
commit 2fe7cfd1cdfb60a19b60422db9876506dffe0aeb
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Apr 11 14:59:08 2025 +0800
Refactor ShardingSQLRewriterIT (#35165)
---
.../rewrite/engine/scenario/ShardingSQLRewriterIT.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/scenario/ShardingSQLRewriterIT.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/scenario/ShardingSQLRewriterIT.java
index 489377801cb..4c1b0644aec 100644
--- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/scenario/ShardingSQLRewriterIT.java
+++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/scenario/ShardingSQLRewriterIT.java
@@ -39,15 +39,6 @@ import java.util.Optional;
@SQLRewriterITSettings("scenario/sharding/case")
class ShardingSQLRewriterIT extends SQLRewriterIT {
- @Override
- protected void mockDatabaseRules(final Collection<ShardingSphereRule> rules, final String schemaName, final SQLStatement sqlStatement) {
- Optional<SingleRule> singleRule = rules.stream().filter(SingleRule.class::isInstance).map(SingleRule.class::cast).findFirst();
- if (singleRule.isPresent() && !(sqlStatement instanceof CreateTableStatement)) {
- singleRule.get().getAttributes().getAttribute(MutableDataNodeRuleAttribute.class).put("db", schemaName, "t_single");
- singleRule.get().getAttributes().getAttribute(MutableDataNodeRuleAttribute.class).put("db", schemaName, "t_single_extend");
- }
- }
-
@Override
protected Collection<ShardingSphereSchema> mockSchemas(final String schemaName) {
Collection<ShardingSphereTable> tables = new LinkedList<>();
@@ -97,4 +88,13 @@ class ShardingSQLRewriterIT extends SQLRewriterIT {
new ShardingSphereColumn("creation_date", Types.DATE, false, false, false, true, false, false)), Collections.emptyList(), Collections.emptyList()));
return Collections.singleton(new ShardingSphereSchema(schemaName, tables, Collections.emptyList()));
}
+
+ @Override
+ protected void mockDatabaseRules(final Collection<ShardingSphereRule> rules, final String schemaName, final SQLStatement sqlStatement) {
+ Optional<SingleRule> singleRule = rules.stream().filter(SingleRule.class::isInstance).map(SingleRule.class::cast).findFirst();
+ if (singleRule.isPresent() && !(sqlStatement instanceof CreateTableStatement)) {
+ singleRule.get().getAttributes().getAttribute(MutableDataNodeRuleAttribute.class).put("db", schemaName, "t_single");
+ singleRule.get().getAttributes().getAttribute(MutableDataNodeRuleAttribute.class).put("db", schemaName, "t_single_extend");
+ }
+ }
}