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 881ef285c22 Refactor fixture of DatabaseDiscoveryType (#17004)
881ef285c22 is described below
commit 881ef285c222d3aa174e9f2ea484668e1e9c63c9
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Apr 22 16:08:07 2022 +0800
Refactor fixture of DatabaseDiscoveryType (#17004)
* Remove useless TestDatabaseDiscoveryType
* Remove useless TestDatabaseDiscoveryType
* Rename CoreFixtureDatabaseDiscoveryType
* Rename DistSQLFixtureDatabaseDiscoveryType
* Fix checkstyle
---
....java => CoreFixtureDatabaseDiscoveryType.java} | 4 +-
.../route/DatabaseDiscoverySQLRouterTest.java | 9 ++--
.../rule/DatabaseDiscoveryRuleTest.java | 4 +-
...hmProvidedDatabaseDiscoveryRuleBuilderTest.java | 4 +-
.../builder/DatabaseDiscoveryRuleBuilderTest.java | 4 +-
...ingsphere.dbdiscovery.spi.DatabaseDiscoveryType | 2 +-
...va => DistSQLFixtureDatabaseDiscoveryType.java} | 4 +-
...rDatabaseDiscoveryTypeStatementUpdaterTest.java | 16 +++----
...eDatabaseDiscoveryTypeStatementUpdaterTest.java | 21 ++++-----
...ingsphere.dbdiscovery.spi.DatabaseDiscoveryType | 2 +-
.../executor/ShowShardingHintStatusExecutor.java | 2 +-
.../distsql/fixture/TestDatabaseDiscoveryType.java | 50 ----------------------
...ingsphere.dbdiscovery.spi.DatabaseDiscoveryType | 18 --------
13 files changed, 37 insertions(+), 103 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/TestDatabaseDiscoveryType.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/CoreFixtureDatabaseDiscoveryType.java
similarity index 93%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/TestDatabaseDiscoveryType.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/CoreFixtureDatabaseDiscoveryType.java
index 7e1a0be196e..eb2cf58e694 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/TestDatabaseDiscoveryType.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/fixture/CoreFixtureDatabaseDiscoveryType.java
@@ -23,7 +23,7 @@ import javax.sql.DataSource;
import java.util.Collection;
import java.util.Map;
-public final class TestDatabaseDiscoveryType implements DatabaseDiscoveryType {
+public final class CoreFixtureDatabaseDiscoveryType implements
DatabaseDiscoveryType {
@Override
public void checkDatabaseDiscoveryConfiguration(final String databaseName,
final Map<String, DataSource> dataSourceMap) {
@@ -44,6 +44,6 @@ public final class TestDatabaseDiscoveryType implements
DatabaseDiscoveryType {
@Override
public String getType() {
- return "TEST";
+ return "CORE.FIXTURE";
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/route/DatabaseDiscoverySQLRouterTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/route/DatabaseDiscoverySQLRouterTest.java
index cf7c962bccc..34634263016 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/route/DatabaseDiscoverySQLRouterTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/route/DatabaseDiscoverySQLRouterTest.java
@@ -73,12 +73,13 @@ public final class DatabaseDiscoverySQLRouterTest {
@Before
public void setUp() {
- DatabaseDiscoveryDataSourceRuleConfiguration dataSourceConfig = new
DatabaseDiscoveryDataSourceRuleConfiguration(DATA_SOURCE_NAME,
Collections.singletonList(PRIMARY_DATA_SOURCE), "", "TEST");
- ShardingSphereAlgorithmConfiguration algorithmConfig = new
ShardingSphereAlgorithmConfiguration("TEST", new Properties());
+ DatabaseDiscoveryDataSourceRuleConfiguration dataSourceConfig = new
DatabaseDiscoveryDataSourceRuleConfiguration(
+ DATA_SOURCE_NAME,
Collections.singletonList(PRIMARY_DATA_SOURCE), "", "CORE.FIXTURE");
+ ShardingSphereAlgorithmConfiguration algorithmConfig = new
ShardingSphereAlgorithmConfiguration("CORE.FIXTURE", new Properties());
DatabaseDiscoveryRuleConfiguration config = new
DatabaseDiscoveryRuleConfiguration(Collections.singleton(dataSourceConfig),
Collections.singletonMap("ha_heartbeat", new
DatabaseDiscoveryHeartBeatConfiguration(new Properties())),
- Collections.singletonMap("TEST", algorithmConfig));
- rule = new DatabaseDiscoveryRule("TEST",
Collections.singletonMap("ds", mock(DataSource.class)), config);
+ Collections.singletonMap("CORE.FIXTURE", algorithmConfig));
+ rule = new DatabaseDiscoveryRule("CORE.FIXTURE",
Collections.singletonMap("ds", mock(DataSource.class)), config);
sqlRouter = (DatabaseDiscoverySQLRouter)
OrderedSPIRegistry.getRegisteredServices(SQLRouter.class,
Collections.singleton(rule)).get(rule);
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRuleTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRuleTest.java
index 81adcbb6541..80b7b44308c 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRuleTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/DatabaseDiscoveryRuleTest.java
@@ -88,9 +88,9 @@ public final class DatabaseDiscoveryRuleTest {
}
private DatabaseDiscoveryRule createRule() {
- DatabaseDiscoveryDataSourceRuleConfiguration config = new
DatabaseDiscoveryDataSourceRuleConfiguration("test_pr", Arrays.asList("ds_0",
"ds_1"), "", "TEST");
+ DatabaseDiscoveryDataSourceRuleConfiguration config = new
DatabaseDiscoveryDataSourceRuleConfiguration("test_pr", Arrays.asList("ds_0",
"ds_1"), "", "CORE.FIXTURE");
return new DatabaseDiscoveryRule("db_discovery", dataSourceMap, new
DatabaseDiscoveryRuleConfiguration(
Collections.singleton(config),
Collections.singletonMap("discovery_heartbeat", new
DatabaseDiscoveryHeartBeatConfiguration(new Properties())),
- ImmutableMap.of("TEST", new
ShardingSphereAlgorithmConfiguration("TEST", new Properties()))));
+ ImmutableMap.of("CORE.FIXTURE", new
ShardingSphereAlgorithmConfiguration("CORE.FIXTURE", new Properties()))));
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
index 36ff5ce2aba..19a2d7dc322 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.dbdiscovery.rule.builder;
import
org.apache.shardingsphere.dbdiscovery.algorithm.config.AlgorithmProvidedDatabaseDiscoveryRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDataSourceRuleConfiguration;
import
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryHeartBeatConfiguration;
-import org.apache.shardingsphere.dbdiscovery.fixture.TestDatabaseDiscoveryType;
+import
org.apache.shardingsphere.dbdiscovery.fixture.CoreFixtureDatabaseDiscoveryType;
import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.rule.builder.schema.SchemaRuleBuilder;
@@ -49,7 +49,7 @@ public final class
AlgorithmProvidedDatabaseDiscoveryRuleBuilderTest {
Collections.singletonList(new
DatabaseDiscoveryDataSourceRuleConfiguration("name",
Collections.singletonList("name"), "", "discoveryTypeName")),
Collections.singletonMap("ha_heartbeat",
new DatabaseDiscoveryHeartBeatConfiguration(new
Properties())),
- Collections.singletonMap("discoveryTypeName", new
TestDatabaseDiscoveryType()));
+ Collections.singletonMap("discoveryTypeName", new
CoreFixtureDatabaseDiscoveryType()));
SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(SchemaRuleBuilder.class,
Collections.singletonList(algorithmProvidedRuleConfig)).get(algorithmProvidedRuleConfig);
assertThat(builder.build(algorithmProvidedRuleConfig, "",
Collections.singletonMap("name", mock(DataSource.class)),
Collections.emptyList(), new ConfigurationProperties(new Properties())),
instanceOf(DatabaseDiscoveryRule.class));
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
index fd91dde6c80..a53953fae1e 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilderTest.java
@@ -46,9 +46,9 @@ public final class DatabaseDiscoveryRuleBuilderTest {
@Test
public void assertBuild() {
DatabaseDiscoveryRuleConfiguration config = new
DatabaseDiscoveryRuleConfiguration(
- Collections.singleton(new
DatabaseDiscoveryDataSourceRuleConfiguration("name",
Collections.singletonList("name"), "", "TEST")),
+ Collections.singleton(new
DatabaseDiscoveryDataSourceRuleConfiguration("name",
Collections.singletonList("name"), "", "CORE.FIXTURE")),
Collections.singletonMap("ha_heartbeat", new
DatabaseDiscoveryHeartBeatConfiguration(new Properties())),
- Collections.singletonMap("TEST", new
ShardingSphereAlgorithmConfiguration("TEST", new Properties())));
+ Collections.singletonMap("CORE.FIXTURE", new
ShardingSphereAlgorithmConfiguration("CORE.FIXTURE", new Properties())));
SchemaRuleBuilder builder =
OrderedSPIRegistry.getRegisteredServices(SchemaRuleBuilder.class,
Collections.singletonList(config)).get(config);
assertThat(builder.build(config, "test_schema",
Collections.singletonMap("name", mock(DataSource.class)),
Collections.emptyList(), new ConfigurationProperties(new Properties())),
instanceOf(DatabaseDiscoveryRule.class));
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
index 9e6ce7a64ff..34a7854d6a1 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.dbdiscovery.fixture.TestDatabaseDiscoveryType
+org.apache.shardingsphere.dbdiscovery.fixture.CoreFixtureDatabaseDiscoveryType
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/FixtureDatabaseDiscoveryType.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/DistSQLFixtureDatabaseDiscov
[...]
similarity index 93%
rename from
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/FixtureDatabaseDiscoveryType.java
rename to
shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/DistSQLFixtureDatabaseDiscoveryType.java
index 17365fa319d..338360b5ecf 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/FixtureDatabaseDiscoveryType.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/fixture/DistSQLFixtureDatabaseDiscoveryType.java
@@ -23,7 +23,7 @@ import javax.sql.DataSource;
import java.util.Collection;
import java.util.Map;
-public final class FixtureDatabaseDiscoveryType implements
DatabaseDiscoveryType {
+public final class DistSQLFixtureDatabaseDiscoveryType implements
DatabaseDiscoveryType {
@Override
public void checkDatabaseDiscoveryConfiguration(final String databaseName,
final Map<String, DataSource> dataSourceMap) {
@@ -44,6 +44,6 @@ public final class FixtureDatabaseDiscoveryType implements
DatabaseDiscoveryType
@Override
public String getType() {
- return "FIXTURE";
+ return "DISTSQL.FIXTURE";
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabas
[...]
index fe4da28473b..03367630130 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/AlterDatabaseDiscoveryTypeStatementUpdaterTest.java
@@ -62,8 +62,8 @@ public final class
AlterDatabaseDiscoveryTypeStatementUpdaterTest {
public void assertCheckSQLStatementWithDuplicate() throws DistSQLException
{
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig =
new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds",
Collections.emptyList(), "ha-heartbeat", "test");
List<DatabaseDiscoveryTypeSegment> databaseDiscoveryTypeSegments =
Arrays.asList(
- new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())),
- new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())));
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())),
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
AlterDatabaseDiscoveryTypeStatement(databaseDiscoveryTypeSegments),
new
DatabaseDiscoveryRuleConfiguration(Collections.singleton(dataSourceRuleConfig),
Collections.emptyMap(), Collections.emptyMap()));
}
@@ -71,10 +71,10 @@ public final class
AlterDatabaseDiscoveryTypeStatementUpdaterTest {
@Test(expected = RequiredRuleMissedException.class)
public void assertCheckSQLStatementWithNotExist() throws DistSQLException {
List<DatabaseDiscoveryTypeSegment> databaseDiscoveryTypeSegments =
- Collections.singletonList(new
DatabaseDiscoveryTypeSegment("discovery_type_1", new
AlgorithmSegment("FIXTURE", new Properties())));
+ Collections.singletonList(new
DatabaseDiscoveryTypeSegment("discovery_type_1", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
AlterDatabaseDiscoveryTypeStatement(databaseDiscoveryTypeSegments),
new
DatabaseDiscoveryRuleConfiguration(Collections.emptyList(),
Collections.emptyMap(),
- Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("FIXTURE", new Properties()))));
+ Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("DISTSQL.FIXTURE", new Properties()))));
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
@@ -82,7 +82,7 @@ public final class
AlterDatabaseDiscoveryTypeStatementUpdaterTest {
Set<DatabaseDiscoveryTypeSegment> discoveryTypeSegments =
Collections.singleton(new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("INVALID_TYPE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
AlterDatabaseDiscoveryTypeStatement(discoveryTypeSegments),
new
DatabaseDiscoveryRuleConfiguration(Collections.emptyList(),
Collections.emptyMap(),
- Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("FIXTURE", new Properties()))));
+ Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("DISTSQL.FIXTURE", new Properties()))));
}
@Test
@@ -90,17 +90,17 @@ public final class
AlterDatabaseDiscoveryTypeStatementUpdaterTest {
Properties currentProperties = new Properties();
currentProperties.put("key", "value");
DatabaseDiscoveryRuleConfiguration currentRuleConfiguration = new
DatabaseDiscoveryRuleConfiguration(Collections.emptyList(),
Collections.emptyMap(),
- Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("FIXTURE", currentProperties)));
+ Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("DISTSQL.FIXTURE", currentProperties)));
Properties properties = new Properties();
properties.put("key", "value_1");
- Set<DatabaseDiscoveryTypeSegment> discoveryTypeSegments =
Collections.singleton(new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", properties)));
+ Set<DatabaseDiscoveryTypeSegment> discoveryTypeSegments =
Collections.singleton(new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", properties)));
updater.checkSQLStatement(shardingSphereMetaData, new
AlterDatabaseDiscoveryTypeStatement(discoveryTypeSegments),
currentRuleConfiguration);
DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfiguration =
(DatabaseDiscoveryRuleConfiguration)
updater.buildToBeAlteredRuleConfiguration(new
AlterDatabaseDiscoveryTypeStatement(discoveryTypeSegments));
DatabaseDiscoveryRuleConfiguration currentConfiguration = new
DatabaseDiscoveryRuleConfiguration(new LinkedList<>(), new LinkedHashMap<>(),
new LinkedHashMap<>());
updater.updateCurrentRuleConfiguration(currentConfiguration,
databaseDiscoveryRuleConfiguration);
assertThat(currentConfiguration.getDiscoveryTypes().size(), is(1));
-
assertThat(currentConfiguration.getDiscoveryTypes().get("discovery_type").getType(),
is("FIXTURE"));
+
assertThat(currentConfiguration.getDiscoveryTypes().get("discovery_type").getType(),
is("DISTSQL.FIXTURE"));
assertThat(currentConfiguration.getDiscoveryTypes().get("discovery_type").getProps().get("key"),
is("value_1"));
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdaterTest.java
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatab
[...]
index a7fd93aff3e..37542ca5750 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdaterTest.java
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/CreateDatabaseDiscoveryTypeStatementUpdaterTest.java
@@ -60,8 +60,8 @@ public final class
CreateDatabaseDiscoveryTypeStatementUpdaterTest {
public void assertCheckSQLStatementWithDuplicate() throws DistSQLException
{
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig =
new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds",
Collections.emptyList(), "ha-heartbeat", "test");
Collection<DatabaseDiscoveryTypeSegment> databaseDiscoveryTypeSegments
= Arrays.asList(
- new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())),
- new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())));
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())),
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
CreateDatabaseDiscoveryTypeStatement(databaseDiscoveryTypeSegments),
new
DatabaseDiscoveryRuleConfiguration(Collections.singleton(dataSourceRuleConfig),
Collections.emptyMap(), Collections.emptyMap()));
}
@@ -70,10 +70,10 @@ public final class
CreateDatabaseDiscoveryTypeStatementUpdaterTest {
public void assertCheckSQLStatementWithExist() throws DistSQLException {
DatabaseDiscoveryDataSourceRuleConfiguration dataSourceRuleConfig =
new DatabaseDiscoveryDataSourceRuleConfiguration("readwrite_ds",
Collections.emptyList(), "ha-heartbeat", "test");
Collection<DatabaseDiscoveryTypeSegment> databaseDiscoveryTypeSegments
= Collections.singletonList(
- new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())));
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
CreateDatabaseDiscoveryTypeStatement(databaseDiscoveryTypeSegments),
new
DatabaseDiscoveryRuleConfiguration(Collections.singleton(dataSourceRuleConfig),
Collections.emptyMap(),
- Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("FIXTURE", new Properties()))));
+ Collections.singletonMap("discovery_type", new
ShardingSphereAlgorithmConfiguration("DISTSQL.FIXTURE", new Properties()))));
}
@Test(expected = InvalidAlgorithmConfigurationException.class)
@@ -85,13 +85,14 @@ public final class
CreateDatabaseDiscoveryTypeStatementUpdaterTest {
@Test
public void assertBuildAndUpdate() throws DistSQLException {
- Collection<DatabaseDiscoveryTypeSegment> discoveryTypeSegments =
Collections.singleton(new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("FIXTURE", new Properties())));
+ Collection<DatabaseDiscoveryTypeSegment> discoveryTypeSegments =
Collections.singleton(
+ new DatabaseDiscoveryTypeSegment("discovery_type", new
AlgorithmSegment("DISTSQL.FIXTURE", new Properties())));
updater.checkSQLStatement(shardingSphereMetaData, new
CreateDatabaseDiscoveryTypeStatement(discoveryTypeSegments), null);
- DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfiguration =
+ DatabaseDiscoveryRuleConfiguration databaseDiscoveryRuleConfig =
(DatabaseDiscoveryRuleConfiguration)
updater.buildToBeCreatedRuleConfiguration(new
CreateDatabaseDiscoveryTypeStatement(discoveryTypeSegments));
- DatabaseDiscoveryRuleConfiguration currentConfiguration = new
DatabaseDiscoveryRuleConfiguration(new LinkedList<>(), new LinkedHashMap<>(),
new LinkedHashMap<>());
- updater.updateCurrentRuleConfiguration(currentConfiguration,
databaseDiscoveryRuleConfiguration);
- assertThat(currentConfiguration.getDiscoveryTypes().size(), is(1));
-
assertThat(currentConfiguration.getDiscoveryTypes().get("discovery_type").getType(),
is("FIXTURE"));
+ DatabaseDiscoveryRuleConfiguration currentConfig = new
DatabaseDiscoveryRuleConfiguration(new LinkedList<>(), new LinkedHashMap<>(),
new LinkedHashMap<>());
+ updater.updateCurrentRuleConfiguration(currentConfig,
databaseDiscoveryRuleConfig);
+ assertThat(currentConfig.getDiscoveryTypes().size(), is(1));
+
assertThat(currentConfig.getDiscoveryTypes().get("discovery_type").getType(),
is("DISTSQL.FIXTURE"));
}
}
diff --git
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
index f88d942ed6e..16298aebe92 100644
---
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
+++
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.dbdiscovery.distsql.handler.fixture.FixtureDatabaseDiscoveryType
+org.apache.shardingsphere.dbdiscovery.distsql.handler.fixture.DistSQLFixtureDatabaseDiscoveryType
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/hint/executor/ShowShardingHintStatusExecutor.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/hint/executor/ShowShardingHintStatusExecutor.java
index e816317016c..db31f6f2dea 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/hint/executor/ShowShardingHintStatusExecutor.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/hint/executor/ShowShardingHintStatusExecutor.java
@@ -66,7 +66,7 @@ public final class ShowShardingHintStatusExecutor extends
AbstractHintQueryExecu
if (!metaData.isComplete()) {
throw new RuleNotExistedException();
}
- String schemaName = connectionSession.getDatabaseType() instanceof
PostgreSQLDatabaseType
+ String schemaName = connectionSession.getDatabaseType() instanceof
PostgreSQLDatabaseType
|| connectionSession.getDatabaseType() instanceof
OpenGaussDatabaseType ? "public" : connectionSession.getDatabaseName();
Collection<String> tableNames =
metaData.getSchemaByName(schemaName).getAllTableNames();
for (String each : tableNames) {
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/TestDatabaseDiscoveryType.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/TestDatabaseDiscoveryType.java
deleted file mode 100644
index dc33d5a2226..00000000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/TestDatabaseDiscoveryType.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.backend.text.distsql.fixture;
-
-import org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType;
-
-import javax.sql.DataSource;
-import java.util.Collection;
-import java.util.Map;
-
-public final class TestDatabaseDiscoveryType implements DatabaseDiscoveryType {
-
- @Override
- public void checkDatabaseDiscoveryConfiguration(final String databaseName,
final Map<String, DataSource> dataSourceMap) {
- }
-
- @Override
- public void updatePrimaryDataSource(final String databaseName, final
Map<String, DataSource> dataSourceMap,
- final Collection<String>
disabledDataSourceNames, final String groupName) {
- }
-
- @Override
- public void updateMemberState(final String databaseName, final Map<String,
DataSource> dataSourceMap, final String groupName) {
- }
-
- @Override
- public String getPrimaryDataSource() {
- return null;
- }
-
- @Override
- public String getType() {
- return "TEST";
- }
-}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
deleted file mode 100644
index 84576e1fd41..00000000000
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.dbdiscovery.spi.DatabaseDiscoveryType
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.proxy.backend.text.distsql.fixture.TestDatabaseDiscoveryType