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 2023/08/16 04:06:07 UTC
[shardingsphere] branch master updated: Refactor DistSQLBackendHandlerFactoryTest (#28109)
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 0f8ab4f0d9b Refactor DistSQLBackendHandlerFactoryTest (#28109)
0f8ab4f0d9b is described below
commit 0f8ab4f0d9bf902cc0e1f124e51c5979c28be7d2
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Aug 16 12:06:01 2023 +0800
Refactor DistSQLBackendHandlerFactoryTest (#28109)
---
.../distsql/DistSQLBackendHandlerFactoryTest.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
index af78f4b0324..fc46f8faef0 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactoryTest.java
@@ -135,25 +135,25 @@ class DistSQLBackendHandlerFactoryTest {
@Test
void assertExecuteAlterShadowRuleContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RDLBackendHandlerFactory.newInstance(mock(AlterShadowRuleStatement.class), connectionSession).execute(), instanceOf(UpdateResponseHeader.class));
}
@Test
void assertExecuteCreateShadowRuleContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RDLBackendHandlerFactory.newInstance(mock(CreateShadowRuleStatement.class), connectionSession).execute(), instanceOf(UpdateResponseHeader.class));
}
@Test
void assertExecuteDropShadowRuleContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RDLBackendHandlerFactory.newInstance(mock(DropShadowRuleStatement.class), connectionSession).execute(), instanceOf(UpdateResponseHeader.class));
}
@Test
void assertExecuteAlterDefaultShadowAlgorithm() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
AlterDefaultShadowAlgorithmStatement statement = new AlterDefaultShadowAlgorithmStatement(
new ShadowAlgorithmSegment("foo", new AlgorithmSegment("SQL_HINT", PropertiesBuilder.build(new Property("type", "value")))));
assertThat(RDLBackendHandlerFactory.newInstance(statement, connectionSession).execute(), instanceOf(UpdateResponseHeader.class));
@@ -161,25 +161,25 @@ class DistSQLBackendHandlerFactoryTest {
@Test
void assertExecuteShowShadowRulesContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RQLBackendHandlerFactory.newInstance(mock(ShowShadowRulesStatement.class), connectionSession).execute(), instanceOf(QueryResponseHeader.class));
}
@Test
void assertExecuteShowShadowTableRulesContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RQLBackendHandlerFactory.newInstance(mock(ShowShadowTableRulesStatement.class), connectionSession).execute(), instanceOf(QueryResponseHeader.class));
}
@Test
void assertExecuteShowShadowAlgorithmsContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RQLBackendHandlerFactory.newInstance(mock(ShowShadowAlgorithmsStatement.class), connectionSession).execute(), instanceOf(QueryResponseHeader.class));
}
@Test
void assertExecuteDropShadowAlgorithmContext() throws SQLException {
- mockShardingSphereRuleMetaData();
+ mockRuleMetaData();
assertThat(RDLBackendHandlerFactory.newInstance(mock(DropShadowAlgorithmStatement.class), connectionSession).execute(), instanceOf(UpdateResponseHeader.class));
}
@@ -208,7 +208,7 @@ class DistSQLBackendHandlerFactoryTest {
assertThat(RQLBackendHandlerFactory.newInstance(mock(ShowStorageUnitsStatement.class), connectionSession).execute(), instanceOf(QueryResponseHeader.class));
}
- private void mockShardingSphereRuleMetaData() {
+ private void mockRuleMetaData() {
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getName()).thenReturn("foo_db");
when(database.getResourceMetaData()).thenReturn(mock(ResourceMetaData.class));