This is an automated email from the ASF dual-hosted git repository.
panjuan 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 811302d4eb3 Avoid to use postgreSQL for variable names (#28269)
811302d4eb3 is described below
commit 811302d4eb30e5ebbd8059c1a051ca3011d6152f
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 27 14:27:49 2023 +0800
Avoid to use postgreSQL for variable names (#28269)
---
.../broadcast/rule/BroadcastRule.java | 6 +--
.../NewYamlBroadcastRuleConfigurationSwapper.java | 10 ++---
.../query/CountBroadcastRuleExecutorTest.java | 6 +--
.../query/ShowBroadcastTableRuleExecutorTest.java | 6 +--
...eateBroadcastTableRuleStatementUpdaterTest.java | 6 +--
...DropBroadcastTableRuleStatementUpdaterTest.java | 8 ++--
.../AlterEncryptRuleStatementUpdaterTest.java | 6 +--
...SplittingTransactionalDataSourceRouterTest.java | 8 ++--
.../shadow/yaml/ShadowRuleConfigurationYamlIT.java | 22 +++++-----
.../query/ShowShadowTableRulesExecutor.java | 4 +-
.../sharding/cache/ShardingCache.java | 6 +--
.../yaml/ShardingRuleConfigurationYamlIT.java | 8 ++--
...ewYamlShardingRuleConfigurationSwapperTest.java | 10 ++---
.../query/CountShardingRuleExecutorTest.java | 8 ++--
.../ddl/AlterViewStatementContextTest.java | 8 ++--
.../statement/ddl/PrepareStatementContextTest.java | 40 +++++++++---------
.../shardingsphere/infra/hint/SQLHintUtils.java | 47 ++++++++++------------
.../resource/storage/StorageNodeProperties.java | 4 +-
.../resource/storage/StorageResourceCreator.java | 6 +--
.../refresher/util/TableRefreshUtils.java | 6 +--
.../yaml/YamlShardingSphereDataSourceFactory.java | 36 ++++++++---------
...rdingSpherePipelineDataSourceConfiguration.java | 6 +--
.../StandardPipelineDataSourceConfiguration.java | 6 +--
.../ddlgenerator/PostgreSQLIndexSQLGenerator.java | 4 +-
.../shardingsphere/logging/util/LoggingUtils.java | 38 ++++++++---------
.../YamlLoggingRuleConfigurationSwapperTest.java | 12 +++---
.../ddl/CreateIndexStatementHandlerTest.java | 25 ++++++------
.../handler/dml/CopyStatementHandlerTest.java | 26 ++++++------
.../backend/config/ProxyConfigurationLoader.java | 38 ++++++++---------
.../EncryptRuleConfigurationImportChecker.java | 6 +--
.../rql/storage/unit/ShowStorageUnitExecutor.java | 14 +++----
.../hbase/connector/HBaseConnectionFactory.java | 8 ++--
.../admin/OpenGaussAdminExecutorFactoryTest.java | 8 ++--
...enGaussSystemCatalogAdminQueryExecutorTest.java | 32 +++++++--------
.../opengauss/OpenGaussFrontendEngine.java | 4 +-
.../command/OpenGaussCommandExecuteEngine.java | 6 +--
.../opengauss/OpenGaussFrontendEngineTest.java | 2 +-
.../command/query/PostgreSQLCommand.java | 4 +-
.../PostgreSQLBatchedStatementsExecutorTest.java | 4 +-
.../atomic/storage/StorageContainerFactory.java | 12 +++---
.../container/atomic/storage/impl/H2Container.java | 6 +--
.../test/util/PropertiesBuilder.java | 6 +--
42 files changed, 264 insertions(+), 264 deletions(-)
diff --git
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/BroadcastRule.java
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/BroadcastRule.java
index 110ad460eef..58892c0ac29 100644
---
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/BroadcastRule.java
+++
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/rule/BroadcastRule.java
@@ -53,11 +53,11 @@ public final class BroadcastRule implements DatabaseRule,
DataNodeContainedRule,
private final TableNamesMapper logicalTableMapper;
- public BroadcastRule(final BroadcastRuleConfiguration configuration, final
String databaseName, final Map<String, DataSource> dataSources) {
- this.configuration = configuration;
+ public BroadcastRule(final BroadcastRuleConfiguration config, final String
databaseName, final Map<String, DataSource> dataSources) {
+ configuration = config;
this.databaseName = databaseName;
dataSourceNames = getDataSourceNames(dataSources);
- tables = createBroadcastTables(configuration.getTables());
+ tables = createBroadcastTables(config.getTables());
logicalTableMapper = createTableMapper();
tableDataNodes = createShardingTableDataNodes(dataSourceNames, tables);
}
diff --git
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/NewYamlBroadcastRuleConfigurationSwapper.java
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/NewYamlBroadcastRuleConfigurationSwapper.java
index ca5a5586b57..a16980009c2 100644
---
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/NewYamlBroadcastRuleConfigurationSwapper.java
+++
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/NewYamlBroadcastRuleConfigurationSwapper.java
@@ -45,9 +45,9 @@ public final class NewYamlBroadcastRuleConfigurationSwapper
implements NewYamlRu
if (data.getTables().isEmpty()) {
return Collections.emptyList();
}
- YamlBroadcastRuleConfiguration yamlBroadcastRuleConfiguration = new
YamlBroadcastRuleConfiguration();
- yamlBroadcastRuleConfiguration.getTables().addAll(data.getTables());
- return Collections.singleton(new
YamlDataNode(BroadcastRuleNodePathProvider.TABLES,
YamlEngine.marshal(yamlBroadcastRuleConfiguration)));
+ YamlBroadcastRuleConfiguration yamlBroadcastRuleConfig = new
YamlBroadcastRuleConfiguration();
+ yamlBroadcastRuleConfig.getTables().addAll(data.getTables());
+ return Collections.singleton(new
YamlDataNode(BroadcastRuleNodePathProvider.TABLES,
YamlEngine.marshal(yamlBroadcastRuleConfig)));
}
@Override
@@ -55,8 +55,8 @@ public final class NewYamlBroadcastRuleConfigurationSwapper
implements NewYamlRu
List<YamlDataNode> validDataNodes = dataNodes.stream().filter(each ->
broadcastRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList());
for (YamlDataNode each : validDataNodes) {
if
(broadcastRuleNodePath.getRoot().isValidatedPath(each.getKey())) {
- YamlBroadcastRuleConfiguration yamlBroadcastRuleConfiguration
= YamlEngine.unmarshal(each.getValue(), YamlBroadcastRuleConfiguration.class);
- return Optional.of(new
BroadcastRuleConfiguration(yamlBroadcastRuleConfiguration.getTables()));
+ YamlBroadcastRuleConfiguration yamlBroadcastRuleConfig =
YamlEngine.unmarshal(each.getValue(), YamlBroadcastRuleConfiguration.class);
+ return Optional.of(new
BroadcastRuleConfiguration(yamlBroadcastRuleConfig.getTables()));
}
}
return Optional.empty();
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
index 089f24b740a..6bb51e9def4 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
@@ -68,9 +68,9 @@ class CountBroadcastRuleExecutorTest {
private BroadcastRule mockBroadcastRule() {
BroadcastRule result = mock(BroadcastRule.class);
- BroadcastRuleConfiguration configuration =
mock(BroadcastRuleConfiguration.class);
-
when(configuration.getTables()).thenReturn(Collections.singleton("t_address"));
- when(result.getConfiguration()).thenReturn(configuration);
+ BroadcastRuleConfiguration config =
mock(BroadcastRuleConfiguration.class);
+
when(config.getTables()).thenReturn(Collections.singleton("t_address"));
+ when(result.getConfiguration()).thenReturn(config);
return result;
}
}
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutorTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutorTest.java
index 4a53c0d2f06..139e9ff1ca1 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutorTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/ShowBroadcastTableRuleExecutorTest.java
@@ -75,9 +75,9 @@ class ShowBroadcastTableRuleExecutorTest {
private BroadcastRule mockBroadcastRule() {
BroadcastRule result = mock(BroadcastRule.class);
- BroadcastRuleConfiguration configuration =
mock(BroadcastRuleConfiguration.class);
-
when(configuration.getTables()).thenReturn(Collections.singleton("t_address"));
- when(result.getConfiguration()).thenReturn(configuration);
+ BroadcastRuleConfiguration config =
mock(BroadcastRuleConfiguration.class);
+
when(config.getTables()).thenReturn(Collections.singleton("t_address"));
+ when(result.getConfiguration()).thenReturn(config);
return result;
}
}
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
index 6bac1416f0a..cf8b6b322d1 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
@@ -38,10 +38,10 @@ class CreateBroadcastTableRuleStatementUpdaterTest {
@Test
void assertCheckSQLStatementWithDuplicateBroadcastRule() {
- BroadcastRuleConfiguration currentConfiguration =
mock(BroadcastRuleConfiguration.class);
-
when(currentConfiguration.getTables()).thenReturn(Collections.singleton("t_address"));
+ BroadcastRuleConfiguration currentConfig =
mock(BroadcastRuleConfiguration.class);
+
when(currentConfig.getTables()).thenReturn(Collections.singleton("t_address"));
CreateBroadcastTableRuleStatement statement = new
CreateBroadcastTableRuleStatement(false, Collections.singleton("t_address"));
- assertThrows(DuplicateRuleException.class, () ->
updater.checkSQLStatement(mock(ShardingSphereDatabase.class), statement,
currentConfiguration));
+ assertThrows(DuplicateRuleException.class, () ->
updater.checkSQLStatement(mock(ShardingSphereDatabase.class), statement,
currentConfig));
}
@Test
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java
index fc228d289e1..474ebc62a31 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java
@@ -59,10 +59,10 @@ class DropBroadcastTableRuleStatementUpdaterTest {
@Test
void assertUpdateCurrentRuleConfiguration() {
- BroadcastRuleConfiguration configuration = new
BroadcastRuleConfiguration(new LinkedList<>());
- configuration.getTables().add("t_address");
+ BroadcastRuleConfiguration config = new BroadcastRuleConfiguration(new
LinkedList<>());
+ config.getTables().add("t_address");
DropBroadcastTableRuleStatement statement = new
DropBroadcastTableRuleStatement(false, Collections.singleton("t_address"));
- assertTrue(updater.updateCurrentRuleConfiguration(statement,
configuration));
- assertTrue(configuration.getTables().isEmpty());
+ assertTrue(updater.updateCurrentRuleConfiguration(statement, config));
+ assertTrue(config.getTables().isEmpty());
}
}
diff --git
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
index e8db40f3cee..5ce67d58d59 100644
---
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
+++
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java
@@ -78,9 +78,9 @@ class AlterEncryptRuleStatementUpdaterTest {
@Test
void assertUpdateCurrentRuleConfigurationWithInUsedEncryptor() {
- EncryptRuleConfiguration currentRuleConfiguration =
createCurrentRuleConfigurationWithMultipleTableRules();
- updater.updateCurrentRuleConfiguration(currentRuleConfiguration,
createToBeAlteredRuleConfiguration());
- assertThat(currentRuleConfiguration.getEncryptors().size(), is(1));
+ EncryptRuleConfiguration currentRuleConfig =
createCurrentRuleConfigurationWithMultipleTableRules();
+ updater.updateCurrentRuleConfiguration(currentRuleConfig,
createToBeAlteredRuleConfiguration());
+ assertThat(currentRuleConfig.getEncryptors().size(), is(1));
}
private AlterEncryptRuleStatement createSQLStatement(final String
encryptorName) {
diff --git
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/qualified/type/QualifiedReadwriteSplittingTransactionalDataSourceRouterTest.java
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/qualified/type/QualifiedReadwriteSplittingTransactionalDataSourceRouterTest.java
index 76af7184b18..29d059ed68b 100644
---
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/qualified/type/QualifiedReadwriteSplittingTransactionalDataSourceRouterTest.java
+++
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/route/qualified/type/QualifiedReadwriteSplittingTransactionalDataSourceRouterTest.java
@@ -57,14 +57,14 @@ class
QualifiedReadwriteSplittingTransactionalDataSourceRouterTest {
@Test
void assertRoute() {
- ReadwriteSplittingDataSourceRuleConfiguration
readwriteSplittingDataSourceRuleConfiguration =
+ ReadwriteSplittingDataSourceRuleConfiguration
readwriteSplittingDataSourceRuleConfig =
new
ReadwriteSplittingDataSourceRuleConfiguration("test_config", "write_ds",
Arrays.asList("read_ds_0", "read_ds_1"), null);
ReadwriteSplittingDataSourceRule rule;
- rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfiguration,
TransactionalReadQueryStrategy.PRIMARY, null);
+ rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfig,
TransactionalReadQueryStrategy.PRIMARY, null);
assertThat(new
QualifiedReadwriteSplittingTransactionalDataSourceRouter(new
ConnectionContext()).route(rule), is("write_ds"));
- rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfiguration,
TransactionalReadQueryStrategy.FIXED, new
RoundRobinReadQueryLoadBalanceAlgorithm());
+ rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfig,
TransactionalReadQueryStrategy.FIXED, new
RoundRobinReadQueryLoadBalanceAlgorithm());
assertThat(new
QualifiedReadwriteSplittingTransactionalDataSourceRouter(new
ConnectionContext()).route(rule), is("read_ds_0"));
- rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfiguration,
TransactionalReadQueryStrategy.DYNAMIC, new
RoundRobinReadQueryLoadBalanceAlgorithm());
+ rule = new
ReadwriteSplittingDataSourceRule(readwriteSplittingDataSourceRuleConfig,
TransactionalReadQueryStrategy.DYNAMIC, new
RoundRobinReadQueryLoadBalanceAlgorithm());
assertThat(new
QualifiedReadwriteSplittingTransactionalDataSourceRouter(new
ConnectionContext()).route(rule), is("read_ds_0"));
}
}
diff --git
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
index 60006b52572..65f55a4591e 100644
---
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
+++
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
@@ -38,18 +38,18 @@ class ShadowRuleConfigurationYamlIT extends
YamlRuleConfigurationIT {
@Override
protected void assertYamlRootConfiguration(final YamlRootConfiguration
actual) {
assertDataSourceMap(actual);
- Optional<YamlShadowRuleConfiguration> shadowRuleConfiguration =
actual.getRules().stream()
+ Optional<YamlShadowRuleConfiguration> shadowRuleConfig =
actual.getRules().stream()
.filter(each -> each instanceof
YamlShadowRuleConfiguration).findFirst().map(optional ->
(YamlShadowRuleConfiguration) optional);
- assertTrue(shadowRuleConfiguration.isPresent());
- assertThat(shadowRuleConfiguration.get().getTables().size(), is(3));
- assertTOrder(shadowRuleConfiguration.get());
- assertTOrderItem(shadowRuleConfiguration.get());
- assertTAddress(shadowRuleConfiguration.get());
- assertThat(shadowRuleConfiguration.get().getShadowAlgorithms().size(),
is(4));
- assertUserIdInsertMatchAlgorithm(shadowRuleConfiguration.get());
- assertUserIdUpdateMatchAlgorithm(shadowRuleConfiguration.get());
- assertUserIdSelectMatchAlgorithm(shadowRuleConfiguration.get());
- assertSqlHintAlgorithm(shadowRuleConfiguration.get());
+ assertTrue(shadowRuleConfig.isPresent());
+ assertThat(shadowRuleConfig.get().getTables().size(), is(3));
+ assertTOrder(shadowRuleConfig.get());
+ assertTOrderItem(shadowRuleConfig.get());
+ assertTAddress(shadowRuleConfig.get());
+ assertThat(shadowRuleConfig.get().getShadowAlgorithms().size(), is(4));
+ assertUserIdInsertMatchAlgorithm(shadowRuleConfig.get());
+ assertUserIdUpdateMatchAlgorithm(shadowRuleConfig.get());
+ assertUserIdSelectMatchAlgorithm(shadowRuleConfig.get());
+ assertSqlHintAlgorithm(shadowRuleConfig.get());
}
private void assertDataSourceMap(final YamlRootConfiguration actual) {
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
index 14981d56c2a..0afc6c3336a 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowTableRulesExecutor.java
@@ -59,9 +59,9 @@ public final class ShowShadowTableRulesExecutor implements
RQLExecutor<ShowShado
return result;
}
- private List<Map<String, String>> buildData(final ShadowRuleConfiguration
shadowRuleConfiguration) {
+ private List<Map<String, String>> buildData(final ShadowRuleConfiguration
shadowRuleConfig) {
List<Map<String, String>> result = new ArrayList<>();
- shadowRuleConfiguration.getTables().forEach((key, value) -> {
+ shadowRuleConfig.getTables().forEach((key, value) -> {
Map<String, String> map = new HashMap<>();
map.put(SHADOW_TABLE, key);
map.put(SHADOW_ALGORITHM_NAME,
convertToString(value.getShadowAlgorithmNames()));
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
index fed3039625b..030fbbd4eb0 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/cache/ShardingCache.java
@@ -41,11 +41,11 @@ public final class ShardingCache {
private final ShardingRouteCache routeCache;
- public ShardingCache(final ShardingCacheConfiguration configuration, final
ShardingRule shardingRule) {
- this.configuration = configuration;
+ public ShardingCache(final ShardingCacheConfiguration config, final
ShardingRule shardingRule) {
+ configuration = config;
this.shardingRule = shardingRule;
timestampServiceRule = new TimestampServiceRule(new
DefaultTimestampServiceConfigurationBuilder().build());
routeCacheableChecker = new ShardingRouteCacheableChecker(this);
- routeCache = new ShardingRouteCache(configuration.getRouteCache());
+ routeCache = new ShardingRouteCache(config.getRouteCache());
}
}
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
index a3c2bf8bfbb..d31fd2ab2ea 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/ShardingRuleConfigurationYamlIT.java
@@ -97,10 +97,10 @@ class ShardingRuleConfigurationYamlIT extends
YamlRuleConfigurationIT {
private void assertShardingCache(final YamlShardingRuleConfiguration
actual) {
YamlShardingCacheConfiguration actualShardingCache =
actual.getShardingCache();
assertThat(actualShardingCache.getAllowedMaxSqlLength(), is(512));
- YamlShardingCacheOptionsConfiguration actualRouteCacheConfiguration =
actualShardingCache.getRouteCache();
- assertThat(actualRouteCacheConfiguration.getInitialCapacity(),
is(65536));
- assertThat(actualRouteCacheConfiguration.getMaximumSize(), is(262144));
- assertTrue(actualRouteCacheConfiguration.isSoftValues());
+ YamlShardingCacheOptionsConfiguration actualRouteCacheConfig =
actualShardingCache.getRouteCache();
+ assertThat(actualRouteCacheConfig.getInitialCapacity(), is(65536));
+ assertThat(actualRouteCacheConfig.getMaximumSize(), is(262144));
+ assertTrue(actualRouteCacheConfig.isSoftValues());
}
private void assertProps(final YamlRootConfiguration actual) {
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
index 144b201f933..bf1444a98c5 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/yaml/swapper/NewYamlShardingRuleConfigurationSwapperTest.java
@@ -84,11 +84,11 @@ class NewYamlShardingRuleConfigurationSwapperTest {
ShardingTableRuleConfiguration subTableRuleConfig =
createTableRuleConfiguration("SUB_LOGIC_TABLE", "ds_${0..1}.sub_table_${0..2}");
subTableRuleConfig.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("id", "auto_increment"));
result.getTables().add(subTableRuleConfig);
- ShardingAutoTableRuleConfiguration autoTableRuleConfiguration = new
ShardingAutoTableRuleConfiguration("auto_table", "ds_1,ds_2");
- autoTableRuleConfiguration.setShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", "hash_mod"));
- autoTableRuleConfiguration.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("id", "auto_increment"));
- autoTableRuleConfiguration.setAuditStrategy(new
ShardingAuditStrategyConfiguration(Collections.singleton("audit_algorithm"),
true));
- result.getAutoTables().add(autoTableRuleConfiguration);
+ ShardingAutoTableRuleConfiguration autoTableRuleConfig = new
ShardingAutoTableRuleConfiguration("auto_table", "ds_1,ds_2");
+ autoTableRuleConfig.setShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", "hash_mod"));
+ autoTableRuleConfig.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("id", "auto_increment"));
+ autoTableRuleConfig.setAuditStrategy(new
ShardingAuditStrategyConfiguration(Collections.singleton("audit_algorithm"),
true));
+ result.getAutoTables().add(autoTableRuleConfig);
result.getBindingTableGroups().add(new
ShardingTableReferenceRuleConfiguration("foo",
shardingTableRuleConfig.getLogicTable() + "," +
subTableRuleConfig.getLogicTable()));
result.setDefaultDatabaseShardingStrategy(new
StandardShardingStrategyConfiguration("ds_id", "standard"));
result.setDefaultTableShardingStrategy(new
StandardShardingStrategyConfiguration("table_id", "standard"));
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
index a3f8648fcff..296478c5fcf 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
@@ -79,12 +79,12 @@ class CountShardingRuleExecutorTest {
Map<String, TableRule> tableRules = new LinkedHashMap<>();
tableRules.put("t_order_item", mock(TableRule.class));
tableRules.put("t_order", mock(TableRule.class));
- ShardingRuleConfiguration ruleConfiguration = new
ShardingRuleConfiguration();
- ShardingTableReferenceRuleConfiguration
shardingTableReferenceRuleConfiguration = new
ShardingTableReferenceRuleConfiguration("refRule", "ref");
-
ruleConfiguration.getBindingTableGroups().add(shardingTableReferenceRuleConfiguration);
+ ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
+ ShardingTableReferenceRuleConfiguration
shardingTableReferenceRuleConfig = new
ShardingTableReferenceRuleConfiguration("refRule", "ref");
+
ruleConfig.getBindingTableGroups().add(shardingTableReferenceRuleConfig);
ShardingRule result = mock(ShardingRule.class);
when(result.getTableRules()).thenReturn(tableRules);
- when(result.getConfiguration()).thenReturn(ruleConfiguration);
+ when(result.getConfiguration()).thenReturn(ruleConfig);
return result;
}
}
diff --git
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/AlterViewStatementContextTest.java
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/AlterViewStatementContextTest.java
index eab23029a68..64cd0c568e6 100644
---
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/AlterViewStatementContextTest.java
+++
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/AlterViewStatementContextTest.java
@@ -58,10 +58,10 @@ class AlterViewStatementContextTest {
@Test
void assertPostgreSQLNewInstance() {
- PostgreSQLAlterViewStatement postgreSQLAlterViewStatement =
mock(PostgreSQLAlterViewStatement.class);
- when(postgreSQLAlterViewStatement.getView()).thenReturn(view);
-
when(postgreSQLAlterViewStatement.getRenameView()).thenReturn(Optional.of(new
SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("view")))));
- assertNewInstance(postgreSQLAlterViewStatement);
+ PostgreSQLAlterViewStatement alterViewStatement =
mock(PostgreSQLAlterViewStatement.class);
+ when(alterViewStatement.getView()).thenReturn(view);
+ when(alterViewStatement.getRenameView()).thenReturn(Optional.of(new
SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("view")))));
+ assertNewInstance(alterViewStatement);
}
private void assertNewInstance(final AlterViewStatement
alterViewStatement) {
diff --git
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/PrepareStatementContextTest.java
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/PrepareStatementContextTest.java
index 8285b17be3e..1ea14db3efc 100644
---
a/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/PrepareStatementContextTest.java
+++
b/infra/binder/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/ddl/PrepareStatementContextTest.java
@@ -61,41 +61,41 @@ class PrepareStatementContextTest {
@Test
void assertNewInstance() {
- PostgreSQLPrepareStatement postgreSQLPrepare =
mock(PostgreSQLPrepareStatement.class);
-
when(postgreSQLPrepare.getSelect()).thenReturn(Optional.of(getSelect()));
-
when(postgreSQLPrepare.getInsert()).thenReturn(Optional.of(getInsert()));
-
when(postgreSQLPrepare.getUpdate()).thenReturn(Optional.of(getUpdate()));
-
when(postgreSQLPrepare.getDelete()).thenReturn(Optional.of(getDelete()));
- PrepareStatementContext actual = new
PrepareStatementContext(postgreSQLPrepare);
+ PostgreSQLPrepareStatement prepareStatement =
mock(PostgreSQLPrepareStatement.class);
+
when(prepareStatement.getSelect()).thenReturn(Optional.of(getSelect()));
+
when(prepareStatement.getInsert()).thenReturn(Optional.of(getInsert()));
+
when(prepareStatement.getUpdate()).thenReturn(Optional.of(getUpdate()));
+
when(prepareStatement.getDelete()).thenReturn(Optional.of(getDelete()));
+ PrepareStatementContext actual = new
PrepareStatementContext(prepareStatement);
assertThat(actual, instanceOf(CommonSQLStatementContext.class));
- assertThat(actual.getSqlStatement(), is(postgreSQLPrepare));
+ assertThat(actual.getSqlStatement(), is(prepareStatement));
assertThat(actual.getAllTables().stream().map(each ->
each.getTableName().getIdentifier().getValue()).collect(Collectors.toList()),
is(Arrays.asList("tbl_1", "tbl_1", "tbl_1", "tbl_1")));
}
private SelectStatement getSelect() {
- SelectStatement select = new PostgreSQLSelectStatement();
- select.setFrom(table);
- return select;
+ SelectStatement result = new PostgreSQLSelectStatement();
+ result.setFrom(table);
+ return result;
}
private InsertStatement getInsert() {
- InsertStatement insert = new PostgreSQLInsertStatement();
- insert.setTable(table);
- return insert;
+ InsertStatement result = new PostgreSQLInsertStatement();
+ result.setTable(table);
+ return result;
}
private UpdateStatement getUpdate() {
- UpdateStatement update = new PostgreSQLUpdateStatement();
- update.setTable(table);
+ UpdateStatement result = new PostgreSQLUpdateStatement();
+ result.setTable(table);
SetAssignmentSegment setAssignmentSegment = new
SetAssignmentSegment(0, 0, Collections.singletonList(new
ColumnAssignmentSegment(0, 0, Collections.singletonList(column), column)));
- update.setSetAssignment(setAssignmentSegment);
- return update;
+ result.setSetAssignment(setAssignmentSegment);
+ return result;
}
private DeleteStatement getDelete() {
- DeleteStatement delete = new PostgreSQLDeleteStatement();
- delete.setTable(table);
- return delete;
+ DeleteStatement result = new PostgreSQLDeleteStatement();
+ result.setTable(table);
+ return result;
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
index c241b47f9a0..452e967ef99 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
@@ -104,26 +104,26 @@ public final class SQLHintUtils {
}
HintValueContext result = new HintValueContext();
String hintText = sql.substring(0, sql.indexOf(SQL_COMMENT_SUFFIX) +
2);
- Properties hintProperties = SQLHintUtils.getSQLHintProps(hintText);
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.DATASOURCE_NAME_KEY)) {
- result.setDataSourceName(getProperty(hintProperties,
SQLHintPropertiesKey.DATASOURCE_NAME_KEY));
+ Properties hintProps = SQLHintUtils.getSQLHintProps(hintText);
+ if (containsPropertyKey(hintProps,
SQLHintPropertiesKey.DATASOURCE_NAME_KEY)) {
+ result.setDataSourceName(getProperty(hintProps,
SQLHintPropertiesKey.DATASOURCE_NAME_KEY));
}
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.WRITE_ROUTE_ONLY_KEY)) {
-
result.setWriteRouteOnly(Boolean.parseBoolean(getProperty(hintProperties,
SQLHintPropertiesKey.WRITE_ROUTE_ONLY_KEY)));
+ if (containsPropertyKey(hintProps,
SQLHintPropertiesKey.WRITE_ROUTE_ONLY_KEY)) {
+
result.setWriteRouteOnly(Boolean.parseBoolean(getProperty(hintProps,
SQLHintPropertiesKey.WRITE_ROUTE_ONLY_KEY)));
}
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.USE_TRAFFIC_KEY)) {
-
result.setUseTraffic(Boolean.parseBoolean(getProperty(hintProperties,
SQLHintPropertiesKey.USE_TRAFFIC_KEY)));
+ if (containsPropertyKey(hintProps,
SQLHintPropertiesKey.USE_TRAFFIC_KEY)) {
+ result.setUseTraffic(Boolean.parseBoolean(getProperty(hintProps,
SQLHintPropertiesKey.USE_TRAFFIC_KEY)));
}
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.SKIP_SQL_REWRITE_KEY)) {
-
result.setSkipSQLRewrite(Boolean.parseBoolean(getProperty(hintProperties,
SQLHintPropertiesKey.SKIP_SQL_REWRITE_KEY)));
+ if (containsPropertyKey(hintProps,
SQLHintPropertiesKey.SKIP_SQL_REWRITE_KEY)) {
+
result.setSkipSQLRewrite(Boolean.parseBoolean(getProperty(hintProps,
SQLHintPropertiesKey.SKIP_SQL_REWRITE_KEY)));
}
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.DISABLE_AUDIT_NAMES_KEY)) {
- result.setDisableAuditNames(getProperty(hintProperties,
SQLHintPropertiesKey.DISABLE_AUDIT_NAMES_KEY));
+ if (containsPropertyKey(hintProps,
SQLHintPropertiesKey.DISABLE_AUDIT_NAMES_KEY)) {
+ result.setDisableAuditNames(getProperty(hintProps,
SQLHintPropertiesKey.DISABLE_AUDIT_NAMES_KEY));
}
- if (containsPropertyKey(hintProperties,
SQLHintPropertiesKey.SHADOW_KEY)) {
- result.setShadow(Boolean.parseBoolean(getProperty(hintProperties,
SQLHintPropertiesKey.SHADOW_KEY)));
+ if (containsPropertyKey(hintProps, SQLHintPropertiesKey.SHADOW_KEY)) {
+ result.setShadow(Boolean.parseBoolean(getProperty(hintProps,
SQLHintPropertiesKey.SHADOW_KEY)));
}
- for (Entry<Object, Object> entry : hintProperties.entrySet()) {
+ for (Entry<Object, Object> entry : hintProps.entrySet()) {
Comparable<?> value = entry.getValue() instanceof Comparable ?
(Comparable<?>) entry.getValue() : Objects.toString(entry.getValue());
if (containsPropertyKey(Objects.toString(entry.getKey()),
SQLHintPropertiesKey.SHARDING_DATABASE_VALUE_KEY)) {
result.getShardingDatabaseValues().put(Objects.toString(entry.getKey()).toUpperCase(),
value);
@@ -139,17 +139,17 @@ public final class SQLHintUtils {
return null != sql &&
(sql.startsWith(SQLHintTokenEnum.SQL_START_HINT_TOKEN.getKey()) ||
sql.startsWith(SQLHintTokenEnum.SQL_START_HINT_TOKEN.getAlias()));
}
- private static boolean containsPropertyKey(final Properties
hintProperties, final SQLHintPropertiesKey sqlHintPropertiesKey) {
- return hintProperties.containsKey(sqlHintPropertiesKey.getKey()) ||
hintProperties.containsKey(sqlHintPropertiesKey.getAlias());
+ private static boolean containsPropertyKey(final Properties hintProps,
final SQLHintPropertiesKey sqlHintPropsKey) {
+ return hintProps.containsKey(sqlHintPropsKey.getKey()) ||
hintProps.containsKey(sqlHintPropsKey.getAlias());
}
- private static boolean containsPropertyKey(final String hintPropertyKey,
final SQLHintPropertiesKey sqlHintPropertiesKey) {
- return hintPropertyKey.contains(sqlHintPropertiesKey.getKey()) ||
hintPropertyKey.contains(sqlHintPropertiesKey.getAlias());
+ private static boolean containsPropertyKey(final String hintPropKey, final
SQLHintPropertiesKey sqlHintPropsKey) {
+ return hintPropKey.contains(sqlHintPropsKey.getKey()) ||
hintPropKey.contains(sqlHintPropsKey.getAlias());
}
- private static String getProperty(final Properties hintProperties, final
SQLHintPropertiesKey sqlHintPropertiesKey) {
- String result =
hintProperties.getProperty(sqlHintPropertiesKey.getKey());
- return null == result ?
hintProperties.getProperty(sqlHintPropertiesKey.getAlias()) : result;
+ private static String getProperty(final Properties hintProps, final
SQLHintPropertiesKey sqlHintPropsKey) {
+ String result = hintProps.getProperty(sqlHintPropsKey.getKey());
+ return null == result ?
hintProps.getProperty(sqlHintPropsKey.getAlias()) : result;
}
/**
@@ -159,9 +159,6 @@ public final class SQLHintUtils {
* @return SQL after remove hint
*/
public static String removeHint(final String sql) {
- if (startWithHint(sql)) {
- return sql.substring(sql.indexOf(SQL_COMMENT_SUFFIX) + 2);
- }
- return sql;
+ return startWithHint(sql) ?
sql.substring(sql.indexOf(SQL_COMMENT_SUFFIX) + 2) : sql;
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageNodeProperties.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageNodeProperties.java
index 6585d84a2fd..91e13d20914 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageNodeProperties.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageNodeProperties.java
@@ -38,8 +38,8 @@ public final class StorageNodeProperties {
@Override
public boolean equals(final Object obj) {
if (obj instanceof StorageNodeProperties) {
- StorageNodeProperties storageNodeProperties =
(StorageNodeProperties) obj;
- return storageNodeProperties.name.equals(name);
+ StorageNodeProperties storageNodeProps = (StorageNodeProperties)
obj;
+ return storageNodeProps.name.equals(name);
}
return false;
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceCreator.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceCreator.java
index d0f00f872c8..bf408ade7e8 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceCreator.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/resource/storage/StorageResourceCreator.java
@@ -98,9 +98,9 @@ public final class StorageResourceCreator {
}
private static StorageNodeProperties getStorageNodeProperties(final String
dataSourceName, final DataSourcePoolProperties storageNodeProps) {
- Map<String, Object> standardProperties =
storageNodeProps.getConnectionPropertySynonyms().getStandardProperties();
- String url = standardProperties.get("url").toString();
- String username = standardProperties.get("username").toString();
+ Map<String, Object> standardProps =
storageNodeProps.getConnectionPropertySynonyms().getStandardProperties();
+ String url = standardProps.get("url").toString();
+ String username = standardProps.get("username").toString();
DatabaseType databaseType = DatabaseTypeFactory.get(url);
return getStorageNodeProperties(dataSourceName, url, username,
databaseType);
}
diff --git
a/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/refresher/util/TableRefreshUtils.java
b/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/refresher/util/TableRefreshUtils.java
index 50546190939..71e3170acd3 100644
---
a/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/refresher/util/TableRefreshUtils.java
+++
b/infra/context/src/main/java/org/apache/shardingsphere/infra/connection/refresher/util/TableRefreshUtils.java
@@ -95,11 +95,11 @@ public final class TableRefreshUtils {
if (!singleRule.isPresent()) {
return false;
}
- RuleConfiguration ruleConfiguration =
singleRule.get().getConfiguration();
- if (!(ruleConfiguration instanceof SingleRuleConfiguration)) {
+ RuleConfiguration ruleConfig = singleRule.get().getConfiguration();
+ if (!(ruleConfig instanceof SingleRuleConfiguration)) {
return false;
}
- Collection<String> tablesConfig = ((SingleRuleConfiguration)
ruleConfiguration).getTables();
+ Collection<String> tablesConfig = ((SingleRuleConfiguration)
ruleConfig).getTables();
if (tablesConfig.contains(SingleTableConstants.ALL_TABLES) ||
tablesConfig.contains(SingleTableConstants.ALL_SCHEMA_TABLES)) {
return false;
}
diff --git
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactory.java
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactory.java
index 6c74393d90d..a89aa183ddb 100644
---
a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactory.java
+++
b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/api/yaml/YamlShardingSphereDataSourceFactory.java
@@ -167,31 +167,31 @@ public final class YamlShardingSphereDataSourceFactory {
return
ShardingSphereDataSourceFactory.createDataSource(jdbcConfig.getDatabaseName(),
modeConfig, dataSourceMap, ruleConfigs, jdbcConfig.getProps());
}
- private static void rebuildGlobalRuleConfiguration(final
YamlJDBCConfiguration jdbcConfiguration) {
-
jdbcConfiguration.getRules().removeIf(YamlGlobalRuleConfiguration.class::isInstance);
- if (null != jdbcConfiguration.getAuthority()) {
- jdbcConfiguration.getRules().add(jdbcConfiguration.getAuthority());
+ private static void rebuildGlobalRuleConfiguration(final
YamlJDBCConfiguration jdbcConfig) {
+
jdbcConfig.getRules().removeIf(YamlGlobalRuleConfiguration.class::isInstance);
+ if (null != jdbcConfig.getAuthority()) {
+ jdbcConfig.getRules().add(jdbcConfig.getAuthority());
}
- if (null != jdbcConfiguration.getTransaction()) {
-
jdbcConfiguration.getRules().add(jdbcConfiguration.getTransaction());
+ if (null != jdbcConfig.getTransaction()) {
+ jdbcConfig.getRules().add(jdbcConfig.getTransaction());
}
- if (null != jdbcConfiguration.getGlobalClock()) {
-
jdbcConfiguration.getRules().add(jdbcConfiguration.getGlobalClock());
+ if (null != jdbcConfig.getGlobalClock()) {
+ jdbcConfig.getRules().add(jdbcConfig.getGlobalClock());
}
- if (null != jdbcConfiguration.getSqlParser()) {
- jdbcConfiguration.getRules().add(jdbcConfiguration.getSqlParser());
+ if (null != jdbcConfig.getSqlParser()) {
+ jdbcConfig.getRules().add(jdbcConfig.getSqlParser());
}
- if (null != jdbcConfiguration.getSqlTranslator()) {
-
jdbcConfiguration.getRules().add(jdbcConfiguration.getSqlTranslator());
+ if (null != jdbcConfig.getSqlTranslator()) {
+ jdbcConfig.getRules().add(jdbcConfig.getSqlTranslator());
}
- if (null != jdbcConfiguration.getTraffic()) {
- jdbcConfiguration.getRules().add(jdbcConfiguration.getTraffic());
+ if (null != jdbcConfig.getTraffic()) {
+ jdbcConfig.getRules().add(jdbcConfig.getTraffic());
}
- if (null != jdbcConfiguration.getLogging()) {
- jdbcConfiguration.getRules().add(jdbcConfiguration.getLogging());
+ if (null != jdbcConfig.getLogging()) {
+ jdbcConfig.getRules().add(jdbcConfig.getLogging());
}
- if (null != jdbcConfiguration.getSqlFederation()) {
-
jdbcConfiguration.getRules().add(jdbcConfiguration.getSqlFederation());
+ if (null != jdbcConfig.getSqlFederation()) {
+ jdbcConfig.getRules().add(jdbcConfig.getSqlFederation());
}
}
}
diff --git
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
index 71d94590fc1..8180e30b9c6 100644
---
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
+++
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/ShardingSpherePipelineDataSourceConfiguration.java
@@ -96,9 +96,9 @@ public final class
ShardingSpherePipelineDataSourceConfiguration implements Pipe
rootConfig.getDataSources().forEach((key, value) -> {
String jdbcUrlKey = value.containsKey("url") ? "url" : "jdbcUrl";
String jdbcUrl = value.get(jdbcUrlKey).toString();
- Properties queryProperties =
standardJdbcUrlParser.parseQueryProperties(jdbcUrl.contains("?") ?
jdbcUrl.substring(jdbcUrl.indexOf("?") + 1) : "");
- extension.get().extendQueryProperties(queryProperties);
- value.replace(jdbcUrlKey, new
JdbcUrlAppender().appendQueryProperties(jdbcUrl, queryProperties));
+ Properties queryProps =
standardJdbcUrlParser.parseQueryProperties(jdbcUrl.contains("?") ?
jdbcUrl.substring(jdbcUrl.indexOf("?") + 1) : "");
+ extension.get().extendQueryProperties(queryProps);
+ value.replace(jdbcUrlKey, new
JdbcUrlAppender().appendQueryProperties(jdbcUrl, queryProps));
});
}
diff --git
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
index b2c0910f961..90bd9d1f84c 100644
---
a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
+++
b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/impl/StandardPipelineDataSourceConfiguration.java
@@ -104,9 +104,9 @@ public final class StandardPipelineDataSourceConfiguration
implements PipelineDa
return;
}
String jdbcUrl = jdbcConfig.getUrl();
- Properties queryProperties = new
StandardJdbcUrlParser().parseQueryProperties(jdbcUrl.contains("?") ?
jdbcUrl.substring(jdbcUrl.indexOf("?") + 1) : "");
- extension.get().extendQueryProperties(queryProperties);
- String url = new JdbcUrlAppender().appendQueryProperties(jdbcUrl,
queryProperties);
+ Properties queryProps = new
StandardJdbcUrlParser().parseQueryProperties(jdbcUrl.contains("?") ?
jdbcUrl.substring(jdbcUrl.indexOf("?") + 1) : "");
+ extension.get().extendQueryProperties(queryProps);
+ String url = new JdbcUrlAppender().appendQueryProperties(jdbcUrl,
queryProps);
jdbcConfig.setUrl(url);
yamlConfig.put("url", url);
}
diff --git
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgreSQLIndexSQLGenerator.java
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgreSQLIndexSQLGenerator.java
index f9f1a44d19c..775e327961c 100644
---
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgreSQLIndexSQLGenerator.java
+++
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ddlgenerator/PostgreSQLIndexSQLGenerator.java
@@ -80,8 +80,8 @@ public final class PostgreSQLIndexSQLGenerator extends
AbstractPostgreSQLDDLAdap
}
private Map<String, Object> getIndexData(final Map<String, Object>
context, final Map<String, Object> indexNode) {
- Collection<Map<String, Object>> indexProperties =
fetchIndexProperties(context, indexNode);
- Map<String, Object> result = indexProperties.iterator().next();
+ Collection<Map<String, Object>> indexProps =
fetchIndexProperties(context, indexNode);
+ Map<String, Object> result = indexProps.iterator().next();
result.put("schema", context.get("schema"));
result.put("table", context.get("name"));
return result;
diff --git
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/util/LoggingUtils.java
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/util/LoggingUtils.java
index 3444b866671..206e713952a 100644
---
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/util/LoggingUtils.java
+++
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/util/LoggingUtils.java
@@ -48,11 +48,11 @@ public final class LoggingUtils {
/**
* Get ShardingSphere-SQL logger.
*
- * @param loggingRuleConfiguration logging global rule configuration
+ * @param loggingRuleConfig logging global rule configuration
* @return ShardingSphere-SQL logger
*/
- public static Optional<ShardingSphereLogger> getSQLLogger(final
LoggingRuleConfiguration loggingRuleConfiguration) {
- return loggingRuleConfiguration.getLoggers().stream()
+ public static Optional<ShardingSphereLogger> getSQLLogger(final
LoggingRuleConfiguration loggingRuleConfig) {
+ return loggingRuleConfig.getLoggers().stream()
.filter(each ->
LoggingConstants.SQL_LOG_TOPIC.equalsIgnoreCase(each.getLoggerName())).findFirst();
}
@@ -60,32 +60,32 @@ public final class LoggingUtils {
* Synchronize the log-related configuration in logging rule and props.
* Use the configuration in the logging rule first.
*
- * @param loggingRuleConfiguration logging global rule configuration
+ * @param loggingRuleConfig logging global rule configuration
* @param props configuration properties
*/
- public static void syncLoggingConfig(final LoggingRuleConfiguration
loggingRuleConfiguration, final ConfigurationProperties props) {
- LoggingUtils.getSQLLogger(loggingRuleConfiguration).ifPresent(option
-> {
- Properties loggerProperties = option.getProps();
- syncPropsToLoggingRule(loggerProperties, props);
- syncLoggingRuleToProps(loggerProperties, props);
+ public static void syncLoggingConfig(final LoggingRuleConfiguration
loggingRuleConfig, final ConfigurationProperties props) {
+ LoggingUtils.getSQLLogger(loggingRuleConfig).ifPresent(option -> {
+ Properties loggerProps = option.getProps();
+ syncPropsToLoggingRule(loggerProps, props);
+ syncLoggingRuleToProps(loggerProps, props);
});
}
- private static void syncPropsToLoggingRule(final Properties
loggerProperties, final ConfigurationProperties props) {
- if (!loggerProperties.containsKey(LoggingConstants.SQL_LOG_ENABLE) &&
props.getProps().containsKey(LoggingConstants.SQL_SHOW)) {
- loggerProperties.setProperty(LoggingConstants.SQL_LOG_ENABLE,
props.getProps().get(LoggingConstants.SQL_SHOW).toString());
+ private static void syncPropsToLoggingRule(final Properties loggerProps,
final ConfigurationProperties props) {
+ if (!loggerProps.containsKey(LoggingConstants.SQL_LOG_ENABLE) &&
props.getProps().containsKey(LoggingConstants.SQL_SHOW)) {
+ loggerProps.setProperty(LoggingConstants.SQL_LOG_ENABLE,
props.getProps().get(LoggingConstants.SQL_SHOW).toString());
}
- if (!loggerProperties.containsKey(LoggingConstants.SQL_LOG_SIMPLE) &&
props.getProps().containsKey(LoggingConstants.SQL_SIMPLE)) {
- loggerProperties.setProperty(LoggingConstants.SQL_LOG_SIMPLE,
props.getProps().get(LoggingConstants.SQL_SIMPLE).toString());
+ if (!loggerProps.containsKey(LoggingConstants.SQL_LOG_SIMPLE) &&
props.getProps().containsKey(LoggingConstants.SQL_SIMPLE)) {
+ loggerProps.setProperty(LoggingConstants.SQL_LOG_SIMPLE,
props.getProps().get(LoggingConstants.SQL_SIMPLE).toString());
}
}
- private static void syncLoggingRuleToProps(final Properties
loggerProperties, final ConfigurationProperties props) {
- if (loggerProperties.containsKey(LoggingConstants.SQL_LOG_ENABLE)) {
- props.getProps().setProperty(LoggingConstants.SQL_SHOW,
loggerProperties.get(LoggingConstants.SQL_LOG_ENABLE).toString());
+ private static void syncLoggingRuleToProps(final Properties loggerProps,
final ConfigurationProperties props) {
+ if (loggerProps.containsKey(LoggingConstants.SQL_LOG_ENABLE)) {
+ props.getProps().setProperty(LoggingConstants.SQL_SHOW,
loggerProps.get(LoggingConstants.SQL_LOG_ENABLE).toString());
}
- if (loggerProperties.containsKey(LoggingConstants.SQL_LOG_SIMPLE)) {
- props.getProps().setProperty(LoggingConstants.SQL_SIMPLE,
loggerProperties.get(LoggingConstants.SQL_LOG_SIMPLE).toString());
+ if (loggerProps.containsKey(LoggingConstants.SQL_LOG_SIMPLE)) {
+ props.getProps().setProperty(LoggingConstants.SQL_SIMPLE,
loggerProps.get(LoggingConstants.SQL_LOG_SIMPLE).toString());
}
}
}
diff --git
a/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapperTest.java
b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapperTest.java
index f69cc5433c3..a15e73b75e8 100644
---
a/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapperTest.java
+++
b/kernel/logging/core/src/test/java/org/apache/shardingsphere/logging/yaml/swapper/YamlLoggingRuleConfigurationSwapperTest.java
@@ -38,9 +38,9 @@ class YamlLoggingRuleConfigurationSwapperTest {
@Test
void assertSwapToYamlConfiguration() {
- YamlLoggingRuleConfiguration yamlLoggingRuleConfiguration =
swapper.swapToYamlConfiguration(createLoggingRuleConfiguration());
- assertThat(yamlLoggingRuleConfiguration.getLoggers().size(), is(1));
- assertThat(yamlLoggingRuleConfiguration.getAppenders().size(), is(1));
+ YamlLoggingRuleConfiguration yamlLoggingRuleConfig =
swapper.swapToYamlConfiguration(createLoggingRuleConfiguration());
+ assertThat(yamlLoggingRuleConfig.getLoggers().size(), is(1));
+ assertThat(yamlLoggingRuleConfig.getAppenders().size(), is(1));
}
private LoggingRuleConfiguration createLoggingRuleConfiguration() {
@@ -50,9 +50,9 @@ class YamlLoggingRuleConfigurationSwapperTest {
@Test
void assertSwapToObject() {
- LoggingRuleConfiguration loggingRuleConfiguration =
swapper.swapToObject(createYamlLoggingRuleConfiguration());
- assertThat(loggingRuleConfiguration.getLoggers().size(), is(1));
- assertThat(loggingRuleConfiguration.getAppenders().size(), is(1));
+ LoggingRuleConfiguration loggingRuleConfig =
swapper.swapToObject(createYamlLoggingRuleConfiguration());
+ assertThat(loggingRuleConfig.getLoggers().size(), is(1));
+ assertThat(loggingRuleConfig.getAppenders().size(), is(1));
}
private YamlLoggingRuleConfiguration createYamlLoggingRuleConfiguration() {
diff --git
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateIndexStatementHandlerTest.java
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateIndexStatementHandlerTest.java
index 6a32e8c6b92..e3deb18ca62 100644
---
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateIndexStatementHandlerTest.java
+++
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateIndexStatementHandlerTest.java
@@ -17,12 +17,6 @@
package org.apache.shardingsphere.sql.parser.sql.dialect.handler.ddl;
-import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.util.Optional;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.ddl.MySQLCreateIndexStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateIndexStatement;
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleCreateIndexStatement;
@@ -30,6 +24,13 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl
import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerCreateIndexStatement;
import org.junit.jupiter.api.Test;
+import java.util.Optional;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
class CreateIndexStatementHandlerTest {
@Test
@@ -43,18 +44,18 @@ class CreateIndexStatementHandlerTest {
@Test
void assertGeneratedIndexStartIndexForPostgreSQL() {
- PostgreSQLCreateIndexStatement postgreSQLCreateIndexStatement = new
PostgreSQLCreateIndexStatement(true);
- postgreSQLCreateIndexStatement.setGeneratedIndexStartIndex(2);
- Optional<Integer> actual =
CreateIndexStatementHandler.getGeneratedIndexStartIndex(postgreSQLCreateIndexStatement);
+ PostgreSQLCreateIndexStatement createIndexStatement = new
PostgreSQLCreateIndexStatement(true);
+ createIndexStatement.setGeneratedIndexStartIndex(2);
+ Optional<Integer> actual =
CreateIndexStatementHandler.getGeneratedIndexStartIndex(createIndexStatement);
assertTrue(actual.isPresent());
assertThat(actual.get(), is(2));
}
@Test
void assertGeneratedIndexStartIndexForOpenGauss() {
- OpenGaussCreateIndexStatement openGaussCreateIndexStatement = new
OpenGaussCreateIndexStatement(true);
- openGaussCreateIndexStatement.setGeneratedIndexStartIndex(2);
- Optional<Integer> actual =
CreateIndexStatementHandler.getGeneratedIndexStartIndex(openGaussCreateIndexStatement);
+ OpenGaussCreateIndexStatement createIndexStatement = new
OpenGaussCreateIndexStatement(true);
+ createIndexStatement.setGeneratedIndexStartIndex(2);
+ Optional<Integer> actual =
CreateIndexStatementHandler.getGeneratedIndexStartIndex(createIndexStatement);
assertTrue(actual.isPresent());
assertThat(actual.get(), is(2));
}
diff --git
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dml/CopyStatementHandlerTest.java
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dml/CopyStatementHandlerTest.java
index 0e1437770de..0679aae06c4 100644
---
a/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dml/CopyStatementHandlerTest.java
+++
b/parser/sql/statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dml/CopyStatementHandlerTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.sql.parser.sql.dialect.handler.dml;
+import com.google.common.base.Preconditions;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.prepare.PrepareStatementQuerySegment;
import
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
@@ -36,33 +37,34 @@ class CopyStatementHandlerTest {
@Test
void assertGetPrepareStatementQuerySegmentWithSegmentForPostgreSQL() {
- PostgreSQLCopyStatement postgreSQLCopyStatement = new
PostgreSQLCopyStatement();
- postgreSQLCopyStatement.setPrepareStatementQuerySegment(new
PrepareStatementQuerySegment(0, 2));
- Optional<PrepareStatementQuerySegment> actual =
CopyStatementHandler.getPrepareStatementQuerySegment(postgreSQLCopyStatement);
+ PostgreSQLCopyStatement copyStatement = new PostgreSQLCopyStatement();
+ copyStatement.setPrepareStatementQuerySegment(new
PrepareStatementQuerySegment(0, 2));
+ Optional<PrepareStatementQuerySegment> actual =
CopyStatementHandler.getPrepareStatementQuerySegment(copyStatement);
assertTrue(actual.isPresent());
- assertThat(actual.get(),
is(postgreSQLCopyStatement.getPrepareStatementQuerySegment().get()));
+
Preconditions.checkState(copyStatement.getPrepareStatementQuerySegment().isPresent());
+ assertThat(actual.get(),
is(copyStatement.getPrepareStatementQuerySegment().get()));
}
@Test
void assertGetPrepareStatementQuerySegmentWithoutSegmentForPostgreSQL() {
- PostgreSQLCopyStatement postgreSQLCopyStatement = new
PostgreSQLCopyStatement();
- Optional<PrepareStatementQuerySegment> actual =
CopyStatementHandler.getPrepareStatementQuerySegment(postgreSQLCopyStatement);
+ PostgreSQLCopyStatement copyStatement = new PostgreSQLCopyStatement();
+ Optional<PrepareStatementQuerySegment> actual =
CopyStatementHandler.getPrepareStatementQuerySegment(copyStatement);
assertFalse(actual.isPresent());
}
@Test
void assertGetColumnsWithSegmentForPostgreSQL() {
- PostgreSQLCopyStatement postgreSQLCopyStatement = new
PostgreSQLCopyStatement();
- postgreSQLCopyStatement.getColumns().add(new ColumnSegment(0, 2, new
IdentifierValue("identifier")));
- Collection<ColumnSegment> actual =
CopyStatementHandler.getColumns(postgreSQLCopyStatement);
+ PostgreSQLCopyStatement copyStatement = new PostgreSQLCopyStatement();
+ copyStatement.getColumns().add(new ColumnSegment(0, 2, new
IdentifierValue("identifier")));
+ Collection<ColumnSegment> actual =
CopyStatementHandler.getColumns(copyStatement);
assertFalse(actual.isEmpty());
- assertThat(actual, is(postgreSQLCopyStatement.getColumns()));
+ assertThat(actual, is(copyStatement.getColumns()));
}
@Test
void assertGetColumnsWithoutSegmentForPostgreSQL() {
- PostgreSQLCopyStatement postgreSQLCopyStatement = new
PostgreSQLCopyStatement();
- Collection<ColumnSegment> actual =
CopyStatementHandler.getColumns(postgreSQLCopyStatement);
+ PostgreSQLCopyStatement copyStatement = new PostgreSQLCopyStatement();
+ Collection<ColumnSegment> actual =
CopyStatementHandler.getColumns(copyStatement);
assertTrue(actual.isEmpty());
}
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
index 8af3fbe6843..8c587780928 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/config/ProxyConfigurationLoader.java
@@ -82,33 +82,33 @@ public final class ProxyConfigurationLoader {
return null == result ? new YamlProxyServerConfiguration() :
rebuildGlobalRuleConfiguration(result);
}
- private static YamlProxyServerConfiguration
rebuildGlobalRuleConfiguration(final YamlProxyServerConfiguration
serverConfiguration) {
-
serverConfiguration.getRules().removeIf(YamlGlobalRuleConfiguration.class::isInstance);
- if (null != serverConfiguration.getAuthority()) {
-
serverConfiguration.getRules().add(serverConfiguration.getAuthority());
+ private static YamlProxyServerConfiguration
rebuildGlobalRuleConfiguration(final YamlProxyServerConfiguration serverConfig)
{
+
serverConfig.getRules().removeIf(YamlGlobalRuleConfiguration.class::isInstance);
+ if (null != serverConfig.getAuthority()) {
+ serverConfig.getRules().add(serverConfig.getAuthority());
}
- if (null != serverConfiguration.getTransaction()) {
-
serverConfiguration.getRules().add(serverConfiguration.getTransaction());
+ if (null != serverConfig.getTransaction()) {
+ serverConfig.getRules().add(serverConfig.getTransaction());
}
- if (null != serverConfiguration.getGlobalClock()) {
-
serverConfiguration.getRules().add(serverConfiguration.getGlobalClock());
+ if (null != serverConfig.getGlobalClock()) {
+ serverConfig.getRules().add(serverConfig.getGlobalClock());
}
- if (null != serverConfiguration.getSqlParser()) {
-
serverConfiguration.getRules().add(serverConfiguration.getSqlParser());
+ if (null != serverConfig.getSqlParser()) {
+ serverConfig.getRules().add(serverConfig.getSqlParser());
}
- if (null != serverConfiguration.getSqlTranslator()) {
-
serverConfiguration.getRules().add(serverConfiguration.getSqlTranslator());
+ if (null != serverConfig.getSqlTranslator()) {
+ serverConfig.getRules().add(serverConfig.getSqlTranslator());
}
- if (null != serverConfiguration.getTraffic()) {
-
serverConfiguration.getRules().add(serverConfiguration.getTraffic());
+ if (null != serverConfig.getTraffic()) {
+ serverConfig.getRules().add(serverConfig.getTraffic());
}
- if (null != serverConfiguration.getLogging()) {
-
serverConfiguration.getRules().add(serverConfiguration.getLogging());
+ if (null != serverConfig.getLogging()) {
+ serverConfig.getRules().add(serverConfig.getLogging());
}
- if (null != serverConfiguration.getSqlFederation()) {
-
serverConfiguration.getRules().add(serverConfiguration.getSqlFederation());
+ if (null != serverConfig.getSqlFederation()) {
+ serverConfig.getRules().add(serverConfig.getSqlFederation());
}
- return serverConfiguration;
+ return serverConfig;
}
private static Collection<YamlProxyDatabaseConfiguration>
loadDatabaseConfigurations(final File configPath) throws IOException {
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/EncryptRuleConfigurationImportChecker.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/EncryptRuleConfigurationImportChecker.java
index c71c13989bd..14276498b05 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/EncryptRuleConfigurationImportChecker.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/EncryptRuleConfigurationImportChecker.java
@@ -65,15 +65,15 @@ public final class EncryptRuleConfigurationImportChecker {
currentRuleConfig.getEncryptors().values().forEach(each ->
TypedSPILoader.checkService(EncryptAlgorithm.class, each.getType(),
each.getProps()));
}
- private void checkTableEncryptorsExisted(final EncryptRuleConfiguration
configuration, final String databaseName) {
+ private void checkTableEncryptorsExisted(final EncryptRuleConfiguration
config, final String databaseName) {
Collection<EncryptColumnRuleConfiguration> columns = new
LinkedList<>();
- configuration.getTables().forEach(each ->
columns.addAll(each.getColumns()));
+ config.getTables().forEach(each -> columns.addAll(each.getColumns()));
Collection<String> notExistedEncryptors =
columns.stream().map(optional ->
optional.getCipher().getEncryptorName()).collect(Collectors.toList());
notExistedEncryptors.addAll(
columns.stream().map(optional ->
optional.getLikeQuery().map(EncryptColumnItemRuleConfiguration::getEncryptorName).orElse(null)).filter(Objects::nonNull).collect(Collectors.toList()));
notExistedEncryptors.addAll(columns.stream().map(optional ->
optional.getAssistedQuery().map(EncryptColumnItemRuleConfiguration::getEncryptorName).orElse(null)).filter(Objects::nonNull)
.collect(Collectors.toList()));
- Collection<String> encryptors = configuration.getEncryptors().keySet();
+ Collection<String> encryptors = config.getEncryptors().keySet();
notExistedEncryptors.removeIf(encryptors::contains);
ShardingSpherePreconditions.checkState(notExistedEncryptors.isEmpty(),
() -> new MissingRequiredAlgorithmException(databaseName,
notExistedEncryptors));
}
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
index 9a88ef900fa..ae85c48001e 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/storage/unit/ShowStorageUnitExecutor.java
@@ -80,11 +80,11 @@ public final class ShowStorageUnitExecutor implements
RQLExecutor<ShowStorageUni
return result;
}
- private Map<String, Object> getCustomProps(final Map<String, Object>
customProperties, final Properties queryProperties) {
- Map<String, Object> result = new
LinkedHashMap<>(customProperties.size() + 1, 1F);
- result.putAll(customProperties);
- if (!queryProperties.isEmpty()) {
- result.put("queryProperties", queryProperties);
+ private Map<String, Object> getCustomProps(final Map<String, Object>
customProps, final Properties queryProps) {
+ Map<String, Object> result = new LinkedHashMap<>(customProps.size() +
1, 1F);
+ result.putAll(customProps);
+ if (!queryProps.isEmpty()) {
+ result.put("queryProperties", queryProps);
}
return result;
}
@@ -117,8 +117,8 @@ public final class ShowStorageUnitExecutor implements
RQLExecutor<ShowStorageUni
DataSourcePoolProperties result =
getDataSourcePoolProperties(dataSource);
DialectDatabaseMetaData dialectDatabaseMetaData = new
DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData();
if (dialectDatabaseMetaData.isInstanceConnectionAvailable() &&
propsMap.containsKey(storageUnitName)) {
- DataSourcePoolProperties unitDataSourcePoolProperties =
propsMap.get(storageUnitName);
- for (Entry<String, Object> entry :
unitDataSourcePoolProperties.getPoolPropertySynonyms().getStandardProperties().entrySet())
{
+ DataSourcePoolProperties unitDataSourcePoolProps =
propsMap.get(storageUnitName);
+ for (Entry<String, Object> entry :
unitDataSourcePoolProps.getPoolPropertySynonyms().getStandardProperties().entrySet())
{
if (null != entry.getValue()) {
result.getPoolPropertySynonyms().getStandardProperties().put(entry.getKey(),
entry.getValue());
}
diff --git
a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
index 5060e3e217e..f747a844172 100644
---
a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
+++
b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/connector/HBaseConnectionFactory.java
@@ -44,12 +44,12 @@ public final class HBaseConnectionFactory {
/**
* Create HBase connection.
*
- * @param yamlProxyHBaseConfiguration HBase configuration
+ * @param yamlProxyHBaseConfig YAML HBase configuration
* @return A connection for per HBase cluster
*/
- public static Map<String, Connection> createHBaseConnections(final
YamlHBaseConfiguration yamlProxyHBaseConfiguration) {
- Map<String, Connection> result = new
LinkedHashMap<>(yamlProxyHBaseConfiguration.getDataSources().size(), 1F);
- for (Entry<String, YamlHBaseParameter> entry :
yamlProxyHBaseConfiguration.getDataSources().entrySet()) {
+ public static Map<String, Connection> createHBaseConnections(final
YamlHBaseConfiguration yamlProxyHBaseConfig) {
+ Map<String, Connection> result = new
LinkedHashMap<>(yamlProxyHBaseConfig.getDataSources().size(), 1F);
+ for (Entry<String, YamlHBaseParameter> entry :
yamlProxyHBaseConfig.getDataSources().entrySet()) {
result.put(entry.getKey(), createConnection(entry.getValue()));
}
return result;
diff --git
a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussAdminExecutorFactoryTest.java
b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussAdminExecutorFactoryTest.java
index d91be4b745d..c7e300d9e58 100644
---
a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussAdminExecutorFactoryTest.java
+++
b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussAdminExecutorFactoryTest.java
@@ -43,21 +43,21 @@ import static org.mockito.Mockito.when;
class OpenGaussAdminExecutorFactoryTest {
@Mock
- private PostgreSQLAdminExecutorCreator postgreSQLAdminExecutorFactory;
+ private PostgreSQLAdminExecutorCreator postgresqlAdminExecutorFactory;
private OpenGaussAdminExecutorCreator openGaussAdminExecutorFactory;
@BeforeEach
void setup() throws ReflectiveOperationException {
openGaussAdminExecutorFactory = new OpenGaussAdminExecutorCreator();
-
Plugins.getMemberAccessor().set(OpenGaussAdminExecutorCreator.class.getDeclaredField("delegated"),
openGaussAdminExecutorFactory, postgreSQLAdminExecutorFactory);
+
Plugins.getMemberAccessor().set(OpenGaussAdminExecutorCreator.class.getDeclaredField("delegated"),
openGaussAdminExecutorFactory, postgresqlAdminExecutorFactory);
}
@Test
void assertNewInstanceWithSQLStatementContextOnly() {
SQLStatementContext sqlStatementContext =
mock(SQLStatementContext.class);
DatabaseAdminExecutor expected = mock(DatabaseAdminExecutor.class);
-
when(postgreSQLAdminExecutorFactory.create(sqlStatementContext)).thenReturn(Optional.of(expected));
+
when(postgresqlAdminExecutorFactory.create(sqlStatementContext)).thenReturn(Optional.of(expected));
Optional<DatabaseAdminExecutor> actual =
openGaussAdminExecutorFactory.create(sqlStatementContext);
assertTrue(actual.isPresent());
assertThat(actual.get(), is(expected));
@@ -80,7 +80,7 @@ class OpenGaussAdminExecutorFactoryTest {
SQLStatementContext sqlStatementContext =
mock(SQLStatementContext.class, RETURNS_DEEP_STUBS);
when(sqlStatementContext.getTablesContext().getTableNames()).thenReturn(Collections.emptyList());
DatabaseAdminExecutor expected = mock(DatabaseAdminExecutor.class);
- when(postgreSQLAdminExecutorFactory.create(sqlStatementContext, "",
"", Collections.emptyList())).thenReturn(Optional.of(expected));
+ when(postgresqlAdminExecutorFactory.create(sqlStatementContext, "",
"", Collections.emptyList())).thenReturn(Optional.of(expected));
Optional<DatabaseAdminExecutor> actual =
openGaussAdminExecutorFactory.create(sqlStatementContext, "", "",
Collections.emptyList());
assertTrue(actual.isPresent());
assertThat(actual.get(), is(expected));
diff --git
a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java
b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java
index 6f50069a04b..4a5749b1734 100644
---
a/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java
+++
b/proxy/backend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/backend/opengauss/handler/admin/OpenGaussSystemCatalogAdminQueryExecutorTest.java
@@ -77,16 +77,16 @@ class OpenGaussSystemCatalogAdminQueryExecutorTest {
void assertExecuteSelectFromPgDatabase() throws SQLException {
when(ProxyContext.getInstance()).thenReturn(mock(ProxyContext.class,
RETURNS_DEEP_STUBS));
when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Arrays.asList("foo",
"bar", "sharding_db", "other_db"));
- ConfigurationProperties properties = new ConfigurationProperties(new
Properties());
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(properties);
+ ConfigurationProperties props = new ConfigurationProperties(new
Properties());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(props);
ConnectionSession connectionSession = mock(ConnectionSession.class);
when(connectionSession.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class,
"openGauss"));
Map<String, ShardingSphereDatabase> databases =
createShardingSphereDatabaseMap();
- SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases,
properties);
+ SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, props);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(mock(RuleMetaData.class));
OpenGaussSelectStatement sqlStatement =
createSelectStatementForPgDatabase();
ShardingSphereMetaData metaData =
- new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), properties);
+ new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), props);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData);
SelectStatementContext sqlStatementContext = new
SelectStatementContext(metaData, Collections.emptyList(), sqlStatement,
"sharding_db");
OpenGaussSystemCatalogAdminQueryExecutor executor = new
OpenGaussSystemCatalogAdminQueryExecutor(sqlStatementContext,
@@ -143,13 +143,13 @@ class OpenGaussSystemCatalogAdminQueryExecutorTest {
when(ProxyContext.getInstance()).thenReturn(mock(ProxyContext.class,
RETURNS_DEEP_STUBS));
RuleMetaData ruleMetaData = mock(RuleMetaData.class);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(ruleMetaData);
- ConfigurationProperties properties = new ConfigurationProperties(new
Properties());
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(properties);
+ ConfigurationProperties props = new ConfigurationProperties(new
Properties());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(props);
Map<String, ShardingSphereDatabase> databases =
createShardingSphereDatabaseMap();
- SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases,
properties);
+ SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, props);
OpenGaussSelectStatement sqlStatement =
createSelectStatementForVersion();
ShardingSphereMetaData metaData =
- new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), properties);
+ new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), props);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData);
SelectStatementContext sqlStatementContext = new
SelectStatementContext(metaData, Collections.emptyList(), sqlStatement,
"sharding_db");
OpenGaussSystemCatalogAdminQueryExecutor executor =
@@ -177,13 +177,13 @@ class OpenGaussSystemCatalogAdminQueryExecutorTest {
when(ProxyContext.getInstance()).thenReturn(mock(ProxyContext.class,
RETURNS_DEEP_STUBS));
RuleMetaData ruleMetaData = mock(RuleMetaData.class);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(ruleMetaData);
- ConfigurationProperties properties = new ConfigurationProperties(new
Properties());
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(properties);
+ ConfigurationProperties props = new ConfigurationProperties(new
Properties());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(props);
Map<String, ShardingSphereDatabase> databases =
createShardingSphereDatabaseMap();
- SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases,
properties);
+ SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, props);
OpenGaussSelectStatement sqlStatement =
createSelectStatementForGsPasswordDeadlineAndIntervalToNum();
ShardingSphereMetaData metaData =
- new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), properties);
+ new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), props);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData);
SelectStatementContext sqlStatementContext = new
SelectStatementContext(metaData, Collections.emptyList(), sqlStatement,
"sharding_db");
OpenGaussSystemCatalogAdminQueryExecutor executor =
@@ -213,13 +213,13 @@ class OpenGaussSystemCatalogAdminQueryExecutorTest {
when(ProxyContext.getInstance()).thenReturn(mock(ProxyContext.class,
RETURNS_DEEP_STUBS));
RuleMetaData ruleMetaData = mock(RuleMetaData.class);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(ruleMetaData);
- ConfigurationProperties properties = new ConfigurationProperties(new
Properties());
-
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(properties);
+ ConfigurationProperties props = new ConfigurationProperties(new
Properties());
+
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps()).thenReturn(props);
Map<String, ShardingSphereDatabase> databases =
createShardingSphereDatabaseMap();
- SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases,
properties);
+ SQLFederationRule sqlFederationRule = new SQLFederationRule(new
SQLFederationRuleConfiguration(false, new CacheOption(1, 1)), databases, props);
OpenGaussSelectStatement sqlStatement =
createSelectStatementForGsPasswordNotifyTime();
ShardingSphereMetaData metaData =
- new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), properties);
+ new ShardingSphereMetaData(databases,
mock(ResourceMetaData.class, RETURNS_DEEP_STUBS), new
RuleMetaData(Collections.singletonList(sqlFederationRule)), props);
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData()).thenReturn(metaData);
SelectStatementContext sqlStatementContext = new
SelectStatementContext(metaData, Collections.emptyList(), sqlStatement,
"sharding_db");
OpenGaussSystemCatalogAdminQueryExecutor executor =
diff --git
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
index e95d339d428..cfe4e6067b0 100644
---
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
+++
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngine.java
@@ -34,7 +34,7 @@ import
org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngi
public final class OpenGaussFrontendEngine implements
DatabaseProtocolFrontendEngine {
@Getter(AccessLevel.NONE)
- private final PostgreSQLFrontendEngine postgreSQLFrontendEngine = new
PostgreSQLFrontendEngine();
+ private final PostgreSQLFrontendEngine postgresqlFrontendEngine = new
PostgreSQLFrontendEngine();
private final OpenGaussAuthenticationEngine authenticationEngine = new
OpenGaussAuthenticationEngine();
@@ -44,7 +44,7 @@ public final class OpenGaussFrontendEngine implements
DatabaseProtocolFrontendEn
@Override
public void release(final ConnectionSession connectionSession) {
- postgreSQLFrontendEngine.release(connectionSession);
+ postgresqlFrontendEngine.release(connectionSession);
}
@Override
diff --git
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/OpenGaussCommandExecuteEngine.java
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/OpenGaussCommandExecuteEngine.java
index 8191043b464..5f4b84e0303 100644
---
a/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/OpenGaussCommandExecuteEngine.java
+++
b/proxy/frontend/type/opengauss/src/main/java/org/apache/shardingsphere/proxy/frontend/opengauss/command/OpenGaussCommandExecuteEngine.java
@@ -48,7 +48,7 @@ import java.util.Optional;
*/
public final class OpenGaussCommandExecuteEngine implements
CommandExecuteEngine {
- private final PostgreSQLCommandExecuteEngine
postgreSQLCommandExecuteEngine = new PostgreSQLCommandExecuteEngine();
+ private final PostgreSQLCommandExecuteEngine
postgresqlCommandExecuteEngine = new PostgreSQLCommandExecuteEngine();
@Override
public CommandPacketType getCommandPacketType(final PacketPayload payload)
{
@@ -75,12 +75,12 @@ public final class OpenGaussCommandExecuteEngine implements
CommandExecuteEngine
@Override
public Optional<DatabasePacket> getOtherPacket(final ConnectionSession
connectionSession) {
- return
postgreSQLCommandExecuteEngine.getOtherPacket(connectionSession);
+ return
postgresqlCommandExecuteEngine.getOtherPacket(connectionSession);
}
@Override
public void writeQueryData(final ChannelHandlerContext context,
final ProxyDatabaseConnectionManager
databaseConnectionManager, final QueryCommandExecutor queryCommandExecutor,
final int headerPackagesCount) throws SQLException {
- postgreSQLCommandExecuteEngine.writeQueryData(context,
databaseConnectionManager, queryCommandExecutor, headerPackagesCount);
+ postgresqlCommandExecuteEngine.writeQueryData(context,
databaseConnectionManager, queryCommandExecutor, headerPackagesCount);
}
}
diff --git
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
index 51ebaff8c06..ee6411f43ec 100644
---
a/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
+++
b/proxy/frontend/type/opengauss/src/test/java/org/apache/shardingsphere/proxy/frontend/opengauss/OpenGaussFrontendEngineTest.java
@@ -44,7 +44,7 @@ class OpenGaussFrontendEngineTest {
@BeforeEach
void setup() throws ReflectiveOperationException {
-
Plugins.getMemberAccessor().set(OpenGaussFrontendEngine.class.getDeclaredField("postgreSQLFrontendEngine"),
openGaussFrontendEngine, mockPostgreSQLFrontendEngine);
+
Plugins.getMemberAccessor().set(OpenGaussFrontendEngine.class.getDeclaredField("postgresqlFrontendEngine"),
openGaussFrontendEngine, mockPostgreSQLFrontendEngine);
}
@Test
diff --git
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
index 288fa6f5aee..e86e0a3dc51 100644
---
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
+++
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
@@ -167,8 +167,8 @@ public enum PostgreSQLCommand {
return result.map(CachedResult::new).orElse(CachedResult.EMPTY);
}
- private static boolean matches(final Class<? extends SQLStatement>
sqlStatementClass, final PostgreSQLCommand postgreSQLCommand) {
- return postgreSQLCommand.sqlStatementClasses.stream().anyMatch(each ->
each.isAssignableFrom(sqlStatementClass));
+ private static boolean matches(final Class<? extends SQLStatement>
sqlStatementClass, final PostgreSQLCommand command) {
+ return command.sqlStatementClasses.stream().anyMatch(each ->
each.isAssignableFrom(sqlStatementClass));
}
@RequiredArgsConstructor
diff --git
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
index 6e21dc60f61..60233dfdc7b 100644
---
a/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
+++
b/proxy/frontend/type/postgresql/src/test/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLBatchedStatementsExecutorTest.java
@@ -94,12 +94,12 @@ class PostgreSQLBatchedStatementsExecutorTest {
.thenReturn(preparedStatement);
ContextManager contextManager = mockContextManager();
ConnectionSession connectionSession = mockConnectionSession();
- PostgreSQLServerPreparedStatement postgreSQLPreparedStatement = new
PostgreSQLServerPreparedStatement("insert into t (id, col) values (?, ?)",
mockInsertStatementContext(),
+ PostgreSQLServerPreparedStatement postgresqlPreparedStatement = new
PostgreSQLServerPreparedStatement("insert into t (id, col) values (?, ?)",
mockInsertStatementContext(),
new HintValueContext(),
Arrays.asList(PostgreSQLColumnType.INT4, PostgreSQLColumnType.VARCHAR),
Arrays.asList(0, 1));
List<List<Object>> parameterSets = Arrays.asList(Arrays.asList(1, new
PostgreSQLTypeUnspecifiedSQLParameter("foo")),
Arrays.asList(2, new
PostgreSQLTypeUnspecifiedSQLParameter("bar")), Arrays.asList(3, new
PostgreSQLTypeUnspecifiedSQLParameter("baz")));
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
- PostgreSQLBatchedStatementsExecutor actual = new
PostgreSQLBatchedStatementsExecutor(connectionSession,
postgreSQLPreparedStatement, parameterSets);
+ PostgreSQLBatchedStatementsExecutor actual = new
PostgreSQLBatchedStatementsExecutor(connectionSession,
postgresqlPreparedStatement, parameterSets);
prepareExecutionUnitParameters(actual, parameterSets);
int actualUpdated = actual.executeBatch();
assertThat(actualUpdated, is(3));
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
index c89ebed56ff..b4019af1311 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
@@ -37,21 +37,21 @@ public final class StorageContainerFactory {
*
* @param databaseType database type
* @param storageContainerImage storage container image
- * @param storageContainerConfiguration storage container configuration
+ * @param storageContainerConfig storage container configuration
* @return created instance
* @throws RuntimeException runtime exception
*/
public static StorageContainer newInstance(final DatabaseType
databaseType, final String storageContainerImage,
- final
StorageContainerConfiguration storageContainerConfiguration) {
+ final
StorageContainerConfiguration storageContainerConfig) {
switch (databaseType.getType()) {
case "MySQL":
- return new MySQLContainer(storageContainerImage,
storageContainerConfiguration);
+ return new MySQLContainer(storageContainerImage,
storageContainerConfig);
case "PostgreSQL":
- return new PostgreSQLContainer(storageContainerImage,
storageContainerConfiguration);
+ return new PostgreSQLContainer(storageContainerImage,
storageContainerConfig);
case "openGauss":
- return new OpenGaussContainer(storageContainerImage,
storageContainerConfiguration);
+ return new OpenGaussContainer(storageContainerImage,
storageContainerConfig);
case "H2":
- return new H2Container(storageContainerConfiguration);
+ return new H2Container(storageContainerConfig);
default:
throw new RuntimeException(String.format("Database `%s` is
unknown.", databaseType.getType()));
}
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/H2Container.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/H2Container.java
index 7bdd5934f00..9282f4fe141 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/H2Container.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/impl/H2Container.java
@@ -41,9 +41,9 @@ public final class H2Container extends
EmbeddedStorageContainer {
private final ScenarioDataPath scenarioDataPath;
- public H2Container(final StorageContainerConfiguration
storageContainerConfiguration) {
- super(TypedSPILoader.getService(DatabaseType.class, "H2"),
storageContainerConfiguration.getScenario());
- scenarioDataPath = new
ScenarioDataPath(storageContainerConfiguration.getScenario());
+ public H2Container(final StorageContainerConfiguration
storageContainerConfig) {
+ super(TypedSPILoader.getService(DatabaseType.class, "H2"),
storageContainerConfig.getScenario());
+ scenarioDataPath = new
ScenarioDataPath(storageContainerConfig.getScenario());
}
@Override
diff --git
a/test/util/src/main/java/org/apache/shardingsphere/test/util/PropertiesBuilder.java
b/test/util/src/main/java/org/apache/shardingsphere/test/util/PropertiesBuilder.java
index 2c7f4655fb5..0f879bf1848 100644
---
a/test/util/src/main/java/org/apache/shardingsphere/test/util/PropertiesBuilder.java
+++
b/test/util/src/main/java/org/apache/shardingsphere/test/util/PropertiesBuilder.java
@@ -32,12 +32,12 @@ public final class PropertiesBuilder {
/**
* Build properties.
*
- * @param properties to be built properties
+ * @param props to be built properties
* @return built properties
*/
- public static Properties build(final Property... properties) {
+ public static Properties build(final Property... props) {
Properties result = new Properties();
- for (Property each : properties) {
+ for (Property each : props) {
result.setProperty(each.key, each.value);
}
return result;