You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2023/03/24 14:28:29 UTC
[shardingsphere] branch master updated: Rename xxUtil to xxUtils (#24812)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 a68c3f550b4 Rename xxUtil to xxUtils (#24812)
a68c3f550b4 is described below
commit a68c3f550b4cebfe35a1e5d5b4c180e74eca7e35
Author: yx9o <ya...@163.com>
AuthorDate: Fri Mar 24 22:28:11 2023 +0800
Rename xxUtil to xxUtils (#24812)
---
.../AgentReflectionUtils.java} | 6 ++---
.../AgentReflectionUtilsTest.java} | 10 ++++----
.../{util => utils}/MethodTimeRecorderTest.java | 2 +-
.../{util => utils}/fixture/ReflectionFixture.java | 2 +-
.../impl/jdbc/JDBCMetaDataInfoExporter.java | 10 ++++----
.../core/exporter/impl/jdbc/JDBCStateExporter.java | 8 +++---
.../advice/TracingJDBCExecutorCallbackAdvice.java | 6 ++---
.../value/time/MySQLDateBinlogProtocolValue.java | 2 +-
.../time/MySQLDatetime2BinlogProtocolValue.java | 2 +-
.../time/MySQLDatetimeBinlogProtocolValue.java | 2 +-
.../value/time/MySQLTime2BinlogProtocolValue.java | 2 +-
.../value/time/MySQLTimeBinlogProtocolValue.java | 2 +-
...TimeValueUtil.java => MySQLTimeValueUtils.java} | 4 +--
.../time/MySQLTimestamp2BinlogProtocolValue.java | 2 +-
.../time/MySQLTimestampBinlogProtocolValue.java | 2 +-
.../value/time/MySQLYearBinlogProtocolValue.java | 2 +-
.../time/MySQLDateBinlogProtocolValueTest.java | 2 +-
.../MySQLDatetime2BinlogProtocolValueTest.java | 2 +-
.../time/MySQLDatetimeBinlogProtocolValueTest.java | 2 +-
.../time/MySQLTime2BinlogProtocolValueTest.java | 2 +-
.../time/MySQLTimeBinlogProtocolValueTest.java | 2 +-
...eUtilTest.java => MySQLTimeValueUtilsTest.java} | 4 +--
.../MySQLTimestamp2BinlogProtocolValueTest.java | 2 +-
.../MySQLTimestampBinlogProtocolValueTest.java | 4 +--
.../time/MySQLYearBinlogProtocolValueTest.java | 2 +-
.../repository/cluster/nacos/NacosRepository.java | 30 +++++++++++-----------
.../nacos/listener/NamingEventListener.java | 20 +++++++--------
...osMetaDataUtil.java => NacosMetaDataUtils.java} | 4 +--
.../cluster/nacos/NacosRepositoryTest.java | 20 +++++++--------
.../proxy/backend/connector/BackendConnection.java | 4 +--
.../ral/queryable/ShowDistVariableExecutor.java | 4 +--
.../ral/queryable/ShowDistVariablesExecutor.java | 4 +--
.../ral/updatable/SetDistVariableUpdater.java | 4 +--
.../distsql/rql/rule/ShowLogicalTableExecutor.java | 4 +--
.../distsql/rql/rule/ShowSingleTableExecutor.java | 4 +--
.../handler/transaction/TransactionSetHandler.java | 6 ++---
.../util/{RegularUtil.java => RegularUtils.java} | 2 +-
...mPropertyUtil.java => SystemPropertyUtils.java} | 2 +-
...{TransactionUtil.java => TransactionUtils.java} | 4 +--
.../backend/connector/BackendConnectionTest.java | 12 ++++-----
...onnectionUtil.java => MockConnectionUtils.java} | 4 +--
.../queryable/ShowDistVariableExecutorTest.java | 4 +--
...DistVariableUpdatableRALBackendHandlerTest.java | 8 +++---
.../ral/updatable/SetDistVariableUpdaterTest.java | 4 +--
...{RegularUtilTest.java => RegularUtilsTest.java} | 8 +++---
...yUtilTest.java => SystemPropertyUtilsTest.java} | 8 +++---
.../HeterogeneousSelectStatementChecker.java | 4 +--
.../type/HBaseSelectOperationConverter.java | 6 ++---
.../HBaseHeterogeneousUtils.java} | 6 ++---
.../HBaseHeterogeneousUtilsTest.java} | 6 ++---
.../handler/admin/executor/ShowTablesExecutor.java | 4 +--
51 files changed, 136 insertions(+), 136 deletions(-)
diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtil.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtils.java
similarity index 96%
rename from agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtil.java
rename to agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtils.java
index e1a53eaa349..18061f0f395 100644
--- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtil.java
+++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtils.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.plugin.core.util;
+package org.apache.shardingsphere.agent.plugin.core.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -26,10 +26,10 @@ import java.lang.reflect.Method;
import java.util.Optional;
/**
- * Agent reflection utility.
+ * Agent reflection utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class AgentReflectionUtil {
+public final class AgentReflectionUtils {
/**
* Get field value.
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtilsTest.java
similarity index 71%
rename from agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java
rename to agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtilsTest.java
index 20904dfbef1..8861f20547f 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtilTest.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/AgentReflectionUtilsTest.java
@@ -15,24 +15,24 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.plugin.core.util;
+package org.apache.shardingsphere.agent.plugin.core.utils;
-import org.apache.shardingsphere.agent.plugin.core.util.fixture.ReflectionFixture;
+import org.apache.shardingsphere.agent.plugin.core.utils.fixture.ReflectionFixture;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public final class AgentReflectionUtilTest {
+public final class AgentReflectionUtilsTest {
@Test
public void assertGetFieldValue() {
ReflectionFixture reflectionFixture = new ReflectionFixture("foo");
- assertThat(AgentReflectionUtil.getFieldValue(reflectionFixture, "value"), is(reflectionFixture.getValue()));
+ assertThat(AgentReflectionUtils.getFieldValue(reflectionFixture, "value"), is(reflectionFixture.getValue()));
}
@Test
public void assertInvokeMethod() throws NoSuchMethodException {
- assertThat(AgentReflectionUtil.invokeMethod(ReflectionFixture.class.getDeclaredMethod("call"), new ReflectionFixture("foo")), is("foo"));
+ assertThat(AgentReflectionUtils.invokeMethod(ReflectionFixture.class.getDeclaredMethod("call"), new ReflectionFixture("foo")), is("foo"));
}
}
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/MethodTimeRecorderTest.java
similarity index 96%
rename from agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java
rename to agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/MethodTimeRecorderTest.java
index 61af0382211..167490d8487 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/MethodTimeRecorderTest.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/MethodTimeRecorderTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.plugin.core.util;
+package org.apache.shardingsphere.agent.plugin.core.utils;
import org.apache.shardingsphere.agent.api.advice.AgentAdvice;
import org.apache.shardingsphere.agent.plugin.core.recorder.MethodTimeRecorder;
diff --git a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/fixture/ReflectionFixture.java b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/fixture/ReflectionFixture.java
similarity index 94%
rename from agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/fixture/ReflectionFixture.java
rename to agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/fixture/ReflectionFixture.java
index ef94178b181..328d261fad5 100644
--- a/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/util/fixture/ReflectionFixture.java
+++ b/agent/plugins/core/src/test/java/org/apache/shardingsphere/agent/plugin/core/utils/fixture/ReflectionFixture.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.agent.plugin.core.util.fixture;
+package org.apache.shardingsphere.agent.plugin.core.utils.fixture;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java
index 1c66e0c9644..9c42d2637d3 100644
--- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java
+++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCMetaDataInfoExporter.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.jdbc;
-import org.apache.shardingsphere.agent.plugin.core.util.AgentReflectionUtil;
+import org.apache.shardingsphere.agent.plugin.core.utils.AgentReflectionUtils;
import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
@@ -54,12 +54,12 @@ public final class JDBCMetaDataInfoExporter implements MetricsExporter {
}
GaugeMetricFamilyMetricsCollector result = MetricsCollectorRegistry.get(config, pluginType);
result.cleanMetrics();
- DriverDataSourceCache dataSourceCache = AgentReflectionUtil.getFieldValue(shardingSphereDriverOptional.get(), "dataSourceCache");
- Map<String, DataSource> dataSourceMap = AgentReflectionUtil.getFieldValue(dataSourceCache, "dataSourceMap");
+ DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(shardingSphereDriverOptional.get(), "dataSourceCache");
+ Map<String, DataSource> dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap");
for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
ShardingSphereDataSource shardingSphereDataSource = (ShardingSphereDataSource) entry.getValue();
- String databaseName = AgentReflectionUtil.getFieldValue(shardingSphereDataSource, "databaseName");
- ContextManager contextManager = AgentReflectionUtil.getFieldValue(shardingSphereDataSource, "contextManager");
+ String databaseName = AgentReflectionUtils.getFieldValue(shardingSphereDataSource, "databaseName");
+ ContextManager contextManager = AgentReflectionUtils.getFieldValue(shardingSphereDataSource, "contextManager");
result.addMetric(Arrays.asList(databaseName, "storage_unit_count"), contextManager.getDataSourceMap(databaseName).size());
}
return Optional.of(result);
diff --git a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java
index 072d8f41e3f..6b1496c32e6 100644
--- a/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java
+++ b/agent/plugins/metrics/core/src/main/java/org/apache/shardingsphere/agent/plugin/metrics/core/exporter/impl/jdbc/JDBCStateExporter.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.agent.plugin.metrics.core.exporter.impl.jdbc;
-import org.apache.shardingsphere.agent.plugin.core.util.AgentReflectionUtil;
+import org.apache.shardingsphere.agent.plugin.core.utils.AgentReflectionUtils;
import org.apache.shardingsphere.agent.plugin.metrics.core.collector.MetricsCollectorRegistry;
import org.apache.shardingsphere.agent.plugin.metrics.core.collector.type.GaugeMetricFamilyMetricsCollector;
import org.apache.shardingsphere.agent.plugin.metrics.core.config.MetricCollectorType;
@@ -51,11 +51,11 @@ public final class JDBCStateExporter implements MetricsExporter {
}
GaugeMetricFamilyMetricsCollector result = MetricsCollectorRegistry.get(config, pluginType);
result.cleanMetrics();
- DriverDataSourceCache dataSourceCache = AgentReflectionUtil.getFieldValue(shardingSphereDriverOptional.get(), "dataSourceCache");
- Map<String, DataSource> dataSourceMap = AgentReflectionUtil.getFieldValue(dataSourceCache, "dataSourceMap");
+ DriverDataSourceCache dataSourceCache = AgentReflectionUtils.getFieldValue(shardingSphereDriverOptional.get(), "dataSourceCache");
+ Map<String, DataSource> dataSourceMap = AgentReflectionUtils.getFieldValue(dataSourceCache, "dataSourceMap");
for (Map.Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
ShardingSphereDataSource shardingSphereDataSource = (ShardingSphereDataSource) entry.getValue();
- ContextManager contextManager = AgentReflectionUtil.getFieldValue(shardingSphereDataSource, "contextManager");
+ ContextManager contextManager = AgentReflectionUtils.getFieldValue(shardingSphereDataSource, "contextManager");
result.addMetric(Collections.emptyList(), contextManager.getInstanceContext().getInstance().getState().getCurrentState().ordinal());
}
return Optional.of(result);
diff --git a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java
index 19e5b5ea253..a55ede986ff 100644
--- a/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java
+++ b/agent/plugins/tracing/core/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/core/advice/TracingJDBCExecutorCallbackAdvice.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.agent.plugin.tracing.core.advice;
import lombok.SneakyThrows;
import org.apache.shardingsphere.agent.api.advice.TargetAdviceObject;
import org.apache.shardingsphere.agent.api.advice.type.InstanceMethodAdvice;
-import org.apache.shardingsphere.agent.plugin.core.util.AgentReflectionUtil;
+import org.apache.shardingsphere.agent.plugin.core.utils.AgentReflectionUtils;
import org.apache.shardingsphere.agent.plugin.tracing.core.RootSpanContext;
import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -45,9 +45,9 @@ public abstract class TracingJDBCExecutorCallbackAdvice<T> implements InstanceMe
@SneakyThrows({ReflectiveOperationException.class, SQLException.class})
public final void beforeMethod(final TargetAdviceObject target, final Method method, final Object[] args, final String pluginType) {
JDBCExecutionUnit executionUnit = (JDBCExecutionUnit) args[0];
- Map<String, DatabaseType> storageTypes = AgentReflectionUtil.getFieldValue(target, "storageTypes");
+ Map<String, DatabaseType> storageTypes = AgentReflectionUtils.getFieldValue(target, "storageTypes");
DatabaseType storageType = storageTypes.get(executionUnit.getExecutionUnit().getDataSourceName());
- DataSourceMetaData metaData = AgentReflectionUtil.invokeMethod(
+ DataSourceMetaData metaData = AgentReflectionUtils.invokeMethod(
JDBCExecutorCallback.class.getDeclaredMethod("getDataSourceMetaData", DatabaseMetaData.class, DatabaseType.class),
target, executionUnit.getStorageResource().getConnection().getMetaData(), storageType);
recordExecuteInfo(RootSpanContext.get(), target, executionUnit, (boolean) args[1], metaData, storageType.getType());
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValue.java
index 5c5963360ec..bfa586d96f4 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValue.java
@@ -38,6 +38,6 @@ public final class MySQLDateBinlogProtocolValue implements MySQLBinlogProtocolVa
int year = date / 16 / 32;
int month = date / 32 % 16;
int day = date % 32;
- return 0 == date ? MySQLTimeValueUtil.ZERO_OF_DATE : Date.valueOf(LocalDate.of(year, month, day));
+ return 0 == date ? MySQLTimeValueUtils.ZERO_OF_DATE : Date.valueOf(LocalDate.of(year, month, day));
}
}
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java
index aeeb9bac3e0..20a5d511579 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValue.java
@@ -35,7 +35,7 @@ public final class MySQLDatetime2BinlogProtocolValue implements MySQLBinlogProto
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
long datetime = readDatetimeV2FromPayload(payload);
- return 0 == datetime ? MySQLTimeValueUtil.DATETIME_OF_ZERO : readDatetime(columnDef, datetime, payload);
+ return 0 == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDatetime(columnDef, datetime, payload);
}
private long readDatetimeV2FromPayload(final MySQLPacketPayload payload) {
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java
index fe8a10f4096..0def537b6f5 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValue.java
@@ -36,7 +36,7 @@ public final class MySQLDatetimeBinlogProtocolValue implements MySQLBinlogProtoc
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
long datetime = payload.readInt8();
- return 0 == datetime ? MySQLTimeValueUtil.DATETIME_OF_ZERO : readDateTime(datetime);
+ return 0 == datetime ? MySQLTimeValueUtils.DATETIME_OF_ZERO : readDateTime(datetime);
}
private Date readDateTime(final long datetime) {
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValue.java
index 8fa6d0bb66c..e1afa395e63 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValue.java
@@ -39,7 +39,7 @@ public final class MySQLTime2BinlogProtocolValue implements MySQLBinlogProtocolV
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int time = payload.getByteBuf().readUnsignedMedium();
if (0x800000 == time) {
- return MySQLTimeValueUtil.ZERO_OF_TIME;
+ return MySQLTimeValueUtils.ZERO_OF_TIME;
}
MySQLFractionalSeconds fractionalSeconds = new MySQLFractionalSeconds(columnDef.getColumnMeta(), payload);
int hour = (time >> 12) % (1 << 10);
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValue.java
index 4bc5de91c23..77b5faff689 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValue.java
@@ -38,7 +38,7 @@ public final class MySQLTimeBinlogProtocolValue implements MySQLBinlogProtocolVa
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int time = payload.getByteBuf().readUnsignedMediumLE();
if (0 == time) {
- return MySQLTimeValueUtil.ZERO_OF_TIME;
+ return MySQLTimeValueUtils.ZERO_OF_TIME;
}
int minuteSecond = Math.abs(time) % 10000;
return String.format("%02d:%02d:%02d", time / 10000, minuteSecond / 100, minuteSecond % 100);
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtil.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
similarity index 95%
rename from db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtil.java
rename to db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
index 749100d8555..860c34ecb3e 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtil.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtils.java
@@ -23,10 +23,10 @@ import lombok.NoArgsConstructor;
import java.text.SimpleDateFormat;
/**
- * Time value utility of MySQL.
+ * Time value utility class of MySQL.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class MySQLTimeValueUtil {
+public final class MySQLTimeValueUtils {
public static final String ZERO_OF_TIME = "00:00:00";
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValue.java
index ac6a8a8da04..8592fff05aa 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValue.java
@@ -35,7 +35,7 @@ public final class MySQLTimestamp2BinlogProtocolValue implements MySQLBinlogProt
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int seconds = payload.getByteBuf().readInt();
if (0 == seconds) {
- return MySQLTimeValueUtil.DATETIME_OF_ZERO;
+ return MySQLTimeValueUtils.DATETIME_OF_ZERO;
}
int nanos = columnDef.getColumnMeta() > 0 ? new MySQLFractionalSeconds(columnDef.getColumnMeta(), payload).getNanos() : 0;
Timestamp result = new Timestamp(seconds * 1000L);
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
index e8cfb54e7d0..d2c43b22df3 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
@@ -34,6 +34,6 @@ public final class MySQLTimestampBinlogProtocolValue implements MySQLBinlogProto
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int seconds = payload.readInt4();
- return 0 == seconds ? MySQLTimeValueUtil.DATETIME_OF_ZERO : MySQLTimeValueUtil.getSimpleDateFormat().format(new Timestamp(seconds * 1000L));
+ return 0 == seconds ? MySQLTimeValueUtils.DATETIME_OF_ZERO : MySQLTimeValueUtils.getSimpleDateFormat().format(new Timestamp(seconds * 1000L));
}
}
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValue.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValue.java
index 4e7e94d91cb..4e5f130e9f4 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValue.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValue.java
@@ -33,6 +33,6 @@ public final class MySQLYearBinlogProtocolValue implements MySQLBinlogProtocolVa
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int result = payload.readInt1();
- return 0 == result ? MySQLTimeValueUtil.YEAR_OF_ZERO : Integer.toString(result + 1900);
+ return 0 == result ? MySQLTimeValueUtils.YEAR_OF_ZERO : Integer.toString(result + 1900);
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
index ec748d3c2cb..3b4bdd29c97 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDateBinlogProtocolValueTest.java
@@ -56,6 +56,6 @@ public final class MySQLDateBinlogProtocolValueTest {
public void assertReadNullDate() {
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedMediumLE()).thenReturn(0);
- assertThat(new MySQLDateBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.ZERO_OF_DATE));
+ assertThat(new MySQLDateBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.ZERO_OF_DATE));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
index 5b9839927c8..defb2ed0c98 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetime2BinlogProtocolValueTest.java
@@ -87,6 +87,6 @@ public final class MySQLDatetime2BinlogProtocolValueTest {
@Test
public void assertReadNullTime() {
- assertThat(new MySQLDatetime2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.DATETIME_OF_ZERO));
+ assertThat(new MySQLDatetime2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.DATETIME_OF_ZERO));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
index f3189fdc5e2..8c729a639f1 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLDatetimeBinlogProtocolValueTest.java
@@ -50,6 +50,6 @@ public final class MySQLDatetimeBinlogProtocolValueTest {
@Test
public void assertReadNullTime() {
when(payload.readInt8()).thenReturn(0L);
- assertThat(new MySQLDatetimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.DATETIME_OF_ZERO));
+ assertThat(new MySQLDatetimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.DATETIME_OF_ZERO));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
index 4ffd8217727..434c0b396bc 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTime2BinlogProtocolValueTest.java
@@ -87,6 +87,6 @@ public final class MySQLTime2BinlogProtocolValueTest {
public void assertReadNullTime() {
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedMedium()).thenReturn(0x800000);
- assertThat(new MySQLTime2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.ZERO_OF_TIME));
+ assertThat(new MySQLTime2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.ZERO_OF_TIME));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
index a81e06dc70f..9e8998905d6 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeBinlogProtocolValueTest.java
@@ -52,6 +52,6 @@ public final class MySQLTimeBinlogProtocolValueTest {
public void assertReadNullTime() {
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedMediumLE()).thenReturn(0);
- assertThat(new MySQLTimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.ZERO_OF_TIME));
+ assertThat(new MySQLTimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.ZERO_OF_TIME));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
similarity index 86%
rename from db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
rename to db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
index 5d304af4553..284ab3257b3 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimeValueUtilsTest.java
@@ -24,11 +24,11 @@ import java.text.SimpleDateFormat;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public final class MySQLTimeValueUtilTest {
+public final class MySQLTimeValueUtilsTest {
@Test
public void assertGetSimpleDateFormat() {
Timestamp expected = new Timestamp(1584599445000L);
- assertThat(MySQLTimeValueUtil.getSimpleDateFormat().format(expected), is(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expected)));
+ assertThat(MySQLTimeValueUtils.getSimpleDateFormat().format(expected), is(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expected)));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
index 2c25aaafbea..64617ff3ad4 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestamp2BinlogProtocolValueTest.java
@@ -71,6 +71,6 @@ public final class MySQLTimestamp2BinlogProtocolValueTest {
@Test
public void assertReadNullTime() {
when(byteBuf.readInt()).thenReturn(0);
- assertThat(new MySQLTimestamp2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.DATETIME_OF_ZERO));
+ assertThat(new MySQLTimestamp2BinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.DATETIME_OF_ZERO));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
index b21e75bb313..c58a428323e 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
@@ -43,12 +43,12 @@ public final class MySQLTimestampBinlogProtocolValueTest {
public void assertRead() {
int currentSeconds = Long.valueOf(System.currentTimeMillis() / 1000).intValue();
when(payload.readInt4()).thenReturn(currentSeconds);
- assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.getSimpleDateFormat().format(new Timestamp(currentSeconds * 1000L))));
+ assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.getSimpleDateFormat().format(new Timestamp(currentSeconds * 1000L))));
}
@Test
public void assertReadNullTime() {
when(payload.readInt4()).thenReturn(0);
- assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.DATETIME_OF_ZERO));
+ assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.DATETIME_OF_ZERO));
}
}
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
index 6be09ba3c96..cf599106f61 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLYearBinlogProtocolValueTest.java
@@ -46,6 +46,6 @@ public final class MySQLYearBinlogProtocolValueTest {
@Test
public void assertReadNullYear() {
when(payload.readInt1()).thenReturn(0);
- assertThat(new MySQLYearBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.YEAR_OF_ZERO));
+ assertThat(new MySQLYearBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.YEAR_OF_ZERO));
}
}
diff --git a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
index dc433ca27b7..65b70e0e35f 100644
--- a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
+++ b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java
@@ -39,7 +39,7 @@ import org.apache.shardingsphere.mode.repository.cluster.nacos.entity.ServiceMet
import org.apache.shardingsphere.mode.repository.cluster.nacos.listener.NamingEventListener;
import org.apache.shardingsphere.mode.repository.cluster.nacos.props.NacosProperties;
import org.apache.shardingsphere.mode.repository.cluster.nacos.props.NacosPropertyKey;
-import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtil;
+import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtils;
import java.util.Collection;
import java.util.Comparator;
@@ -152,9 +152,9 @@ public final class NacosRepository implements ClusterPersistRepository {
public String getDirectly(final String key) {
try {
for (ServiceMetaData each : serviceController.getAllServices()) {
- Optional<Instance> instance = findExistedInstance(key, each.isEphemeral()).stream().max(Comparator.comparing(NacosMetaDataUtil::getTimestamp));
+ Optional<Instance> instance = findExistedInstance(key, each.isEphemeral()).stream().max(Comparator.comparing(NacosMetaDataUtils::getTimestamp));
if (instance.isPresent()) {
- return NacosMetaDataUtil.getValue(instance.get());
+ return NacosMetaDataUtils.getValue(instance.get());
}
}
return null;
@@ -170,7 +170,7 @@ public final class NacosRepository implements ClusterPersistRepository {
for (ServiceMetaData each : serviceController.getAllServices()) {
Stream<String> keys = findExistedInstance(each.isEphemeral()).stream()
.map(instance -> {
- String fullPath = NacosMetaDataUtil.getKey(instance);
+ String fullPath = NacosMetaDataUtils.getKey(instance);
if (fullPath.startsWith(key + PATH_SEPARATOR)) {
String pathWithoutPrefix = fullPath.substring((key + PATH_SEPARATOR).length());
return pathWithoutPrefix.contains(PATH_SEPARATOR) ? pathWithoutPrefix.substring(0, pathWithoutPrefix.indexOf(PATH_SEPARATOR)) : pathWithoutPrefix;
@@ -194,7 +194,7 @@ public final class NacosRepository implements ClusterPersistRepository {
public void persist(final String key, final String value) {
try {
Preconditions.checkNotNull(value, "Value can not be null");
- Optional<Instance> instance = findExistedInstance(key, false).stream().max(Comparator.comparing(NacosMetaDataUtil::getTimestamp));
+ Optional<Instance> instance = findExistedInstance(key, false).stream().max(Comparator.comparing(NacosMetaDataUtils::getTimestamp));
if (instance.isPresent()) {
update(instance.get(), value);
} else {
@@ -212,9 +212,9 @@ public final class NacosRepository implements ClusterPersistRepository {
private void update(final Instance instance, final String value) throws NacosException {
Map<String, String> metaDataMap = instance.getMetadata();
- String key = NacosMetaDataUtil.getKey(instance);
+ String key = NacosMetaDataUtils.getKey(instance);
metaDataMap.put(key, value);
- metaDataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtil.getTimestamp()));
+ metaDataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtils.getTimestamp()));
instance.setMetadata(metaDataMap);
ServiceMetaData persistentService = serviceController.getPersistentService();
client.registerInstance(persistentService.getServiceName(), instance);
@@ -235,7 +235,7 @@ public final class NacosRepository implements ClusterPersistRepository {
fillEphemeralMetaData(metadataMap);
}
metadataMap.put(key, value);
- metadataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtil.getTimestamp()));
+ metadataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtils.getTimestamp()));
instance.setMetadata(metadataMap);
client.registerInstance(serviceMetaData.getServiceName(), instance);
keyValues.add(new KeyValue(key, value, ephemeral));
@@ -265,7 +265,7 @@ public final class NacosRepository implements ClusterPersistRepository {
instance.setEphemeral(false);
Map<String, String> metaDataMap = new HashMap<>(2, 1);
metaDataMap.put(key, "");
- metaDataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtil.getTimestamp()));
+ metaDataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(NacosMetaDataUtils.getTimestamp()));
instance.setMetadata(metaDataMap);
client.registerInstance(persistentService.getServiceName(), instance);
result.add(new KeyValue(key, "", false));
@@ -286,14 +286,14 @@ public final class NacosRepository implements ClusterPersistRepository {
for (ServiceMetaData each : serviceController.getAllServices()) {
Collection<Instance> instances = findExistedInstance(each.isEphemeral()).stream()
.filter(instance -> {
- String fullPath = NacosMetaDataUtil.getKey(instance);
+ String fullPath = NacosMetaDataUtils.getKey(instance);
return fullPath.startsWith(key + PATH_SEPARATOR) || StringUtils.equals(fullPath, key);
})
- .sorted(Comparator.comparing(NacosMetaDataUtil::getKey).reversed()).collect(Collectors.toList());
+ .sorted(Comparator.comparing(NacosMetaDataUtils::getKey).reversed()).collect(Collectors.toList());
Collection<KeyValue> keyValues = new LinkedList<>();
for (Instance instance : instances) {
client.deregisterInstance(each.getServiceName(), instance);
- keyValues.add(new KeyValue(NacosMetaDataUtil.getKey(instance), null, each.isEphemeral()));
+ keyValues.add(new KeyValue(NacosMetaDataUtils.getKey(instance), null, each.isEphemeral()));
}
waitValue(keyValues);
}
@@ -304,7 +304,7 @@ public final class NacosRepository implements ClusterPersistRepository {
private Collection<Instance> findExistedInstance(final String key, final boolean ephemeral) throws NacosException {
return client.getAllInstances(serviceController.getService(ephemeral).getServiceName(), false).stream()
- .filter(each -> Objects.equals(key, NacosMetaDataUtil.getKey(each))).collect(Collectors.toList());
+ .filter(each -> Objects.equals(key, NacosMetaDataUtils.getKey(each))).collect(Collectors.toList());
}
private Collection<Instance> findExistedInstance(final boolean ephemeral) throws NacosException {
@@ -330,11 +330,11 @@ public final class NacosRepository implements ClusterPersistRepository {
Map<Boolean, List<KeyValue>> keyValueMap = keyValues.stream().collect(Collectors.groupingBy(KeyValue::isEphemeral));
for (Entry<Boolean, List<KeyValue>> entry : keyValueMap.entrySet()) {
ServiceMetaData service = serviceController.getService(entry.getKey());
- Map<String, List<Instance>> instanceMap = client.getAllInstances(service.getServiceName(), false).stream().collect(Collectors.groupingBy(NacosMetaDataUtil::getKey));
+ Map<String, List<Instance>> instanceMap = client.getAllInstances(service.getServiceName(), false).stream().collect(Collectors.groupingBy(NacosMetaDataUtils::getKey));
keyValues.removeIf(keyValue -> {
Collection<Instance> instances = instanceMap.get(keyValue.getKey());
String value = keyValue.getValue();
- return CollectionUtils.isNotEmpty(instances) ? instances.stream().anyMatch(instance -> StringUtils.equals(NacosMetaDataUtil.getValue(instance), value)) : Objects.isNull(value);
+ return CollectionUtils.isNotEmpty(instances) ? instances.stream().anyMatch(instance -> StringUtils.equals(NacosMetaDataUtils.getValue(instance), value)) : Objects.isNull(value);
});
}
return keyValues.isEmpty();
diff --git a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/listener/NamingEventListener.java b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/listener/NamingEventListener.java
index 89a10ebd93e..c45913aca79 100644
--- a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/listener/NamingEventListener.java
+++ b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/listener/NamingEventListener.java
@@ -24,7 +24,7 @@ import com.alibaba.nacos.api.naming.pojo.Instance;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEventListener;
-import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtil;
+import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtils;
import java.util.Comparator;
import java.util.HashMap;
@@ -50,19 +50,19 @@ public final class NamingEventListener implements EventListener {
return;
}
NamingEvent namingEvent = (NamingEvent) event;
- List<Instance> instances = namingEvent.getInstances().stream().sorted(Comparator.comparing(NacosMetaDataUtil::getKey)).collect(Collectors.toList());
+ List<Instance> instances = namingEvent.getInstances().stream().sorted(Comparator.comparing(NacosMetaDataUtils::getKey)).collect(Collectors.toList());
List<WatchData> watchDataList = new LinkedList<>();
synchronized (this) {
instances.forEach(instance -> prefixListenerMap.forEach((prefixPath, listener) -> {
- String key = NacosMetaDataUtil.getKey(instance);
+ String key = NacosMetaDataUtils.getKey(instance);
if (key.startsWith(prefixPath)) {
Instance preInstance = preInstances.remove(key);
WatchData watchData = new WatchData(key, preInstance, instance, listener);
watchDataList.add(watchData);
}
}));
- preInstances.values().stream().sorted(Comparator.comparing(NacosMetaDataUtil::getKey).reversed()).forEach(instance -> prefixListenerMap.forEach((prefixPath, listener) -> {
- String key = NacosMetaDataUtil.getKey(instance);
+ preInstances.values().stream().sorted(Comparator.comparing(NacosMetaDataUtils::getKey).reversed()).forEach(instance -> prefixListenerMap.forEach((prefixPath, listener) -> {
+ String key = NacosMetaDataUtils.getKey(instance);
if (key.startsWith(prefixPath)) {
WatchData watchData = new WatchData(key, instance, null, listener);
watchDataList.add(watchData);
@@ -77,10 +77,10 @@ public final class NamingEventListener implements EventListener {
switch (changedType) {
case ADDED:
case UPDATED:
- listener.onChange(new DataChangedEvent(key, NacosMetaDataUtil.getValue(instance), changedType));
+ listener.onChange(new DataChangedEvent(key, NacosMetaDataUtils.getValue(instance), changedType));
break;
case DELETED:
- listener.onChange(new DataChangedEvent(key, NacosMetaDataUtil.getValue(preInstance), changedType));
+ listener.onChange(new DataChangedEvent(key, NacosMetaDataUtils.getValue(preInstance), changedType));
break;
default:
}
@@ -93,7 +93,7 @@ public final class NamingEventListener implements EventListener {
if (Objects.isNull(preInstance) && Objects.nonNull(instance)) {
return DataChangedEvent.Type.ADDED;
}
- if (Objects.nonNull(preInstance) && Objects.nonNull(instance) && NacosMetaDataUtil.getTimestamp(preInstance) != NacosMetaDataUtil.getTimestamp(instance)) {
+ if (Objects.nonNull(preInstance) && Objects.nonNull(instance) && NacosMetaDataUtils.getTimestamp(preInstance) != NacosMetaDataUtils.getTimestamp(instance)) {
return DataChangedEvent.Type.UPDATED;
}
if (Objects.nonNull(preInstance) && Objects.isNull(instance)) {
@@ -110,12 +110,12 @@ public final class NamingEventListener implements EventListener {
public void setPreInstances(final List<Instance> instances) {
preInstances = instances.stream().filter(instance -> {
for (String each : prefixListenerMap.keySet()) {
- if (NacosMetaDataUtil.getKey(instance).startsWith(each)) {
+ if (NacosMetaDataUtils.getKey(instance).startsWith(each)) {
return true;
}
}
return false;
- }).collect(Collectors.toMap(NacosMetaDataUtil::getKey, Function.identity(), (a, b) -> NacosMetaDataUtil.getTimestamp(a) > NacosMetaDataUtil.getTimestamp(b) ? a : b));
+ }).collect(Collectors.toMap(NacosMetaDataUtils::getKey, Function.identity(), (a, b) -> NacosMetaDataUtils.getTimestamp(a) > NacosMetaDataUtils.getTimestamp(b) ? a : b));
}
/**
diff --git a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtil.java b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtils.java
similarity index 97%
rename from mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtil.java
rename to mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtils.java
index bc74ca687ae..1f506687e81 100644
--- a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtil.java
+++ b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/utils/NacosMetaDataUtils.java
@@ -28,10 +28,10 @@ import java.time.LocalDateTime;
import java.time.ZoneOffset;
/**
- * Nacos meta data util.
+ * Nacos meta data utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class NacosMetaDataUtil {
+public final class NacosMetaDataUtils {
public static final ZoneOffset UTC_ZONE_OFFSET = ZoneOffset.of("+8");
diff --git a/mode/type/cluster/repository/provider/nacos/src/test/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepositoryTest.java b/mode/type/cluster/repository/provider/nacos/src/test/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepositoryTest.java
index 05e2cd93660..0a18fc0a24d 100644
--- a/mode/type/cluster/repository/provider/nacos/src/test/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepositoryTest.java
+++ b/mode/type/cluster/repository/provider/nacos/src/test/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepositoryTest.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.mode.repository.cluster.nacos.entity.ServiceCon
import org.apache.shardingsphere.mode.repository.cluster.nacos.entity.ServiceMetaData;
import org.apache.shardingsphere.mode.repository.cluster.nacos.props.NacosProperties;
import org.apache.shardingsphere.mode.repository.cluster.nacos.props.NacosPropertyKey;
-import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtil;
+import org.apache.shardingsphere.mode.repository.cluster.nacos.utils.NacosMetaDataUtils;
import org.apache.shardingsphere.mode.spi.PersistRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -93,7 +93,7 @@ public final class NacosRepositoryTest {
Instance instance = new Instance();
Map<String, String> metaDataMap = new HashMap<>(2, 1);
metaDataMap.put(key, "value" + count);
- metaDataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(count));
+ metaDataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(count));
instance.setMetadata(metaDataMap);
instances.add(instance);
}
@@ -134,7 +134,7 @@ public final class NacosRepositoryTest {
ServiceMetaData persistentService = serviceController.getPersistentService();
assertThat(registerType, is(persistentService.getServiceName()));
assertThat(registerInstance.isEphemeral(), is(false));
- assertThat(NacosMetaDataUtil.getValue(registerInstance), is("value4"));
+ assertThat(NacosMetaDataUtils.getValue(registerInstance), is("value4"));
}
@Test
@@ -160,7 +160,7 @@ public final class NacosRepositoryTest {
assertThat(registerType, is(persistentService.getServiceName()));
assertThat(registerInstance.getIp(), is(ip));
assertThat(registerInstance.isEphemeral(), is(false));
- assertThat(NacosMetaDataUtil.getValue(registerInstance), is("value4"));
+ assertThat(NacosMetaDataUtils.getValue(registerInstance), is("value4"));
}
@Test
@@ -193,7 +193,7 @@ public final class NacosRepositoryTest {
String registerType = stringArgumentCaptor.getValue();
assertThat(registerType, is(ephemeralService.getServiceName()));
assertThat(registerInstance.isEphemeral(), is(true));
- assertThat(NacosMetaDataUtil.getValue(registerInstance), is("value4"));
+ assertThat(NacosMetaDataUtils.getValue(registerInstance), is("value4"));
Map<String, String> metaData = registerInstance.getMetadata();
long timeToLiveSeconds = Long.parseLong(NacosPropertyKey.TIME_TO_LIVE_SECONDS.getDefaultValue());
assertThat(metaData.get(PreservedMetadataKeys.HEART_BEAT_INTERVAL), is(String.valueOf(timeToLiveSeconds * 1000 / 3)));
@@ -228,7 +228,7 @@ public final class NacosRepositoryTest {
ServiceMetaData ephemeralService = serviceController.getEphemeralService();
assertThat(registerType, is(ephemeralService.getServiceName()));
assertThat(registerInstance.isEphemeral(), is(true));
- assertThat(NacosMetaDataUtil.getValue(registerInstance), is("value0"));
+ assertThat(NacosMetaDataUtils.getValue(registerInstance), is("value0"));
Map<String, String> metaData = registerInstance.getMetadata();
long timeToLiveSeconds = Long.parseLong(NacosPropertyKey.TIME_TO_LIVE_SECONDS.getDefaultValue());
assertThat(metaData.get(PreservedMetadataKeys.HEART_BEAT_INTERVAL), is(String.valueOf(timeToLiveSeconds * 1000 / 3)));
@@ -291,16 +291,16 @@ public final class NacosRepositoryTest {
ServiceMetaData persistentService = serviceController.getPersistentService();
persistentService.setListener(null);
String key = "key/key";
- long epochMilliseconds = NacosMetaDataUtil.getTimestamp();
+ long epochMilliseconds = NacosMetaDataUtils.getTimestamp();
Instance preInstance = new Instance();
Map<String, String> metaDataMap = new HashMap<>();
metaDataMap.put(key, "value1");
- metaDataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(epochMilliseconds));
+ metaDataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(epochMilliseconds));
preInstance.setMetadata(metaDataMap);
final Instance instance = new Instance();
metaDataMap = new HashMap<>();
metaDataMap.put(key, "value2");
- metaDataMap.put(NacosMetaDataUtil.UTC_ZONE_OFFSET.toString(), String.valueOf(epochMilliseconds + 1));
+ metaDataMap.put(NacosMetaDataUtils.UTC_ZONE_OFFSET.toString(), String.valueOf(epochMilliseconds + 1));
instance.setMetadata(metaDataMap);
Event event = new NamingEvent(persistentService.getServiceName(), Collections.singletonList(instance));
doAnswer(AdditionalAnswers.answerVoid(getListenerAnswer(preInstance, event))).when(client).subscribe(anyString(), any(EventListener.class));
@@ -352,7 +352,7 @@ public final class NacosRepositoryTest {
MemberAccessor accessor = Plugins.getMemberAccessor();
if (Objects.nonNull(preInstance)) {
Map<String, Instance> preInstances = new HashMap<>();
- preInstances.put(NacosMetaDataUtil.getKey(preInstance), preInstance);
+ preInstances.put(NacosMetaDataUtils.getKey(preInstance), preInstance);
accessor.set(listener.getClass().getDeclaredField("preInstances"), listener, preInstances);
}
listener.onEvent(event);
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
index 2449423d8bb..e901734b74e 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnection.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.BackendConnectionException;
import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.TransactionUtil;
+import org.apache.shardingsphere.proxy.backend.util.TransactionUtils;
import org.apache.shardingsphere.transaction.spi.TransactionHook;
import java.sql.Connection;
@@ -163,7 +163,7 @@ public final class BackendConnection implements ExecutorJDBCConnectionManager {
connection.setReadOnly(true);
}
if (null != connectionSession.getIsolationLevel()) {
- connection.setTransactionIsolation(TransactionUtil.getTransactionIsolationLevel(connectionSession.getIsolationLevel()));
+ connection.setTransactionIsolation(TransactionUtils.getTransactionIsolationLevel(connectionSession.getIsolationLevel()));
}
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
index be885ba5a60..781ca87a8dc 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutor.java
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableExce
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.executor.ConnectionSessionRequiredQueryableRALExecutor;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import org.apache.shardingsphere.transaction.api.TransactionType;
import java.util.Arrays;
@@ -102,7 +102,7 @@ public final class ShowDistVariableExecutor implements ConnectionSessionRequired
VariableEnum variable = VariableEnum.getValueOf(variableName);
switch (variable) {
case AGENT_PLUGINS_ENABLED:
- return SystemPropertyUtil.getSystemProperty(variable.name(), Boolean.TRUE.toString());
+ return SystemPropertyUtils.getSystemProperty(variable.name(), Boolean.TRUE.toString());
case CACHED_CONNECTIONS:
int connectionSize = connectionSession.getBackendConnection().getConnectionSize();
return String.valueOf(connectionSize);
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
index 207867c4e7c..2e82ceaa80a 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariablesExecutor.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.logging.utils.LoggingUtils;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.executor.ConnectionSessionRequiredQueryableRALExecutor;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import java.util.Arrays;
import java.util.Collection;
@@ -54,7 +54,7 @@ public final class ShowDistVariablesExecutor implements ConnectionSessionRequire
.map(each -> new LocalDataQueryResultRow(each.toLowerCase(), metaData.getInternalProps().getValue(InternalConfigurationPropertyKey.valueOf(each)).toString()))
.collect(Collectors.toList()));
result.add(new LocalDataQueryResultRow(
- VariableEnum.AGENT_PLUGINS_ENABLED.name().toLowerCase(), SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString())));
+ VariableEnum.AGENT_PLUGINS_ENABLED.name().toLowerCase(), SystemPropertyUtils.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString())));
result.add(new LocalDataQueryResultRow(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), connectionSession.getBackendConnection().getConnectionSize()));
result.add(new LocalDataQueryResultRow(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), connectionSession.getTransactionStatus().getTransactionType().name()));
addLoggingPropsRows(metaData, result);
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java
index 61d629b56aa..5db8c4ee5c8 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdater.java
@@ -37,7 +37,7 @@ import org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableExce
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.updater.ConnectionSessionRequiredRALUpdater;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import org.apache.shardingsphere.transaction.api.TransactionType;
import org.slf4j.LoggerFactory;
@@ -127,7 +127,7 @@ public final class SetDistVariableUpdater implements ConnectionSessionRequiredRA
switch (variable) {
case AGENT_PLUGINS_ENABLED:
Boolean agentPluginsEnabled = BooleanUtils.toBooleanObject(sqlStatement.getValue());
- SystemPropertyUtil.setSystemProperty(variable.name(), null == agentPluginsEnabled ? Boolean.FALSE.toString() : agentPluginsEnabled.toString());
+ SystemPropertyUtils.setSystemProperty(variable.name(), null == agentPluginsEnabled ? Boolean.FALSE.toString() : agentPluginsEnabled.toString());
break;
case TRANSACTION_TYPE:
connectionSession.getTransactionStatus().setTransactionType(getTransactionType(sqlStatement.getValue()));
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowLogicalTableExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowLogicalTableExecutor.java
index 0bc197e2740..1d7d871de27 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowLogicalTableExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowLogicalTableExecutor.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowLogicalTa
import org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType;
import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.proxy.backend.util.RegularUtil;
+import org.apache.shardingsphere.proxy.backend.util.RegularUtils;
import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
import java.util.Collection;
@@ -47,7 +47,7 @@ public final class ShowLogicalTableExecutor implements RQLExecutor<ShowLogicalTa
Collection<String> tables = database.getSchema(schemaName).getAllTableNames();
if (sqlStatement.getLikePattern().isPresent()) {
String pattern = SQLUtil.convertLikePatternToRegex(sqlStatement.getLikePattern().get());
- tables = tables.stream().filter(each -> RegularUtil.matchesCaseInsensitive(pattern, each)).collect(Collectors.toList());
+ tables = tables.stream().filter(each -> RegularUtils.matchesCaseInsensitive(pattern, each)).collect(Collectors.toList());
}
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
tables.forEach(each -> result.add(new LocalDataQueryResultRow(each)));
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowSingleTableExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowSingleTableExecutor.java
index 2c34b192316..a7c505f6a29 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowSingleTableExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/ShowSingleTableExecutor.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowSingleTab
import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.proxy.backend.util.RegularUtil;
+import org.apache.shardingsphere.proxy.backend.util.RegularUtils;
import org.apache.shardingsphere.single.rule.SingleRule;
import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
@@ -60,7 +60,7 @@ public final class ShowSingleTableExecutor implements RQLExecutor<ShowSingleTabl
}
if (sqlStatement.getLikePattern().isPresent()) {
String pattern = SQLUtil.convertLikePatternToRegex(sqlStatement.getLikePattern().get());
- singleTableNodes = singleTableNodes.filter(each -> RegularUtil.matchesCaseInsensitive(pattern, each.getTableName())).collect(Collectors.toList()).stream();
+ singleTableNodes = singleTableNodes.filter(each -> RegularUtils.matchesCaseInsensitive(pattern, each.getTableName())).collect(Collectors.toList()).stream();
}
return singleTableNodes.sorted(Comparator.comparing(DataNode::getTableName)).collect(Collectors.toList());
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionSetHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionSetHandler.java
index 03d23ded532..93bdc52cd58 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionSetHandler.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/transaction/TransactionSetHandler.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.TransactionUtil;
+import org.apache.shardingsphere.proxy.backend.util.TransactionUtils;
import org.apache.shardingsphere.sql.parser.sql.common.enums.TransactionAccessType;
import org.apache.shardingsphere.sql.parser.sql.common.statement.tcl.SetTransactionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLStatement;
@@ -65,8 +65,8 @@ public final class TransactionSetHandler implements ProxyBackendHandler {
return;
}
connectionSession.setDefaultIsolationLevel(sqlStatement instanceof MySQLStatement
- ? TransactionUtil.getTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ)
- : TransactionUtil.getTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));
+ ? TransactionUtils.getTransactionIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ)
+ : TransactionUtils.getTransactionIsolationLevel(Connection.TRANSACTION_READ_COMMITTED));
connectionSession.setIsolationLevel(sqlStatement.getIsolationLevel().get());
}
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtil.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtils.java
similarity index 97%
rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtil.java
rename to proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtils.java
index b0356585d3f..25802d9b3ff 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtil.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/RegularUtils.java
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
* Regular utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class RegularUtil {
+public final class RegularUtils {
/**
* Tells whether or not this input string matches the given regular expression.
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtil.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtils.java
similarity index 97%
rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtil.java
rename to proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtils.java
index 7c9f899b68d..6d0786f2915 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtil.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtils.java
@@ -24,7 +24,7 @@ import lombok.NoArgsConstructor;
* System property utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SystemPropertyUtil {
+public final class SystemPropertyUtils {
/**
* Set system property.
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtils.java
similarity index 97%
rename from proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java
rename to proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtils.java
index 0da0bae1a00..5a2a2d7daaa 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtils.java
@@ -24,10 +24,10 @@ import org.apache.shardingsphere.sql.parser.sql.common.enums.TransactionIsolatio
import java.sql.Connection;
/**
- * Transaction util class.
+ * Transaction utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class TransactionUtil {
+public final class TransactionUtils {
/**
* Get the value of type int according to TransactionIsolationLevel.
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnectionTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnectionTest.java
index 1e49c07ba8c..cdb9141f075 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnectionTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/BackendConnectionTest.java
@@ -110,7 +110,7 @@ public final class BackendConnectionTest {
@Test
public void assertGetConnectionCacheIsEmpty() throws SQLException {
connectionSession.getTransactionStatus().setInTransaction(true);
- when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtil.mockNewConnections(2));
+ when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtils.mockNewConnections(2));
List<Connection> actualConnections = backendConnection.getConnections("ds1", 2, ConnectionMode.MEMORY_STRICTLY);
assertThat(actualConnections.size(), is(2));
assertThat(backendConnection.getConnectionSize(), is(2));
@@ -120,7 +120,7 @@ public final class BackendConnectionTest {
@Test
public void assertGetConnectionSizeLessThanCache() throws SQLException {
connectionSession.getTransactionStatus().setInTransaction(true);
- MockConnectionUtil.setCachedConnections(backendConnection, "ds1", 10);
+ MockConnectionUtils.setCachedConnections(backendConnection, "ds1", 10);
List<Connection> actualConnections = backendConnection.getConnections("ds1", 2, ConnectionMode.MEMORY_STRICTLY);
assertThat(actualConnections.size(), is(2));
assertThat(backendConnection.getConnectionSize(), is(10));
@@ -130,8 +130,8 @@ public final class BackendConnectionTest {
@Test
public void assertGetConnectionSizeGreaterThanCache() throws SQLException {
connectionSession.getTransactionStatus().setInTransaction(true);
- MockConnectionUtil.setCachedConnections(backendConnection, "ds1", 10);
- when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtil.mockNewConnections(2));
+ MockConnectionUtils.setCachedConnections(backendConnection, "ds1", 10);
+ when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtils.mockNewConnections(2));
List<Connection> actualConnections = backendConnection.getConnections("ds1", 12, ConnectionMode.MEMORY_STRICTLY);
assertThat(actualConnections.size(), is(12));
assertThat(backendConnection.getConnectionSize(), is(12));
@@ -141,7 +141,7 @@ public final class BackendConnectionTest {
@Test
public void assertGetConnectionWithConnectionPostProcessors() throws SQLException {
connectionSession.getTransactionStatus().setInTransaction(true);
- when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtil.mockNewConnections(2));
+ when(backendDataSource.getConnections(anyString(), anyString(), eq(2), any())).thenReturn(MockConnectionUtils.mockNewConnections(2));
setConnectionPostProcessors();
List<Connection> actualConnections = backendConnection.getConnections("ds1", 2, ConnectionMode.MEMORY_STRICTLY);
verify(backendConnection.getConnectionPostProcessors().iterator().next(), times(2)).process(any());
@@ -245,7 +245,7 @@ public final class BackendConnectionTest {
@Test
public void assertGetConnectionsWithoutTransactions() throws SQLException {
connectionSession.getTransactionStatus().setInTransaction(false);
- List<Connection> connections = MockConnectionUtil.mockNewConnections(1);
+ List<Connection> connections = MockConnectionUtils.mockNewConnections(1);
when(backendDataSource.getConnections(anyString(), anyString(), eq(1), any())).thenReturn(connections);
List<Connection> fetchedConnections = backendConnection.getConnections("ds1", 1, null);
assertThat(fetchedConnections.size(), is(1));
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtil.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtils.java
similarity index 96%
rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtil.java
rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtils.java
index 8dc51f551ae..a21be736066 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtil.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/MockConnectionUtils.java
@@ -31,10 +31,10 @@ import java.util.List;
import static org.mockito.Mockito.mock;
/**
- * Mock JDBC connection session utility.
+ * Mock JDBC connection session utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-final class MockConnectionUtil {
+final class MockConnectionUtils {
/**
* Mock set cached connections.
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
index 66d5d6cfc1e..3aa7a8bf5bc 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowDistVariableExecutorTest.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigur
import org.apache.shardingsphere.proxy.backend.exception.UnsupportedVariableException;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
import org.apache.shardingsphere.transaction.api.TransactionType;
@@ -85,7 +85,7 @@ public final class ShowDistVariableExecutorTest {
@Test
public void assertShowAgentPluginsEnabled() {
- SystemPropertyUtil.setSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString());
+ SystemPropertyUtils.setSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString());
ShowDistVariableExecutor executor = new ShowDistVariableExecutor();
Collection<LocalDataQueryResultRow> actual = executor.getRows(metaData, connectionSession, new ShowDistVariableStatement("AGENT_PLUGINS_ENABLED"));
assertThat(actual.size(), is(1));
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdatableRALBackendHandlerTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdatableRALBackendHandlerTest.java
index eb0d8eedcc9..c6e6370ebcc 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdatableRALBackendHandlerTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdatableRALBackendHandlerTest.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import org.apache.shardingsphere.transaction.api.TransactionType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -96,7 +96,7 @@ public final class SetDistVariableUpdatableRALBackendHandlerTest {
UpdatableRALBackendHandler<?> handler = new UpdatableRALBackendHandler<>(new SetDistVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString()), null);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
- assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.TRUE.toString()));
+ assertThat(SystemPropertyUtils.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.TRUE.toString()));
}
@Test
@@ -105,7 +105,7 @@ public final class SetDistVariableUpdatableRALBackendHandlerTest {
UpdatableRALBackendHandler<?> handler = new UpdatableRALBackendHandler<>(new SetDistVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), null);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
- assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
+ assertThat(SystemPropertyUtils.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
}
@Test
@@ -114,6 +114,6 @@ public final class SetDistVariableUpdatableRALBackendHandlerTest {
UpdatableRALBackendHandler<?> handler = new UpdatableRALBackendHandler<>(new SetDistVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "xxx"), connectionSession);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
- assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
+ assertThat(SystemPropertyUtils.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
}
}
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
index a8e85734fb6..6f4a6314c0d 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java
@@ -38,7 +38,7 @@ import org.apache.shardingsphere.proxy.backend.exception.InvalidValueException;
import org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.session.transaction.TransactionStatus;
-import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
+import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtils;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
import org.apache.shardingsphere.transaction.api.TransactionType;
@@ -73,7 +73,7 @@ public final class SetDistVariableUpdaterTest {
SetDistVariableStatement statement = new SetDistVariableStatement("AGENT_PLUGINS_ENABLED", Boolean.FALSE.toString());
SetDistVariableUpdater updater = new SetDistVariableUpdater();
updater.executeUpdate(connectionSession, statement);
- String actualValue = SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "default");
+ String actualValue = SystemPropertyUtils.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "default");
assertThat(actualValue, is(Boolean.FALSE.toString()));
}
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilsTest.java
similarity index 81%
rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilTest.java
rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilsTest.java
index 6f2e6ba05e3..681e17fe074 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/RegularUtilsTest.java
@@ -21,20 +21,20 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public final class RegularUtilTest {
+public final class RegularUtilsTest {
@Test
public void assertMatchesWithUpperCaseRegex() {
- assertTrue(RegularUtil.matchesCaseInsensitive("T.ORDER", "t_order"));
+ assertTrue(RegularUtils.matchesCaseInsensitive("T.ORDER", "t_order"));
}
@Test
public void assertMatchesWithLowerCaseRegex() {
- assertTrue(RegularUtil.matchesCaseInsensitive("t.order", "t_order"));
+ assertTrue(RegularUtils.matchesCaseInsensitive("t.order", "t_order"));
}
@Test
public void assertMatchesWithUpperCaseInput() {
- assertTrue(RegularUtil.matchesCaseInsensitive("t.order", "T_ORDER"));
+ assertTrue(RegularUtils.matchesCaseInsensitive("t.order", "T_ORDER"));
}
}
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilsTest.java
similarity index 79%
rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilTest.java
rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilsTest.java
index 3a0c69b0c07..4e0879b549e 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/util/SystemPropertyUtilsTest.java
@@ -22,16 +22,16 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public final class SystemPropertyUtilTest {
+public final class SystemPropertyUtilsTest {
@Test
public void assertGetDefaultValue() {
- assertThat(SystemPropertyUtil.getSystemProperty("key0", "value0"), is("value0"));
+ assertThat(SystemPropertyUtils.getSystemProperty("key0", "value0"), is("value0"));
}
@Test
public void assertGetSystemPropertyAfterSet() {
- SystemPropertyUtil.setSystemProperty("key1", "value1");
- assertThat(SystemPropertyUtil.getSystemProperty("key1", "value0"), is("value1"));
+ SystemPropertyUtils.setSystemProperty("key1", "value1");
+ assertThat(SystemPropertyUtils.getSystemProperty("key1", "value0"), is("value1"));
}
}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java
index cd1cf555e5a..9f19f766984 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/checker/HeterogeneousSelectStatementChecker.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.proxy.backend.hbase.checker;
import com.google.common.base.Preconditions;
import org.apache.shardingsphere.proxy.backend.hbase.context.HBaseContext;
import org.apache.shardingsphere.proxy.backend.hbase.props.HBasePropertyKey;
-import org.apache.shardingsphere.proxy.backend.hbase.util.HBaseHeterogeneousUtil;
+import org.apache.shardingsphere.proxy.backend.hbase.utils.HBaseHeterogeneousUtils;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BetweenExpression;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
@@ -76,7 +76,7 @@ public class HeterogeneousSelectStatementChecker extends CommonHeterogeneousSQLS
private void checkProjectionsIsExpected() {
for (ProjectionSegment projectionSegment : getSqlStatement().getProjections().getProjections()) {
- if (!(projectionSegment instanceof ShorthandProjectionSegment || projectionSegment instanceof ColumnProjectionSegment || HBaseHeterogeneousUtil.isCrcProjectionSegment(
+ if (!(projectionSegment instanceof ShorthandProjectionSegment || projectionSegment instanceof ColumnProjectionSegment || HBaseHeterogeneousUtils.isCrcProjectionSegment(
projectionSegment))) {
throw new IllegalArgumentException("Only supported ShorthandProjection and ColumnProjection and crc32ExpressionProjection");
}
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseSelectOperationConverter.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseSelectOperationConverter.java
index 55ae33450bc..47f6eb8fe90 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseSelectOperationConverter.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/type/HBaseSelectOperationConverter.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.proxy.backend.hbase.bean.HBaseOperation;
import org.apache.shardingsphere.proxy.backend.hbase.converter.HBaseOperationConverter;
import org.apache.shardingsphere.proxy.backend.hbase.converter.HBaseRowKeyExtractor;
import org.apache.shardingsphere.proxy.backend.hbase.converter.operation.HBaseSelectOperation;
-import org.apache.shardingsphere.proxy.backend.hbase.util.HBaseHeterogeneousUtil;
+import org.apache.shardingsphere.proxy.backend.hbase.utils.HBaseHeterogeneousUtils;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BetweenExpression;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
@@ -68,7 +68,7 @@ public final class HBaseSelectOperationConverter implements HBaseOperationConver
private HBaseOperation createGetOperation(final SelectStatementContext selectStatementContext, final WhereSegment whereSegment) {
ExpressionSegment expr = whereSegment.getExpr();
List<Get> gets = getRowKeys(expr).stream().map(each -> new Get(Bytes.toBytes(each))).collect(Collectors.toList());
- if (!HBaseHeterogeneousUtil.isUseShorthandProjection(selectStatementContext)) {
+ if (!HBaseHeterogeneousUtils.isUseShorthandProjection(selectStatementContext)) {
for (Get each : gets) {
appendColumns(each, selectStatementContext);
}
@@ -86,7 +86,7 @@ public final class HBaseSelectOperationConverter implements HBaseOperationConver
if (whereSegment.getExpr() instanceof BetweenExpression) {
appendBetween(scan, whereSegment.getExpr(), false);
}
- if (!HBaseHeterogeneousUtil.isUseShorthandProjection(selectStatementContext)) {
+ if (!HBaseHeterogeneousUtils.isUseShorthandProjection(selectStatementContext)) {
appendColumns(scan, selectStatementContext);
}
appendLimit(scan, selectStatementContext);
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtil.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtils.java
similarity index 95%
rename from proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtil.java
rename to proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtils.java
index 0b3b2ba5af5..069eb1bf54b 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtil.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtils.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.hbase.util;
+package org.apache.shardingsphere.proxy.backend.hbase.utils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -27,10 +27,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * HBase heterogeneous util.
+ * HBase heterogeneous utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class HBaseHeterogeneousUtil {
+public final class HBaseHeterogeneousUtils {
/**
* Whether crc projection segment.
diff --git a/proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtilTest.java b/proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtilsTest.java
similarity index 89%
rename from proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtilTest.java
rename to proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtilsTest.java
index b2c3c32878d..81272d97fad 100644
--- a/proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtilTest.java
+++ b/proxy/backend/type/hbase/src/test/java/org/apache/shardingsphere/proxy/backend/hbase/utils/HBaseHeterogeneousUtilsTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.hbase.util;
+package org.apache.shardingsphere.proxy.backend.hbase.utils;
import org.apache.shardingsphere.proxy.backend.hbase.result.HBaseSupportedSQLStatement;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ProjectionSegment;
@@ -27,13 +27,13 @@ import java.util.List;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public final class HBaseHeterogeneousUtilTest {
+public final class HBaseHeterogeneousUtilsTest {
@Test
public void assertCrc32ProjectionSegment() {
String sql = "SELECT /*+ HBase */ rowKey, crc32(concat_ws('#',rowKey)) from t_order where rowKey in (1, 2, 3)";
SQLStatement sqlStatement = HBaseSupportedSQLStatement.parseSQLStatement(sql);
List<ProjectionSegment> projectionSegments = new ArrayList<>(((SelectStatement) sqlStatement).getProjections().getProjections());
- assertTrue(HBaseHeterogeneousUtil.isCrcProjectionSegment(projectionSegments.get(1)));
+ assertTrue(HBaseHeterogeneousUtils.isCrcProjectionSegment(projectionSegments.get(1)));
}
}
diff --git a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutor.java b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutor.java
index 1bbf78a15b9..054cfac297b 100644
--- a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutor.java
+++ b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowTablesExecutor.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSp
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.handler.admin.executor.DatabaseAdminQueryExecutor;
-import org.apache.shardingsphere.proxy.backend.util.RegularUtil;
+import org.apache.shardingsphere.proxy.backend.util.RegularUtils;
import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQLShowTablesStatement;
@@ -95,7 +95,7 @@ public final class ShowTablesExecutor implements DatabaseAdminQueryExecutor {
.getDatabase(databaseName).getSchema(databaseName).getTables().values().stream().map(ShardingSphereTable::getName).collect(Collectors.toList());
if (showTablesStatement.getFilter().isPresent()) {
Optional<String> pattern = showTablesStatement.getFilter().get().getLike().map(optional -> SQLUtil.convertLikePatternToRegex(optional.getPattern()));
- return pattern.isPresent() ? result.stream().filter(each -> RegularUtil.matchesCaseInsensitive(pattern.get(), each)).collect(Collectors.toList()) : result;
+ return pattern.isPresent() ? result.stream().filter(each -> RegularUtils.matchesCaseInsensitive(pattern.get(), each)).collect(Collectors.toList()) : result;
}
return result;
}