You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2023/04/20 01:57:51 UTC
[shardingsphere] branch master updated: Revise pr 25245 for code style (#25248)
This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 c28a72728f0 Revise pr 25245 for code style (#25248)
c28a72728f0 is described below
commit c28a72728f04308354f809ffeb0b87b69801ba96
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Thu Apr 20 09:57:44 2023 +0800
Revise pr 25245 for code style (#25248)
---
.../dml/ShardingLoadDataStatementValidatorTest.java | 21 +++++++++------------
.../dml/ShardingLoadXMLStatementValidatorTest.java | 20 +++++++++-----------
2 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadDataStatementValidatorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadDataStatementValidatorTest.java
index 620d9c011ef..88451151541 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadDataStatementValidatorTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadDataStatementValidatorTest.java
@@ -41,27 +41,24 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class ShardingLoadDataStatementValidatorTest {
-
+
@Mock
private ShardingRule shardingRule;
-
+
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private ShardingSphereDatabase database;
-
+
@Test
- void assertPreValidateWhenTableSegmentForMySQL() {
+ void assertPreValidateLoadDataWithSingleTable() {
MySQLLoadDataStatement sqlStatement = new MySQLLoadDataStatement(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order"))));
new ShardingLoadDataStatementValidator().preValidate(shardingRule, new LoadDataStatementContext(sqlStatement), Collections.emptyList(), database, mock(ConfigurationProperties.class));
}
-
+
@Test
- void assertPreValidateLoadDataWithShardingTableForMySQL() {
+ void assertPreValidateLoadDataWithShardingTable() {
MySQLLoadDataStatement sqlStatement = new MySQLLoadDataStatement(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order"))));
- LoadDataStatementContext sqlStatementContext = new LoadDataStatementContext(sqlStatement);
- String tableName = "t_order";
- when(shardingRule.isShardingTable(tableName)).thenReturn(true);
- assertThrows(UnsupportedShardingOperationException.class,
- () -> new ShardingLoadDataStatementValidator().preValidate(
- shardingRule, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereDatabase.class), mock(ConfigurationProperties.class)));
+ when(shardingRule.isShardingTable("t_order")).thenReturn(true);
+ assertThrows(UnsupportedShardingOperationException.class, () -> new ShardingLoadDataStatementValidator().preValidate(shardingRule, new LoadDataStatementContext(sqlStatement),
+ Collections.emptyList(), mock(ShardingSphereDatabase.class), mock(ConfigurationProperties.class)));
}
}
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadXMLStatementValidatorTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadXMLStatementValidatorTest.java
index eb6443f23b6..ab8f07c3112 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadXMLStatementValidatorTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingLoadXMLStatementValidatorTest.java
@@ -41,26 +41,24 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class ShardingLoadXMLStatementValidatorTest {
+
@Mock
private ShardingRule shardingRule;
-
+
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private ShardingSphereDatabase database;
-
+
@Test
- void assertPreValidateWhenTableSegmentForMySQL() {
+ void assertPreValidateLoadXMLWithSingleTable() {
MySQLLoadXMLStatement sqlStatement = new MySQLLoadXMLStatement(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order"))));
new ShardingLoadXMLStatementValidator().preValidate(shardingRule, new LoadXMLStatementContext(sqlStatement), Collections.emptyList(), database, mock(ConfigurationProperties.class));
}
-
+
@Test
- void assertPreValidateLoadDataWithShardingTableForMySQL() {
+ void assertPreValidateLoadXMLWithShardingTable() {
MySQLLoadXMLStatement sqlStatement = new MySQLLoadXMLStatement(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order"))));
- LoadXMLStatementContext sqlStatementContext = new LoadXMLStatementContext(sqlStatement);
- String tableName = "t_order";
- when(shardingRule.isShardingTable(tableName)).thenReturn(true);
- assertThrows(UnsupportedShardingOperationException.class,
- () -> new ShardingLoadXMLStatementValidator().preValidate(
- shardingRule, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereDatabase.class), mock(ConfigurationProperties.class)));
+ when(shardingRule.isShardingTable("t_order")).thenReturn(true);
+ assertThrows(UnsupportedShardingOperationException.class, () -> new ShardingLoadXMLStatementValidator().preValidate(shardingRule, new LoadXMLStatementContext(sqlStatement),
+ Collections.emptyList(), mock(ShardingSphereDatabase.class), mock(ConfigurationProperties.class)));
}
}