You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/08/07 10:55:17 UTC
[shardingsphere] branch master updated: For code inspection (#6694)
This is an automated email from the ASF dual-hosted git repository.
zhangyonglun 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 b5e4738 For code inspection (#6694)
b5e4738 is described below
commit b5e4738cb80fcedc9e4dbf29592bcdfb996ab744
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Aug 7 18:55:05 2020 +0800
For code inspection (#6694)
---
.../StandardModuloShardingDatabaseAlgorithm.java | 2 +-
.../StandardModuloShardingTableAlgorithm.java | 2 +-
.../local/LocalMasterSlaveConfiguration.java | 2 +-
.../hint/raw/jdbc/ModuloHintShardingAlgorithm.java | 4 +-
.../xa/spring/boot/ExampleMainApplication.java | 2 +-
.../proxy/hint/ModuloHintShardingAlgorithm.java | 4 +-
.../cluster/heartbeat/detect/HeartbeatHandler.java | 6 +--
.../PrometheusMetricsTrackerFactory.java | 4 +-
.../core/schema/OrchestrationSchemaContexts.java | 2 +-
.../repository/etcd/EtcdRepository.java | 2 +-
.../repository/etcd/EtcdRepositoryTest.java | 10 ++---
.../column/value/string/MySQLJsonValueDecoder.java | 24 ++++++------
.../time/MySQLTimestampBinlogProtocolValue.java | 2 +-
.../MySQLTimestampBinlogProtocolValueTest.java | 2 +-
.../query/MySQLColumnDefinition41PacketTest.java | 2 +-
.../MySQLDoubleBinaryProtocolValueTest.java | 8 ++--
.../MySQLFloatBinaryProtocolValueTest.java | 8 ++--
.../AlgorithmProvidedEncryptRuleConfiguration.java | 12 +++---
.../rewrite/token/pojo/EncryptAssignmentToken.java | 2 +-
.../masterslave/rule/MasterSlaveRuleTest.java | 2 +-
.../datetime/AutoIntervalShardingAlgorithm.java | 4 +-
.../sharding/mod/HashModShardingAlgorithm.java | 2 +-
.../range/AbstractRangeShardingAlgorithm.java | 4 +-
.../token/pojo/GeneratedKeyAssignmentToken.java | 2 +-
.../engine/type/standard/AbstractSQLRouteTest.java | 6 +--
.../route/fixture/AbstractRoutingEngineTest.java | 10 ++---
.../infra/config/TypedSPIConfiguration.java | 2 +-
.../infra/properties/TypedProperties.java | 6 +--
.../infra/config/DataSourceConfigurationTest.java | 44 +++++++++++-----------
.../infra/rule/ShardingSphereRulesBuilderTest.java | 6 +--
.../group/ResourceManagedExecuteGroupEngine.java | 2 +-
.../jdbc/queryresult/MemoryQueryResultTest.java | 10 ++---
.../jdbc/queryresult/StreamQueryResultTest.java | 10 ++---
.../sql/token/pojo/generic/InsertValuesToken.java | 2 +-
.../rewrite/impl/GroupedParameterBuilderTest.java | 13 +++----
.../dbtest/fixture/StandardModuloAlgorithm.java | 4 +-
.../assertion/root/IntegrateTestCaseAssertion.java | 2 +-
.../shardingsphere/dbtest/engine/BatchIT.java | 4 +-
.../shardingsphere/dbtest/engine/SingleIT.java | 4 +-
.../dbtest/engine/dcl/BaseDCLIT.java | 4 +-
.../dbtest/engine/ddl/BaseDDLIT.java | 4 +-
.../dbtest/engine/dml/BaseDMLIT.java | 4 +-
.../dbtest/engine/dql/BaseDQLIT.java | 4 +-
.../jdbc/adapter/AbstractResultSetAdapter.java | 2 +-
.../driver/jdbc/core/resultset/ResultSetUtil.java | 4 +-
...tractUnsupportedOperationPreparedStatement.java | 2 +-
.../driver/executor/AbstractBaseExecutorTest.java | 2 +-
.../jdbc/adapter/PreparedStatementAdapterTest.java | 8 ++--
.../jdbc/adapter/ResultSetGetterAdapterTest.java | 8 ++--
.../resultset/ShardingSphereResultSetTest.java | 16 ++++----
.../UnsupportedUpdateOperationResultSetTest.java | 18 ++++-----
.../api/yaml/fixture/StandardAlgorithm.java | 2 +-
.../spring/boot/type/SpringBootJNDITest.java | 4 +-
.../StandardModuloDatabaseShardingAlgorithm.java | 4 +-
.../StandardModuloTableShardingAlgorithm.java | 4 +-
.../StandardModuloDatabaseShardingAlgorithm.java | 4 +-
.../StandardModuloTableShardingAlgorithm.java | 4 +-
.../boot/datasource/DataSourceMapSetter.java | 2 +-
.../executor/AbstractHintQueryExecutor.java | 2 +-
.../jdbc/connection/BackendConnectionTest.java | 7 ++--
.../jdbc/connection/MockConnectionUtil.java | 8 ++--
.../jdbc/datasource/JDBCBackendDataSourceTest.java | 7 ++--
.../core/execute/executor/record/RecordUtil.java | 6 +--
.../resume/AbstractResumeBreakPointManager.java | 2 +-
.../checker/AbstractDataSourceCheckerTest.java | 4 +-
.../scaling/mysql/binlog/BinlogPosition.java | 2 +-
.../PostgreSQLDataSourceCheckerTest.java | 4 +-
.../visitor/impl/PostgreSQLDMLVisitor.java | 6 ---
.../dml/order/item/TextOrderByItemSegment.java | 2 +-
.../jta/datasource/swapper/DataSourceSwapper.java | 2 +-
70 files changed, 193 insertions(+), 198 deletions(-)
diff --git a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingDatabaseAlgorithm.java b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingDatabaseAlgorithm.java
index 344136a..7425099 100644
--- a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingDatabaseAlgorithm.java
+++ b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingDatabaseAlgorithm.java
@@ -38,7 +38,7 @@ public final class StandardModuloShardingDatabaseAlgorithm implements StandardSh
@Override
public String doSharding(final Collection<String> databaseNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : databaseNames) {
- if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 2))) {
return each;
}
}
diff --git a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingTableAlgorithm.java b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingTableAlgorithm.java
index c93f420..97af673 100644
--- a/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingTableAlgorithm.java
+++ b/examples/example-core/config-utility/src/main/java/org/apache/shardingsphere/example/algorithm/StandardModuloShardingTableAlgorithm.java
@@ -38,7 +38,7 @@ public final class StandardModuloShardingTableAlgorithm implements StandardShard
@Override
public String doSharding(final Collection<String> tableNames, final PreciseShardingValue<Long> shardingValue) {
for (String each : tableNames) {
- if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 2))) {
return each;
}
}
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalMasterSlaveConfiguration.java b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalMasterSlaveConfiguration.java
index 09382d3..01de62e 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalMasterSlaveConfiguration.java
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/local/LocalMasterSlaveConfiguration.java
@@ -49,7 +49,7 @@ public final class LocalMasterSlaveConfiguration implements ExampleConfiguration
}
private Map<String, DataSource> createDataSourceMap() {
- Map<String, DataSource> result = new HashMap<>();
+ Map<String, DataSource> result = new HashMap<>(3, 1);
result.put("demo_ds_master", DataSourceUtil.createDataSource("demo_ds_master"));
result.put("demo_ds_slave_0", DataSourceUtil.createDataSource("demo_ds_slave_0"));
result.put("demo_ds_slave_1", DataSourceUtil.createDataSource("demo_ds_slave_1"));
diff --git a/examples/shardingsphere-jdbc-example/other-feature-example/hint-example/hint-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/hint/raw/jdbc/ModuloHintShardingAlgorithm.java b/examples/shardingsphere-jdbc-example/other-feature-example/hint-example/hint-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/hint/raw/jdbc/ModuloHintShardingAlgorithm.java
index b0a5210..ce5ffc6 100644
--- a/examples/shardingsphere-jdbc-example/other-feature-example/hint-example/hint-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/hint/raw/jdbc/ModuloHintShardingAlgorithm.java
+++ b/examples/shardingsphere-jdbc-example/other-feature-example/hint-example/hint-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/hint/raw/jdbc/ModuloHintShardingAlgorithm.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.example.hint.raw.jdbc;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingValue;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.Properties;
public final class ModuloHintShardingAlgorithm implements HintShardingAlgorithm<Long> {
@@ -34,7 +34,7 @@ public final class ModuloHintShardingAlgorithm implements HintShardingAlgorithm<
@Override
public Collection<String> doSharding(final Collection<String> availableTargetNames, final HintShardingValue<Long> shardingValue) {
- Collection<String> result = new ArrayList<>();
+ Collection<String> result = new LinkedList<>();
for (String each : availableTargetNames) {
for (Long value : shardingValue.getValues()) {
if (each.endsWith(String.valueOf(value % 2))) {
diff --git a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-spring-boot-example/src/main/java/org/apache/shardingsphere/example/transaction/xa/spring/boot/ExampleMainApplication.java b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-spring-boot-example/src/main/java/org/apache/shardingsphere/example/transaction/xa/spring/boot/ExampleMainApplication.java
index 2e6851c..3416cca 100644
--- a/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-spring-boot-example/src/main/java/org/apache/shardingsphere/example/transaction/xa/spring/boot/ExampleMainApplication.java
+++ b/examples/shardingsphere-jdbc-example/transaction-example/transaction-2pc-xa-spring-boot-example/src/main/java/org/apache/shardingsphere/example/transaction/xa/spring/boot/ExampleMainApplication.java
@@ -31,7 +31,7 @@ import javax.annotation.PostConstruct;
public class ExampleMainApplication {
@Autowired
- XAOrderService orderService;
+ private XAOrderService orderService;
public static void main(final String[] args) {
SpringApplication.run(ExampleMainApplication.class, args);
diff --git a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/java/org/apache/shardingsphere/example/proxy/hint/ModuloHintShardingAlgorithm.java b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/java/org/apache/shardingsphere/example/proxy/hint/ModuloHintShardingAlgorithm.java
index b243a96..184784a 100644
--- a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/java/org/apache/shardingsphere/example/proxy/hint/ModuloHintShardingAlgorithm.java
+++ b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/java/org/apache/shardingsphere/example/proxy/hint/ModuloHintShardingAlgorithm.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.example.proxy.hint;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
import org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingValue;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.Properties;
public final class ModuloHintShardingAlgorithm implements HintShardingAlgorithm<String> {
@@ -34,7 +34,7 @@ public final class ModuloHintShardingAlgorithm implements HintShardingAlgorithm<
@Override
public Collection<String> doSharding(final Collection<String> availableTargetNames, final HintShardingValue<String> shardingValue) {
- Collection<String> result = new ArrayList<>();
+ Collection<String> result = new LinkedList<>();
for (String each : availableTargetNames) {
for (String value : shardingValue.getValues()) {
if (each.endsWith(String.valueOf(Long.parseLong(value) % 2))) {
diff --git a/shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/java/org/apache/shardingsphere/cluster/heartbeat/detect/HeartbeatHandler.java b/shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/java/org/apache/shardingsphere/cluster/heartbeat/detect/HeartbeatHandler.java
index 1e489a3..748cd37e 100644
--- a/shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/java/org/apache/shardingsphere/cluster/heartbeat/detect/HeartbeatHandler.java
+++ b/shardingsphere-control-panel/shardingsphere-cluster/shardingsphere-cluster-heartbeat/src/main/java/org/apache/shardingsphere/cluster/heartbeat/detect/HeartbeatHandler.java
@@ -101,12 +101,12 @@ public final class HeartbeatHandler {
}
private HeartbeatResponse buildHeartbeatResponse(final List<Future<Map<String, HeartbeatResult>>> futureTasks) {
- Map<String, Collection<HeartbeatResult>> heartbeatResultMap = futureTasks.stream().map(e -> {
+ Map<String, Collection<HeartbeatResult>> heartbeatResultMap = futureTasks.stream().map(each -> {
try {
- return e.get();
+ return each.get();
} catch (InterruptedException | ExecutionException ex) {
log.error("Heartbeat report error", ex);
- e.cancel(true);
+ each.cancel(true);
return new HashMap<String, HeartbeatResult>();
}
}).flatMap(map -> map.entrySet().stream()).collect(Collectors.groupingBy(Entry::getKey, HashMap::new, Collectors.mapping(Entry::getValue, Collectors.toCollection(ArrayList::new))));
diff --git a/shardingsphere-control-panel/shardingsphere-metrics/shardingsphere-metrics-prometheus/src/main/java/org/apache/shardingsphere/metrics/prometheus/PrometheusMetricsTrackerFactory.java b/shardingsphere-control-panel/shardingsphere-metrics/shardingsphere-metrics-prometheus/src/main/java/org/apache/shardingsphere/metrics/prometheus/PrometheusMetricsTrackerFactory.java
index f7a82a5..5304010 100644
--- a/shardingsphere-control-panel/shardingsphere-metrics/shardingsphere-metrics-prometheus/src/main/java/org/apache/shardingsphere/metrics/prometheus/PrometheusMetricsTrackerFactory.java
+++ b/shardingsphere-control-panel/shardingsphere-metrics/shardingsphere-metrics-prometheus/src/main/java/org/apache/shardingsphere/metrics/prometheus/PrometheusMetricsTrackerFactory.java
@@ -29,8 +29,8 @@ import org.apache.shardingsphere.metrics.prometheus.impl.gauge.ChannelCountGauge
import org.apache.shardingsphere.metrics.prometheus.impl.histogram.RequestLatencyHistogramMetricsTracker;
import org.apache.shardingsphere.metrics.prometheus.impl.summary.RequestLatencySummaryMetricsTracker;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import java.util.Optional;
/**
@@ -38,7 +38,7 @@ import java.util.Optional;
*/
public final class PrometheusMetricsTrackerFactory implements MetricsTrackerFactory {
- private static final Collection<MetricsTracker> REGISTER = new ArrayList<>();
+ private static final Collection<MetricsTracker> REGISTER = new LinkedList<>();
static {
REGISTER.add(new RequestTotalCounterMetricsTracker());
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
index 46fc7b1..ccf7a70 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-schema/src/main/java/org/apache/shardingsphere/orchestration/core/schema/OrchestrationSchemaContexts.java
@@ -79,7 +79,7 @@ public abstract class OrchestrationSchemaContexts implements SchemaContexts {
private volatile SchemaContexts schemaContexts;
- public OrchestrationSchemaContexts(final SchemaContexts schemaContexts, final OrchestrationFacade orchestrationFacade) {
+ protected OrchestrationSchemaContexts(final SchemaContexts schemaContexts, final OrchestrationFacade orchestrationFacade) {
this.orchestrationFacade = orchestrationFacade;
this.schemaContexts = schemaContexts;
OrchestrationEventBus.getInstance().register(this);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/ [...]
index 35c978d..9e9852f 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
@@ -81,7 +81,7 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
private String getSubNodeKeyName(final String prefix, final String fullPath) {
String pathWithoutPrefix = fullPath.substring(prefix.length());
- return pathWithoutPrefix.contains("/") ? pathWithoutPrefix.substring(0, pathWithoutPrefix.indexOf("/")) : pathWithoutPrefix;
+ return pathWithoutPrefix.contains("/") ? pathWithoutPrefix.substring(0, pathWithoutPrefix.indexOf('/')) : pathWithoutPrefix;
}
@SneakyThrows({InterruptedException.class, ExecutionException.class})
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/test/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepositoryTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/ [...]
index 6825293..e5778b8 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/test/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepositoryTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/test/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepositoryTest.java
@@ -40,9 +40,9 @@ import org.mockito.Mock;
import org.mockito.internal.util.reflection.FieldSetter;
import org.mockito.junit.MockitoJUnitRunner;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CompletableFuture;
@@ -281,14 +281,14 @@ public final class EtcdRepositoryTest {
@SneakyThrows({NoSuchFieldException.class, SecurityException.class})
private WatchResponse buildWatchResponse(final WatchEvent.EventType eventType) {
- WatchResponse watchResponse = new WatchResponse(mock(io.etcd.jetcd.api.WatchResponse.class), ByteSequence.EMPTY);
- List<WatchEvent> events = new ArrayList<>();
+ WatchResponse result = new WatchResponse(mock(io.etcd.jetcd.api.WatchResponse.class), ByteSequence.EMPTY);
+ List<WatchEvent> events = new LinkedList<>();
io.etcd.jetcd.api.KeyValue keyValue1 = io.etcd.jetcd.api.KeyValue.newBuilder()
.setKey(ByteString.copyFromUtf8("key1"))
.setValue(ByteString.copyFromUtf8("value1")).build();
KeyValue keyValue = new KeyValue(keyValue1, ByteSequence.EMPTY);
events.add(new WatchEvent(keyValue, mock(KeyValue.class), eventType));
- FieldSetter.setField(watchResponse, watchResponse.getClass().getDeclaredField("events"), events);
- return watchResponse;
+ FieldSetter.setField(result, result.getClass().getDeclaredField("events"), events);
+ return result;
}
}
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java
index 92286e3..5209040 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLJsonValueDecoder.java
@@ -89,7 +89,7 @@ public final class MySQLJsonValueDecoder {
outputString(decodeString(byteBuf.slice()), result);
break;
default:
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(String.valueOf(type));
}
} finally {
byteBuf.readerIndex(oldOffset);
@@ -140,7 +140,7 @@ public final class MySQLJsonValueDecoder {
return new String(data);
}
- private static void decodeValueEntry(final boolean isSmall, final ByteBuf byteBuf, final StringBuilder result) {
+ private static void decodeValueEntry(final boolean isSmall, final ByteBuf byteBuf, final StringBuilder stringBuilder) {
int type = byteBuf.readUnsignedByte() & 0xff;
switch (type) {
case JsonValueTypes.SMALL_JSON_OBJECT:
@@ -151,36 +151,36 @@ public final class MySQLJsonValueDecoder {
case JsonValueTypes.UINT64:
case JsonValueTypes.DOUBLE:
case JsonValueTypes.STRING:
- decodeValue(type, getIntBasedObjectSize(byteBuf, isSmall), byteBuf, result);
+ decodeValue(type, getIntBasedObjectSize(byteBuf, isSmall), byteBuf, stringBuilder);
break;
case JsonValueTypes.INT16:
- result.append(byteBuf.readShortLE());
+ stringBuilder.append(byteBuf.readShortLE());
if (!isSmall) {
byteBuf.skipBytes(2);
}
break;
case JsonValueTypes.UINT16:
- result.append(getIntBasedObjectSize(byteBuf, isSmall));
+ stringBuilder.append(getIntBasedObjectSize(byteBuf, isSmall));
break;
case JsonValueTypes.INT32:
if (isSmall) {
- decodeValue(type, byteBuf.readUnsignedShortLE(), byteBuf, result);
+ decodeValue(type, byteBuf.readUnsignedShortLE(), byteBuf, stringBuilder);
} else {
- result.append(byteBuf.readIntLE());
+ stringBuilder.append(byteBuf.readIntLE());
}
break;
case JsonValueTypes.UINT32:
if (isSmall) {
- decodeValue(type, byteBuf.readUnsignedShortLE(), byteBuf, result);
+ decodeValue(type, byteBuf.readUnsignedShortLE(), byteBuf, stringBuilder);
} else {
- result.append(byteBuf.readUnsignedIntLE());
+ stringBuilder.append(byteBuf.readUnsignedIntLE());
}
break;
case JsonValueTypes.LITERAL:
- outputLiteral(getIntBasedObjectSize(byteBuf, isSmall), result);
+ outputLiteral(getIntBasedObjectSize(byteBuf, isSmall), stringBuilder);
break;
default:
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(String.valueOf(type));
}
}
@@ -200,7 +200,7 @@ public final class MySQLJsonValueDecoder {
out.append("false");
break;
default:
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException(String.valueOf(inlineValue));
}
}
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
index c6316d9..e8cfb54 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValue.java
+++ b/shardingsphere-db-protocol/shardingsphere-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 * 1000));
+ return 0 == seconds ? MySQLTimeValueUtil.DATETIME_OF_ZERO : MySQLTimeValueUtil.getSimpleDateFormat().format(new Timestamp(seconds * 1000L));
}
}
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
index baaf747..401cdb5 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/time/MySQLTimestampBinlogProtocolValueTest.java
@@ -43,7 +43,7 @@ public final class MySQLTimestampBinlogProtocolValueTest {
public void assertRead() {
int currentSeconds = new Long(System.currentTimeMillis() / 1000).intValue();
when(payload.readInt4()).thenReturn(currentSeconds);
- assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.getSimpleDateFormat().format(new Timestamp(currentSeconds * 1000))));
+ assertThat(new MySQLTimestampBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtil.getSimpleDateFormat().format(new Timestamp(currentSeconds * 1000L))));
}
@Test
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
index 4cf1313..2b1b41b 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/MySQLColumnDefinition41PacketTest.java
@@ -63,7 +63,7 @@ public final class MySQLColumnDefinition41PacketTest {
when(payload.readInt1()).thenReturn(1, MySQLColumnType.MYSQL_TYPE_LONG.getValue(), 0);
when(payload.readInt2()).thenReturn(MySQLServerInfo.CHARSET, 0);
when(payload.readInt4()).thenReturn(10);
- when(payload.readIntLenenc()).thenReturn((long) 0x0c);
+ when(payload.readIntLenenc()).thenReturn(0x0cL);
when(payload.readStringLenenc()).thenReturn("def", "logic_db", "tbl", "tbl", "id", "id");
MySQLColumnDefinition41Packet actual = new MySQLColumnDefinition41Packet(payload);
assertThat(actual.getSequenceId(), is(1));
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
index d2a3161..fa20511 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
@@ -37,13 +37,13 @@ public final class MySQLDoubleBinaryProtocolValueTest {
@Test
public void assertRead() {
- when(byteBuf.readDoubleLE()).thenReturn(1d);
- assertThat(new MySQLDoubleBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf)), is(1d));
+ when(byteBuf.readDoubleLE()).thenReturn(1.0d);
+ assertThat(new MySQLDoubleBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf)), is(1.0d));
}
@Test
public void assertWrite() {
- new MySQLDoubleBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf), 1d);
- verify(byteBuf).writeDoubleLE(1d);
+ new MySQLDoubleBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf), 1.0d);
+ verify(byteBuf).writeDoubleLE(1.0d);
}
}
diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
index 683129d..fe79f26 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
@@ -37,13 +37,13 @@ public final class MySQLFloatBinaryProtocolValueTest {
@Test
public void assertRead() {
- when(byteBuf.readFloatLE()).thenReturn(1f);
- assertThat(new MySQLFloatBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf)), is(1f));
+ when(byteBuf.readFloatLE()).thenReturn(1.0f);
+ assertThat(new MySQLFloatBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf)), is(1.0f));
}
@Test
public void assertWrite() {
- new MySQLFloatBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf), 1f);
- verify(byteBuf).writeFloatLE(1f);
+ new MySQLFloatBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf), 1.0f);
+ verify(byteBuf).writeFloatLE(1.0f);
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/algorithm/config/AlgorithmProvidedEncryptRuleConfiguration.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/algorithm/config/AlgorithmProvidedEncryptRuleConfiguration.java
index 938245c..e955d18 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/algorithm/config/AlgorithmProvidedEncryptRuleConfiguration.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/algorithm/config/AlgorithmProvidedEncryptRuleConfiguration.java
@@ -17,16 +17,17 @@
package org.apache.shardingsphere.encrypt.algorithm.config;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.Map;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
/**
* Algorithm provided encrypt rule configuration.
*/
@@ -41,8 +42,7 @@ public final class AlgorithmProvidedEncryptRuleConfiguration implements RuleConf
public AlgorithmProvidedEncryptRuleConfiguration() {
}
- public AlgorithmProvidedEncryptRuleConfiguration(final Collection<EncryptTableRuleConfiguration> tables,
- final Map<String, EncryptAlgorithm> encryptors) {
+ public AlgorithmProvidedEncryptRuleConfiguration(final Collection<EncryptTableRuleConfiguration> tables, final Map<String, EncryptAlgorithm> encryptors) {
this.tables = tables;
this.encryptors = encryptors;
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptAssignmentToken.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptAssignmentToken.java
index b10b3ef..0059669 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptAssignmentToken.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/pojo/EncryptAssignmentToken.java
@@ -29,7 +29,7 @@ public abstract class EncryptAssignmentToken extends SQLToken implements Substit
private final int stopIndex;
- public EncryptAssignmentToken(final int startIndex, final int stopIndex) {
+ protected EncryptAssignmentToken(final int startIndex, final int stopIndex) {
super(startIndex);
this.stopIndex = stopIndex;
}
diff --git a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
index a252e59..027fd6e 100644
--- a/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
+++ b/shardingsphere-features/shardingsphere-master-slave/shardingsphere-master-slave-common/src/test/java/org/apache/shardingsphere/masterslave/rule/MasterSlaveRuleTest.java
@@ -83,7 +83,7 @@ public final class MasterSlaveRuleTest {
public void assertUpdateRuleStatusWithEnable() {
MasterSlaveRule masterSlaveRule = createMasterSlaveRule();
masterSlaveRule.updateRuleStatus(new DataSourceNameDisabledEvent("slave_db_0", true));
- assertThat(masterSlaveRule.getSingleDataSourceRule().getSlaveDataSourceNames(), is(Arrays.asList("slave_db_1")));
+ assertThat(masterSlaveRule.getSingleDataSourceRule().getSlaveDataSourceNames(), is(Collections.singletonList("slave_db_1")));
masterSlaveRule.updateRuleStatus(new DataSourceNameDisabledEvent("slave_db_0", false));
assertThat(masterSlaveRule.getSingleDataSourceRule().getSlaveDataSourceNames(), is(Arrays.asList("slave_db_0", "slave_db_1")));
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
index 29c9b7b..f7852eb 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
@@ -84,7 +84,7 @@ public final class AutoIntervalShardingAlgorithm implements StandardShardingAlgo
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(doSharding(parseDate(shardingValue.getValue())) + "")) {
+ if (each.endsWith(String.valueOf(doSharding(parseDate(shardingValue.getValue()))))) {
return each;
}
}
@@ -98,7 +98,7 @@ public final class AutoIntervalShardingAlgorithm implements StandardShardingAlgo
int lastPartition = getLastPartition(shardingValue.getValueRange());
for (int i = firstPartition; i <= lastPartition; i++) {
for (String each : availableTargetNames) {
- if (each.endsWith(i + "")) {
+ if (each.endsWith(String.valueOf(i))) {
result.add(each);
}
if (result.size() == availableTargetNames.size()) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
index 214feeb..0d7313b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
@@ -54,7 +54,7 @@ public final class HashModShardingAlgorithm implements StandardShardingAlgorithm
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(hashShardingValue(shardingValue.getValue()) % shardingCount + "")) {
+ if (each.endsWith(String.valueOf(hashShardingValue(shardingValue.getValue()) % shardingCount))) {
return each;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/AbstractRangeShardingAlgorithm.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/AbstractRangeShardingAlgorithm.java
index c2a05fc..89cc277 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/AbstractRangeShardingAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-common/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/AbstractRangeShardingAlgorithm.java
@@ -51,7 +51,7 @@ public abstract class AbstractRangeShardingAlgorithm implements StandardSharding
@Override
public final String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Long> shardingValue) {
- return availableTargetNames.stream().filter(each -> each.endsWith(getPartition(shardingValue.getValue()) + "")).findFirst().orElse(null);
+ return availableTargetNames.stream().filter(each -> each.endsWith(String.valueOf(getPartition(shardingValue.getValue())))).findFirst().orElse(null);
}
@Override
@@ -61,7 +61,7 @@ public abstract class AbstractRangeShardingAlgorithm implements StandardSharding
int lastPartition = getLastPartition(shardingValue.getValueRange());
for (int partition = firstPartition; partition <= lastPartition; partition++) {
for (String each : availableTargetNames) {
- if (each.endsWith(partition + "")) {
+ if (each.endsWith(String.valueOf(partition))) {
result.add(each);
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/GeneratedKeyAssignmentToken.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/GeneratedKeyAssignmentToken.java
index 01b577c..d54d2f5 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/GeneratedKeyAssignmentToken.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/GeneratedKeyAssignmentToken.java
@@ -27,7 +27,7 @@ public abstract class GeneratedKeyAssignmentToken extends SQLToken implements At
private final String columnName;
- public GeneratedKeyAssignmentToken(final int startIndex, final String columnName) {
+ protected GeneratedKeyAssignmentToken(final int startIndex, final String columnName) {
super(startIndex);
this.columnName = columnName;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
index aca987e..249e94a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
@@ -60,11 +60,11 @@ public abstract class AbstractSQLRouteTest extends AbstractRoutingEngineTest {
}
private DataSourceMetas buildDataSourceMetas() {
- Map<String, DatabaseAccessConfiguration> dataSourceInfoMap = new HashMap<>();
- DatabaseAccessConfiguration mainDatabaseAccessConfiguration = new DatabaseAccessConfiguration("jdbc:mysql://127.0.0.1:3306/actual_db", "test", null);
+ Map<String, DatabaseAccessConfiguration> dataSourceInfoMap = new HashMap<>(3, 1);
+ DatabaseAccessConfiguration mainDatabaseAccessConfig = new DatabaseAccessConfiguration("jdbc:mysql://127.0.0.1:3306/actual_db", "test", null);
DatabaseAccessConfiguration databaseAccessConfiguration0 = new DatabaseAccessConfiguration("jdbc:mysql://127.0.0.1:3306/actual_db", "test", null);
DatabaseAccessConfiguration databaseAccessConfiguration1 = new DatabaseAccessConfiguration("jdbc:mysql://127.0.0.1:3306/actual_db", "test", null);
- dataSourceInfoMap.put("main", mainDatabaseAccessConfiguration);
+ dataSourceInfoMap.put("main", mainDatabaseAccessConfig);
dataSourceInfoMap.put("ds_0", databaseAccessConfiguration0);
dataSourceInfoMap.put("ds_1", databaseAccessConfiguration1);
return new DataSourceMetas(DatabaseTypes.getActualDatabaseType("MySQL"), dataSourceInfoMap);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/fixture/AbstractRoutingEngineTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/fixture/AbstractRoutingEngineTest.java
index 31f9f7a..4f60471 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/fixture/AbstractRoutingEngineTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/fixture/AbstractRoutingEngineTest.java
@@ -150,16 +150,16 @@ public abstract class AbstractRoutingEngineTest {
return result;
}
- private ShardingTableRuleConfiguration createTableRuleConfig(final String tableName, final String actualDataNodes, final ShardingStrategyConfiguration dsShardingStrategyConfiguration,
- final ShardingStrategyConfiguration tableShardingStrategyConfiguration) {
+ private ShardingTableRuleConfiguration createTableRuleConfig(final String tableName, final String actualDataNodes,
+ final ShardingStrategyConfiguration dsShardingStrategyConfig, final ShardingStrategyConfiguration tableShardingStrategyConfig) {
ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration(tableName, actualDataNodes);
- result.setDatabaseShardingStrategy(dsShardingStrategyConfiguration);
- result.setTableShardingStrategy(tableShardingStrategyConfiguration);
+ result.setDatabaseShardingStrategy(dsShardingStrategyConfig);
+ result.setTableShardingStrategy(tableShardingStrategyConfig);
return result;
}
protected final ShardingConditions createShardingConditions(final String tableName) {
- List<ShardingCondition> result = new ArrayList<>();
+ List<ShardingCondition> result = new ArrayList<>(1);
RouteValue shardingValue1 = new ListRouteValue<>("user_id", tableName, Collections.singleton(1L));
RouteValue shardingValue2 = new ListRouteValue<>("order_id", tableName, Collections.singleton(1L));
ShardingCondition shardingCondition = new ShardingCondition();
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/TypedSPIConfiguration.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/TypedSPIConfiguration.java
index e24cbfc..cd740b6 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/TypedSPIConfiguration.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/TypedSPIConfiguration.java
@@ -33,7 +33,7 @@ public abstract class TypedSPIConfiguration {
private final Properties props;
- public TypedSPIConfiguration(final String type, final Properties props) {
+ protected TypedSPIConfiguration(final String type, final Properties props) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(type), "Type is required.");
this.type = type;
this.props = null == props ? new Properties() : props;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/properties/TypedProperties.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/properties/TypedProperties.java
index 51da92a..a8b049f 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/properties/TypedProperties.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/properties/TypedProperties.java
@@ -30,14 +30,14 @@ import java.util.Properties;
/**
* Typed properties with a specified enum.
*/
-public abstract class TypedProperties<E extends Enum & TypedPropertyKey> {
+public abstract class TypedProperties<E extends Enum<?> & TypedPropertyKey> {
@Getter
private final Properties props;
private final Map<E, TypedPropertyValue> cache;
- public TypedProperties(final Class<E> keyClass, final Properties props) {
+ protected TypedProperties(final Class<E> keyClass, final Properties props) {
this.props = props;
cache = preload(keyClass);
}
@@ -69,7 +69,7 @@ public abstract class TypedProperties<E extends Enum & TypedPropertyKey> {
* @return property value
*/
@SuppressWarnings("unchecked")
- public <T> T getValue(final E key) {
+ public final <T> T getValue(final E key) {
return (T) cache.get(key).getValue();
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
index deb713e..e5f6f00 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/DataSourceConfigurationTest.java
@@ -73,35 +73,35 @@ public final class DataSourceConfigurationTest {
@Test
public void assertEquals() {
- DataSourceConfiguration originalDataSourceConfiguration = new DataSourceConfiguration(HikariDataSource.class.getName());
+ DataSourceConfiguration originalDataSourceConfig = new DataSourceConfiguration(HikariDataSource.class.getName());
DataSourceConfiguration targetDataSourceConfiguration = new DataSourceConfiguration(HikariDataSource.class.getName());
- assertThat(originalDataSourceConfiguration.equals(originalDataSourceConfiguration), is(true));
- assertThat(originalDataSourceConfiguration.equals(targetDataSourceConfiguration), is(true));
- originalDataSourceConfiguration.getProps().put("username", "root");
+ assertThat(originalDataSourceConfig.equals(originalDataSourceConfig), is(true));
+ assertThat(originalDataSourceConfig.equals(targetDataSourceConfiguration), is(true));
+ originalDataSourceConfig.getProps().put("username", "root");
targetDataSourceConfiguration.getProps().put("username", "root");
- assertThat(originalDataSourceConfiguration.equals(targetDataSourceConfiguration), is(true));
+ assertThat(originalDataSourceConfig.equals(targetDataSourceConfiguration), is(true));
targetDataSourceConfiguration.getProps().put("password", "root");
- assertThat(originalDataSourceConfiguration.equals(targetDataSourceConfiguration), is(true));
- originalDataSourceConfiguration.getProps().put("username", "root");
- originalDataSourceConfiguration.getProps().put("url", "jdbcUrl");
- assertThat(originalDataSourceConfiguration.equals(targetDataSourceConfiguration), is(false));
+ assertThat(originalDataSourceConfig.equals(targetDataSourceConfiguration), is(true));
+ originalDataSourceConfig.getProps().put("username", "root");
+ originalDataSourceConfig.getProps().put("url", "jdbcUrl");
+ assertThat(originalDataSourceConfig.equals(targetDataSourceConfiguration), is(false));
}
@Test
public void assertHashCode() {
- DataSourceConfiguration originalDataSourceConfiguration = new DataSourceConfiguration(HikariDataSource.class.getName());
- DataSourceConfiguration targetDataSourceConfiguration = new DataSourceConfiguration(HikariDataSource.class.getName());
- assertThat(originalDataSourceConfiguration.hashCode(), is(targetDataSourceConfiguration.hashCode()));
- originalDataSourceConfiguration.getProps().put("username", "root");
- originalDataSourceConfiguration.getProps().put("password", "root");
- targetDataSourceConfiguration.getProps().put("username", "root");
- targetDataSourceConfiguration.getProps().put("password", "root");
- assertThat(originalDataSourceConfiguration.hashCode(), is(targetDataSourceConfiguration.hashCode()));
- originalDataSourceConfiguration.getProps().put("url", "jdbcUrl");
- assertThat(originalDataSourceConfiguration.hashCode(), not(targetDataSourceConfiguration.hashCode()));
- originalDataSourceConfiguration.getProps().clear();
- targetDataSourceConfiguration = new DataSourceConfiguration(BasicDataSource.class.getName());
- assertThat(originalDataSourceConfiguration.hashCode(), not(targetDataSourceConfiguration.hashCode()));
+ DataSourceConfiguration originalDataSourceConfig = new DataSourceConfiguration(HikariDataSource.class.getName());
+ DataSourceConfiguration targetDataSourceConfig = new DataSourceConfiguration(HikariDataSource.class.getName());
+ assertThat(originalDataSourceConfig.hashCode(), is(targetDataSourceConfig.hashCode()));
+ originalDataSourceConfig.getProps().put("username", "root");
+ originalDataSourceConfig.getProps().put("password", "root");
+ targetDataSourceConfig.getProps().put("username", "root");
+ targetDataSourceConfig.getProps().put("password", "root");
+ assertThat(originalDataSourceConfig.hashCode(), is(targetDataSourceConfig.hashCode()));
+ originalDataSourceConfig.getProps().put("url", "jdbcUrl");
+ assertThat(originalDataSourceConfig.hashCode(), not(targetDataSourceConfig.hashCode()));
+ originalDataSourceConfig.getProps().clear();
+ targetDataSourceConfig = new DataSourceConfiguration(BasicDataSource.class.getName());
+ assertThat(originalDataSourceConfig.hashCode(), not(targetDataSourceConfig.hashCode()));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/ShardingSphereRulesBuilderTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/ShardingSphereRulesBuilderTest.java
index c392f57..1287aa2 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/ShardingSphereRulesBuilderTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/ShardingSphereRulesBuilderTest.java
@@ -22,8 +22,8 @@ import org.apache.shardingsphere.infra.rule.fixture.TestRuleConfiguration;
import org.apache.shardingsphere.infra.rule.fixture.TestShardingSphereRuleBuilder;
import org.junit.Test;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -33,7 +33,7 @@ public final class ShardingSphereRulesBuilderTest {
@Test
public void assertBuild() {
RuleConfiguration ruleConfiguration = new TestRuleConfiguration();
- Collection<ShardingSphereRule> shardingSphereRules = ShardingSphereRulesBuilder.build(Arrays.asList(ruleConfiguration), Arrays.asList(""));
- assertThat(shardingSphereRules, is(Arrays.asList(TestShardingSphereRuleBuilder.getShardingSphereRule())));
+ Collection<ShardingSphereRule> shardingSphereRules = ShardingSphereRulesBuilder.build(Collections.singletonList(ruleConfiguration), Collections.singletonList(""));
+ assertThat(shardingSphereRules, is(Collections.singletonList(TestShardingSphereRuleBuilder.getShardingSphereRule())));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/resourced/group/ResourceManagedExecuteGroupEngine.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/resourced/group/ResourceManagedExecuteGroupEngine.java
index f65c7b7..6a8c92a 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/resourced/group/ResourceManagedExecuteGroupEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/resourced/group/ResourceManagedExecuteGroupEngine.java
@@ -50,7 +50,7 @@ public abstract class ResourceManagedExecuteGroupEngine
private final O option;
- public ResourceManagedExecuteGroupEngine(final int maxConnectionsSizePerQuery, final E executionConnection, final O option, final Collection<ShardingSphereRule> rules) {
+ protected ResourceManagedExecuteGroupEngine(final int maxConnectionsSizePerQuery, final E executionConnection, final O option, final Collection<ShardingSphereRule> rules) {
super(rules);
this.maxConnectionsSizePerQuery = maxConnectionsSizePerQuery;
this.executionConnection = executionConnection;
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/MemoryQueryResultTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/MemoryQueryResultTest.java
index 882aa24..bb4fa0e 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/MemoryQueryResultTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/MemoryQueryResultTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.executor.sql.jdbc.queryresult;
-import java.sql.Array;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.queryresult.MemoryQueryResult;
import org.hamcrest.core.Is;
@@ -28,6 +27,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.math.BigDecimal;
+import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
@@ -175,20 +175,20 @@ public final class MemoryQueryResultTest {
@Test
public void assertGetValueByFloat() throws SQLException {
ResultSet resultSet = getMockedResultSet(Types.FLOAT);
- when(resultSet.getDouble(1)).thenReturn(1D);
+ when(resultSet.getDouble(1)).thenReturn(1.0D);
MemoryQueryResult actual = new MemoryQueryResult(resultSet);
assertTrue(actual.next());
- assertThat(actual.getValue(1, double.class), is(1D));
+ assertThat(actual.getValue(1, double.class), is(1.0D));
assertFalse(actual.next());
}
@Test
public void assertGetValueByDouble() throws SQLException {
ResultSet resultSet = getMockedResultSet(Types.DOUBLE);
- when(resultSet.getDouble(1)).thenReturn(1D);
+ when(resultSet.getDouble(1)).thenReturn(1.0D);
MemoryQueryResult actual = new MemoryQueryResult(resultSet);
assertTrue(actual.next());
- assertThat(actual.getValue(1, double.class), is(1D));
+ assertThat(actual.getValue(1, double.class), is(1.0D));
assertFalse(actual.next());
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/StreamQueryResultTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/StreamQueryResultTest.java
index a3dab04..7b0effe 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/StreamQueryResultTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/jdbc/queryresult/StreamQueryResultTest.java
@@ -17,11 +17,11 @@
package org.apache.shardingsphere.infra.executor.sql.jdbc.queryresult;
-import java.sql.Array;
import org.apache.shardingsphere.infra.executor.sql.resourced.jdbc.queryresult.StreamQueryResult;
import org.junit.Test;
import java.math.BigDecimal;
+import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
@@ -88,15 +88,15 @@ public final class StreamQueryResultTest {
@Test
public void assertGetValueByFloat() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
- when(resultSet.getFloat(1)).thenReturn(1F);
- assertThat(new StreamQueryResult(resultSet).getValue(1, float.class), is(1F));
+ when(resultSet.getFloat(1)).thenReturn(1.0F);
+ assertThat(new StreamQueryResult(resultSet).getValue(1, float.class), is(1.0F));
}
@Test
public void assertGetValueByDouble() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
- when(resultSet.getDouble(1)).thenReturn(1D);
- assertThat(new StreamQueryResult(resultSet).getValue(1, double.class), is(1D));
+ when(resultSet.getDouble(1)).thenReturn(1.0D);
+ assertThat(new StreamQueryResult(resultSet).getValue(1, double.class), is(1.0D));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/InsertValuesToken.java b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/InsertValuesToken.java
index ac3748b..9575df0 100644
--- a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/InsertValuesToken.java
+++ b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/main/java/org/apache/shardingsphere/infra/rewrite/sql/token/pojo/generic/InsertValuesToken.java
@@ -34,7 +34,7 @@ public abstract class InsertValuesToken extends SQLToken implements Substitutabl
private final List<InsertValue> insertValues;
- public InsertValuesToken(final int startIndex, final int stopIndex) {
+ protected InsertValuesToken(final int startIndex, final int stopIndex) {
super(startIndex);
this.stopIndex = stopIndex;
insertValues = new LinkedList<>();
diff --git a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/test/java/org/apache/shardingsphere/infra/rewrite/impl/GroupedParameterBuilderTest.java b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/test/java/org/apache/shardingsphere/infra/rewrite/impl/GroupedParameterBuilderTest.java
index 65b4c73..686b543 100644
--- a/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/test/java/org/apache/shardingsphere/infra/rewrite/impl/GroupedParameterBuilderTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-rewrite/shardingsphere-infra-rewrite-engine/src/test/java/org/apache/shardingsphere/infra/rewrite/impl/GroupedParameterBuilderTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.infra.rewrite.impl;
import org.apache.shardingsphere.infra.rewrite.parameter.builder.impl.GroupedParameterBuilder;
import org.junit.Test;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -33,17 +32,17 @@ public final class GroupedParameterBuilderTest {
@Test
public void assertGetParameters() {
- GroupedParameterBuilder actual = new GroupedParameterBuilder(createGroupedParameters(), new ArrayList<>());
+ GroupedParameterBuilder actual = new GroupedParameterBuilder(createGroupedParameters(), new LinkedList<>());
assertThat(actual.getParameters(), is(Arrays.<Object>asList(3, 4, 5, 6)));
}
-
+
@Test
public void assertGetParametersWithOnDuplicateKeyParameters() {
GroupedParameterBuilder actual = new GroupedParameterBuilder(createGroupedParameters(), createOnDuplicateKeyUpdateParameters());
assertThat(actual.getParameters(), is(Arrays.<Object>asList(3, 4, 5, 6)));
assertThat(actual.getOnDuplicateKeyUpdateParametersBuilder().getParameters(), is(Arrays.<Object>asList(7, 8)));
}
-
+
@Test
public void assertGetOnDuplicateKeyParametersWithModify() {
GroupedParameterBuilder actual = new GroupedParameterBuilder(new LinkedList<>(), createOnDuplicateKeyUpdateParameters());
@@ -54,7 +53,7 @@ public final class GroupedParameterBuilderTest {
actual.getOnDuplicateKeyUpdateParametersBuilder().addRemovedParameters(1);
assertThat(actual.getOnDuplicateKeyUpdateParametersBuilder().getParameters(), is(Arrays.<Object>asList(66, 77, 88, 99, 110)));
}
-
+
@Test
public void assertGetDerivedColumnName() {
GroupedParameterBuilder actual = new GroupedParameterBuilder(createGroupedParameters(), createOnDuplicateKeyUpdateParameters());
@@ -62,11 +61,11 @@ public final class GroupedParameterBuilderTest {
actual.setDerivedColumnName(derivedColumnName);
assertThat(actual.getDerivedColumnName(), is(Optional.of(derivedColumnName)));
}
-
+
private List<Object> createOnDuplicateKeyUpdateParameters() {
return new LinkedList<>(Arrays.asList(7, 8));
}
-
+
private List<List<Object>> createGroupedParameters() {
List<List<Object>> result = new LinkedList<>();
result.add(Arrays.asList(3, 4));
diff --git a/shardingsphere-integration-test/shardingsphere-test-fixture/src/test/java/org/apache/shardingsphere/dbtest/fixture/StandardModuloAlgorithm.java b/shardingsphere-integration-test/shardingsphere-test-fixture/src/test/java/org/apache/shardingsphere/dbtest/fixture/StandardModuloAlgorithm.java
index c60ddad..ced5962 100644
--- a/shardingsphere-integration-test/shardingsphere-test-fixture/src/test/java/org/apache/shardingsphere/dbtest/fixture/StandardModuloAlgorithm.java
+++ b/shardingsphere-integration-test/shardingsphere-test-fixture/src/test/java/org/apache/shardingsphere/dbtest/fixture/StandardModuloAlgorithm.java
@@ -41,7 +41,7 @@ public final class StandardModuloAlgorithm implements StandardShardingAlgorithm<
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 10 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 10))) {
return each;
}
}
@@ -60,7 +60,7 @@ public final class StandardModuloAlgorithm implements StandardShardingAlgorithm<
}
for (int i = begin; i <= range; i += 1) {
for (String each : availableTargetNames) {
- if (each.endsWith(i + "")) {
+ if (each.endsWith(String.valueOf(i))) {
result.add(each);
}
}
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/cases/assertion/root/IntegrateTestCaseAssertion.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/cases/assertion/root/IntegrateTestCaseAssertion.java
index 40b8e2c..92a3d59 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/cases/assertion/root/IntegrateTestCaseAssertion.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/cases/assertion/root/IntegrateTestCaseAssertion.java
@@ -57,7 +57,7 @@ public abstract class IntegrateTestCaseAssertion {
for (String each : Splitter.on(",").trimResults().splitToList(parameters)) {
// TODO improve the implement way
if (each.startsWith("'")) {
- String value = each.substring(each.indexOf("'") + 1, each.lastIndexOf("'"));
+ String value = each.substring(each.indexOf('\'') + 1, each.lastIndexOf('\''));
result.add(new SQLValue(value, "json", ++count));
continue;
}
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/BatchIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/BatchIT.java
index b4ff21f..f0a644a 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/BatchIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/BatchIT.java
@@ -68,8 +68,8 @@ public abstract class BatchIT extends BaseIT {
private final Collection<String> expectedDataFiles;
- public BatchIT(final IntegrateTestCase integrateTestCase,
- final String ruleType, final DatabaseType databaseType, final String sql) throws IOException, JAXBException, SQLException {
+ protected BatchIT(final IntegrateTestCase integrateTestCase,
+ final String ruleType, final DatabaseType databaseType, final String sql) throws IOException, JAXBException, SQLException {
super(ruleType, databaseType);
this.integrateTestCase = integrateTestCase;
this.sql = sql;
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/SingleIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/SingleIT.java
index 4910f4d..c8e291b 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/SingleIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/SingleIT.java
@@ -44,8 +44,8 @@ public abstract class SingleIT extends BaseIT {
private final String originalSQL;
- public SingleIT(final String path, final IntegrateTestCaseAssertion assertion, final String ruleType,
- final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
+ protected SingleIT(final String path, final IntegrateTestCaseAssertion assertion, final String ruleType,
+ final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(ruleType, databaseType);
this.assertion = assertion;
this.caseType = caseType;
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dcl/BaseDCLIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dcl/BaseDCLIT.java
index 5f1f014..342a974 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dcl/BaseDCLIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dcl/BaseDCLIT.java
@@ -47,8 +47,8 @@ public abstract class BaseDCLIT extends SingleIT {
private final AuthorityEnvironmentManager authorityEnvironmentManager;
- public BaseDCLIT(final String path, final DCLIntegrateTestCaseAssertion assertion, final String ruleType,
- final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
+ protected BaseDCLIT(final String path, final DCLIntegrateTestCaseAssertion assertion, final String ruleType,
+ final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(path, assertion, ruleType, databaseType, caseType, sql);
authorityEnvironmentManager = new AuthorityEnvironmentManager(
EnvironmentPath.getAuthorityResourcesPath(ruleType), null == getDataSourceMap() ? null : createInstanceDataSourceMap(), getDatabaseType());
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/ddl/BaseDDLIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/ddl/BaseDDLIT.java
index de632dd..660b917 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/ddl/BaseDDLIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/ddl/BaseDDLIT.java
@@ -58,8 +58,8 @@ public abstract class BaseDDLIT extends SingleIT {
private final DatabaseType databaseType;
- public BaseDDLIT(final String path, final DDLIntegrateTestCaseAssertion assertion, final String ruleType,
- final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
+ protected BaseDDLIT(final String path, final DDLIntegrateTestCaseAssertion assertion, final String ruleType,
+ final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(path, assertion, ruleType, databaseType, caseType, sql);
this.assertion = assertion;
this.databaseType = databaseType;
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dml/BaseDMLIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dml/BaseDMLIT.java
index bc6d99a..b83af15 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dml/BaseDMLIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dml/BaseDMLIT.java
@@ -57,8 +57,8 @@ public abstract class BaseDMLIT extends SingleIT {
private final DataSetEnvironmentManager dataSetEnvironmentManager;
- public BaseDMLIT(final String path, final DMLIntegrateTestCaseAssertion assertion, final String ruleType,
- final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
+ protected BaseDMLIT(final String path, final DMLIntegrateTestCaseAssertion assertion, final String ruleType,
+ final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(path, assertion, ruleType, databaseType, caseType, sql);
dataSetEnvironmentManager = new DataSetEnvironmentManager(EnvironmentPath.getDataInitializeResourceFile(getRuleType()), getDataSourceMap());
}
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dql/BaseDQLIT.java b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dql/BaseDQLIT.java
index d0735b7..24e954e 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dql/BaseDQLIT.java
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/dbtest/engine/dql/BaseDQLIT.java
@@ -58,8 +58,8 @@ import static org.junit.Assert.assertTrue;
@Slf4j
public abstract class BaseDQLIT extends SingleIT {
- public BaseDQLIT(final String path, final DQLIntegrateTestCaseAssertion assertion, final String ruleType,
- final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
+ protected BaseDQLIT(final String path, final DQLIntegrateTestCaseAssertion assertion, final String ruleType,
+ final DatabaseType databaseType, final SQLCaseType caseType, final String sql) throws IOException, JAXBException, SQLException, ParseException {
super(path, assertion, ruleType, databaseType, caseType, sql);
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractResultSetAdapter.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractResultSetAdapter.java
index 6c31807..8c49d3d 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractResultSetAdapter.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/AbstractResultSetAdapter.java
@@ -54,7 +54,7 @@ public abstract class AbstractResultSetAdapter extends AbstractUnsupportedOperat
@Getter
private final ExecutionContext executionContext;
- public AbstractResultSetAdapter(final List<ResultSet> resultSets, final Statement statement, final ExecutionContext executionContext) {
+ protected AbstractResultSetAdapter(final List<ResultSet> resultSets, final Statement statement, final ExecutionContext executionContext) {
Preconditions.checkArgument(!resultSets.isEmpty());
this.resultSets = resultSets;
this.statement = statement;
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ResultSetUtil.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ResultSetUtil.java
index 74f5a88..416da8a 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ResultSetUtil.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ResultSetUtil.java
@@ -106,9 +106,9 @@ public final class ResultSetUtil {
case "long":
return 0L;
case "float":
- return 0F;
+ return 0.0F;
case "double":
- return 0D;
+ return 0.0D;
default:
return null;
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java
index 3a0896b..a4ddba8 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationPreparedStatement.java
@@ -35,7 +35,7 @@ import java.sql.SQLFeatureNotSupportedException;
*/
public abstract class AbstractUnsupportedOperationPreparedStatement extends AbstractStatementAdapter implements PreparedStatement {
- public AbstractUnsupportedOperationPreparedStatement() {
+ protected AbstractUnsupportedOperationPreparedStatement() {
super(PreparedStatement.class);
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/executor/AbstractBaseExecutorTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/executor/AbstractBaseExecutorTest.java
index 9d5ab6f..205e70c 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/executor/AbstractBaseExecutorTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/executor/AbstractBaseExecutorTest.java
@@ -83,7 +83,7 @@ public abstract class AbstractBaseExecutorTest {
when(runtimeContext.getTransactionManagerEngine()).thenReturn(new ShardingTransactionManagerEngine());
DataSource dataSource = mock(DataSource.class);
when(dataSource.getConnection()).thenReturn(mock(Connection.class));
- Map<String, DataSource> dataSourceSourceMap = new LinkedHashMap<>();
+ Map<String, DataSource> dataSourceSourceMap = new LinkedHashMap<>(2, 1);
dataSourceSourceMap.put("ds_0", dataSource);
dataSourceSourceMap.put("ds_1", dataSource);
connection = new ShardingSphereConnection(dataSourceSourceMap, schemaContexts, TransactionType.LOCAL);
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/PreparedStatementAdapterTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/PreparedStatementAdapterTest.java
index 3e5b275..6ab3127 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/PreparedStatementAdapterTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/PreparedStatementAdapterTest.java
@@ -123,16 +123,16 @@ public final class PreparedStatementAdapterTest extends AbstractShardingSphereDa
@Test
public void assertSetFloat() throws SQLException {
for (PreparedStatement each : preparedStatements) {
- each.setFloat(1, 0F);
- assertParameter(each, 1, 0F);
+ each.setFloat(1, 0.0F);
+ assertParameter(each, 1, 0.0F);
}
}
@Test
public void assertSetDouble() throws SQLException {
for (PreparedStatement each : preparedStatements) {
- each.setDouble(1, 0D);
- assertParameter(each, 1, 0D);
+ each.setDouble(1, 0.0D);
+ assertParameter(each, 1, 0.0D);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/ResultSetGetterAdapterTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/ResultSetGetterAdapterTest.java
index 493feb8..0ce9779 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/ResultSetGetterAdapterTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/adapter/ResultSetGetterAdapterTest.java
@@ -152,28 +152,28 @@ public final class ResultSetGetterAdapterTest extends AbstractShardingSphereData
@Test
public void assertGetFloatForColumnIndex() throws SQLException {
for (ResultSet each : resultSets.values()) {
- assertThat(each.getFloat(1), is(10F));
+ assertThat(each.getFloat(1), is(10.0F));
}
}
@Test
public void assertGetFloatForColumnLabel() throws SQLException {
for (ResultSet each : resultSets.values()) {
- assertThat(each.getFloat(columnName), is(10F));
+ assertThat(each.getFloat(columnName), is(10.0F));
}
}
@Test
public void assertGetDoubleForColumnIndex() throws SQLException {
for (ResultSet each : resultSets.values()) {
- assertThat(each.getDouble(1), is(10D));
+ assertThat(each.getDouble(1), is(10.0D));
}
}
@Test
public void assertGetDoubleForColumnLabel() throws SQLException {
for (ResultSet each : resultSets.values()) {
- assertThat(each.getDouble(columnName), is(10D));
+ assertThat(each.getDouble(columnName), is(10.0D));
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
index 186beca..f1d5825 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/resultset/ShardingSphereResultSetTest.java
@@ -173,26 +173,26 @@ public final class ShardingSphereResultSetTest {
@Test
public void assertGetFloatWithColumnIndex() throws SQLException {
- when(mergeResultSet.getValue(1, float.class)).thenReturn(1F);
- assertThat(shardingSphereResultSet.getFloat(1), is(1F));
+ when(mergeResultSet.getValue(1, float.class)).thenReturn(1.0F);
+ assertThat(shardingSphereResultSet.getFloat(1), is(1.0F));
}
@Test
public void assertGetFloatWithColumnLabel() throws SQLException {
- when(mergeResultSet.getValue(1, float.class)).thenReturn(1F);
- assertThat(shardingSphereResultSet.getFloat("label"), is(1F));
+ when(mergeResultSet.getValue(1, float.class)).thenReturn(1.0F);
+ assertThat(shardingSphereResultSet.getFloat("label"), is(1.0F));
}
@Test
public void assertGetDoubleWithColumnIndex() throws SQLException {
- when(mergeResultSet.getValue(1, double.class)).thenReturn(1D);
- assertThat(shardingSphereResultSet.getDouble(1), is(1D));
+ when(mergeResultSet.getValue(1, double.class)).thenReturn(1.0D);
+ assertThat(shardingSphereResultSet.getDouble(1), is(1.0D));
}
@Test
public void assertGetDoubleWithColumnLabel() throws SQLException {
- when(mergeResultSet.getValue(1, double.class)).thenReturn(1D);
- assertThat(shardingSphereResultSet.getDouble("label"), is(1D));
+ when(mergeResultSet.getValue(1, double.class)).thenReturn(1.0D);
+ assertThat(shardingSphereResultSet.getDouble("label"), is(1.0D));
}
@Test
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
index c444af2..5a3ec5d 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/unsupported/UnsupportedUpdateOperationResultSetTest.java
@@ -36,16 +36,16 @@ import java.sql.SQLFeatureNotSupportedException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
+import java.util.LinkedList;
public final class UnsupportedUpdateOperationResultSetTest extends AbstractShardingSphereDataSourceForShardingTest {
- private final List<ShardingSphereConnection> shardingSphereConnections = new ArrayList<>();
+ private final Collection<ShardingSphereConnection> shardingSphereConnections = new LinkedList<>();
- private final List<Statement> statements = new ArrayList<>();
+ private final Collection<Statement> statements = new LinkedList<>();
- private final List<ResultSet> resultSets = new ArrayList<>();
+ private final Collection<ResultSet> resultSets = new LinkedList<>();
@Before
public void init() throws SQLException {
@@ -157,28 +157,28 @@ public final class UnsupportedUpdateOperationResultSetTest extends AbstractShard
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertUpdateFloatForColumnIndex() throws SQLException {
for (ResultSet each : resultSets) {
- each.updateFloat(1, 1F);
+ each.updateFloat(1, 1.0F);
}
}
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertUpdateFloatForColumnLabel() throws SQLException {
for (ResultSet each : resultSets) {
- each.updateFloat("label", 1F);
+ each.updateFloat("label", 1.0F);
}
}
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertUpdateDoubleForColumnIndex() throws SQLException {
for (ResultSet each : resultSets) {
- each.updateDouble(1, 1D);
+ each.updateDouble(1, 1.0D);
}
}
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertUpdateDoubleForColumnLabel() throws SQLException {
for (ResultSet each : resultSets) {
- each.updateDouble("label", 1D);
+ each.updateDouble("label", 1.0D);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/api/yaml/fixture/StandardAlgorithm.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/api/yaml/fixture/StandardAlgorithm.java
index ba71689..4487eda 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/api/yaml/fixture/StandardAlgorithm.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/api/yaml/fixture/StandardAlgorithm.java
@@ -39,7 +39,7 @@ public final class StandardAlgorithm implements StandardShardingAlgorithm<Intege
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 10 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 10))) {
return each;
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/type/SpringBootJNDITest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/type/SpringBootJNDITest.java
index 36aa873..814b3e0 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/type/SpringBootJNDITest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/type/SpringBootJNDITest.java
@@ -83,9 +83,9 @@ public class SpringBootJNDITest {
}
private void assertDatasource(final DataSource actualDatasource, final String expectedJDBCUrl) throws SQLException {
- String expectedJDBCUrlWithoutParameters = expectedJDBCUrl.substring(0, expectedJDBCUrl.indexOf(";"));
+ String expected = expectedJDBCUrl.substring(0, expectedJDBCUrl.indexOf(';'));
try (Connection connection = actualDatasource.getConnection()) {
- assertThat(connection.getMetaData().getURL(), is(expectedJDBCUrlWithoutParameters));
+ assertThat(connection.getMetaData().getURL(), is(expected));
}
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloDatabaseShardingAlgorithm.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloDatabaseShardingAlgorithm.java
index 5a15f6a..c48c190 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloDatabaseShardingAlgorithm.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloDatabaseShardingAlgorithm.java
@@ -40,7 +40,7 @@ public final class StandardModuloDatabaseShardingAlgorithm implements StandardSh
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 2))) {
return each;
}
}
@@ -52,7 +52,7 @@ public final class StandardModuloDatabaseShardingAlgorithm implements StandardSh
Collection<String> result = new LinkedHashSet<>(availableTargetNames.size());
for (Integer i = shardingValue.getValueRange().lowerEndpoint(); i <= shardingValue.getValueRange().upperEndpoint(); i++) {
for (String each : availableTargetNames) {
- if (each.endsWith(i % 2 + "")) {
+ if (each.endsWith(String.valueOf(i % 2))) {
result.add(each);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloTableShardingAlgorithm.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloTableShardingAlgorithm.java
index e3b43e7..486e6fe 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloTableShardingAlgorithm.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/test/java/org/apache/shardingsphere/spring/algorithm/StandardModuloTableShardingAlgorithm.java
@@ -40,7 +40,7 @@ public final class StandardModuloTableShardingAlgorithm implements StandardShard
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 4 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 4))) {
return each;
}
}
@@ -52,7 +52,7 @@ public final class StandardModuloTableShardingAlgorithm implements StandardShard
Collection<String> result = new LinkedHashSet<>(availableTargetNames.size());
for (Integer i = shardingValue.getValueRange().lowerEndpoint(); i <= shardingValue.getValueRange().upperEndpoint(); i++) {
for (String each : availableTargetNames) {
- if (each.endsWith(i % 4 + "")) {
+ if (each.endsWith(String.valueOf(i % 4))) {
result.add(each);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloDatabaseShardingAlgorithm.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/alg [...]
index dca23a3..dd4e07b 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloDatabaseShardingAlgorithm.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloDatabaseShardingAlgorithm.java
@@ -40,7 +40,7 @@ public final class StandardModuloDatabaseShardingAlgorithm implements StandardSh
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 2 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 2))) {
return each;
}
}
@@ -52,7 +52,7 @@ public final class StandardModuloDatabaseShardingAlgorithm implements StandardSh
Collection<String> result = new LinkedHashSet<>(availableTargetNames.size());
for (Integer i = shardingValue.getValueRange().lowerEndpoint(); i <= shardingValue.getValueRange().upperEndpoint(); i++) {
for (String each : availableTargetNames) {
- if (each.endsWith(i % 2 + "")) {
+ if (each.endsWith(String.valueOf(i % 2))) {
result.add(each);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloTableShardingAlgorithm.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algori [...]
index 519ad19..6a0433d 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloTableShardingAlgorithm.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/algorithm/StandardModuloTableShardingAlgorithm.java
@@ -40,7 +40,7 @@ public final class StandardModuloTableShardingAlgorithm implements StandardShard
@Override
public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Integer> shardingValue) {
for (String each : availableTargetNames) {
- if (each.endsWith(shardingValue.getValue() % 4 + "")) {
+ if (each.endsWith(String.valueOf(shardingValue.getValue() % 4))) {
return each;
}
}
@@ -52,7 +52,7 @@ public final class StandardModuloTableShardingAlgorithm implements StandardShard
Collection<String> result = new LinkedHashSet<>(availableTargetNames.size());
for (Integer i = shardingValue.getValueRange().lowerEndpoint(); i <= shardingValue.getValueRange().upperEndpoint(); i++) {
for (String each : availableTargetNames) {
- if (each.endsWith(i % 4 + "")) {
+ if (each.endsWith(String.valueOf(i % 4))) {
result.add(each);
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetter.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetter.java
index 8166b5e..fdf57b0 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetter.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/datasource/DataSourceMapSetter.java
@@ -96,7 +96,7 @@ public final class DataSourceMapSetter {
}
DataSource result = DataSourceUtil.getDataSource(dataSourceProps.get(DATA_SOURCE_TYPE).toString(), dataSourceProps);
DataSourcePropertiesSetterHolder.getDataSourcePropertiesSetterByType(dataSourceProps.get(DATA_SOURCE_TYPE).toString()).ifPresent(
- dataSourcePropertiesSetter -> dataSourcePropertiesSetter.propertiesSet(environment, prefix, dataSourceName, result));
+ propsSetter -> propsSetter.propertiesSet(environment, prefix, dataSourceName, result));
return result;
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/sctl/hint/internal/executor/AbstractHintQueryExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/sctl/hint/internal/executor/AbstractHintQueryExecutor.java
index 14729f3..1ed4034 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/sctl/hint/internal/executor/AbstractHintQueryExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/sctl/hint/internal/executor/AbstractHintQueryExecutor.java
@@ -39,7 +39,7 @@ public abstract class AbstractHintQueryExecutor<T extends HintCommand> implement
private MergedResult mergedResult;
@Override
- public final BackendResponse execute(final T command) {
+ public final BackendResponse execute(final T hintCommand) {
queryHeaders = createQueryHeaders();
mergedResult = createMergedResult();
return new QueryResponse(queryHeaders);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
index 26cd636..623b7d9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/BackendConnectionTest.java
@@ -42,15 +42,16 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -148,7 +149,7 @@ public final class BackendConnectionTest {
@SneakyThrows(ReflectiveOperationException.class)
private void setMethodInvocation() {
MethodInvocation invocation = mock(MethodInvocation.class);
- Collection<MethodInvocation> methodInvocations = new ArrayList<>();
+ Collection<MethodInvocation> methodInvocations = new LinkedList<>();
methodInvocations.add(invocation);
Field field = backendConnection.getClass().getDeclaredField("methodInvocations");
field.setAccessible(true);
@@ -229,7 +230,7 @@ public final class BackendConnectionTest {
} catch (final SQLException ex) {
assertThat(ex.getNextException().getNextException(), instanceOf(SQLException.class));
}
- assert actual != null;
+ assertNotNull(actual);
assertThat(actual.getConnectionSize(), is(0));
assertTrue(actual.getCachedConnections().isEmpty());
assertTrue(actual.getCachedResultSets().isEmpty());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MockConnectionUtil.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MockConnectionUtil.java
index c077d10..04aca57 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MockConnectionUtil.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/connection/MockConnectionUtil.java
@@ -40,13 +40,13 @@ final class MockConnectionUtil {
* Mock set cached connections.
*
* @param backendConnection backend connection
- * @param dsName datasource name
+ * @param dataSourceName datasource name
* @param connectionSize connection size
*/
@SneakyThrows(ReflectiveOperationException.class)
- static void setCachedConnections(final BackendConnection backendConnection, final String dsName, final int connectionSize) {
+ static void setCachedConnections(final BackendConnection backendConnection, final String dataSourceName, final int connectionSize) {
Multimap<String, Connection> cachedConnections = HashMultimap.create();
- cachedConnections.putAll(dsName, mockNewConnections(connectionSize));
+ cachedConnections.putAll(dataSourceName, mockNewConnections(connectionSize));
Field field = backendConnection.getClass().getDeclaredField("cachedConnections");
field.setAccessible(true);
field.set(backendConnection, cachedConnections);
@@ -59,7 +59,7 @@ final class MockConnectionUtil {
* @return list of connection
*/
static List<Connection> mockNewConnections(final int connectionSize) {
- List<Connection> result = new ArrayList<>();
+ List<Connection> result = new ArrayList<>(connectionSize);
for (int i = 0; i < connectionSize; i++) {
result.add(mock(Connection.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
index a702fcc..7bef4fa 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/datasource/JDBCBackendDataSourceTest.java
@@ -36,9 +36,10 @@ import javax.sql.DataSource;
import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -112,11 +113,11 @@ public final class JDBCBackendDataSourceTest {
@Test
public void assertGetConnectionsByMultiThread() {
ExecutorService executorService = Executors.newFixedThreadPool(20);
- List<Future<List<Connection>>> futures = new ArrayList<>();
+ Collection<Future<List<Connection>>> futures = new LinkedList<>();
for (int i = 0; i < 200; i++) {
futures.add(executorService.submit(new CallableTask("ds_1", 6, ConnectionMode.MEMORY_STRICTLY)));
}
- List<Connection> actual = new ArrayList<>();
+ Collection<Connection> actual = new LinkedList<>();
for (Future<List<Connection>> each : futures) {
try {
actual.addAll(each.get());
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/record/RecordUtil.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/record/RecordUtil.java
index 54c22fb..d9e38bb 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/record/RecordUtil.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/execute/executor/record/RecordUtil.java
@@ -37,7 +37,7 @@ public final class RecordUtil {
* @return primary columns
*/
public static List<Column> extractPrimaryColumns(final DataRecord dataRecord) {
- List<Column> result = new ArrayList<>();
+ List<Column> result = new ArrayList<>(dataRecord.getColumns().size());
for (Column each : dataRecord.getColumns()) {
if (each.isPrimaryKey()) {
result.add(each);
@@ -54,7 +54,7 @@ public final class RecordUtil {
* @return condition columns
*/
public static List<Column> extractConditionColumns(final DataRecord dataRecord, final Set<String> shardingColumns) {
- List<Column> result = new ArrayList<>();
+ List<Column> result = new ArrayList<>(dataRecord.getColumns().size());
for (Column each : dataRecord.getColumns()) {
if (each.isPrimaryKey() || shardingColumns.contains(each.getName())) {
result.add(each);
@@ -70,7 +70,7 @@ public final class RecordUtil {
* @return updated columns
*/
public static List<Column> extractUpdatedColumns(final DataRecord dataRecord) {
- List<Column> result = new ArrayList<>();
+ List<Column> result = new ArrayList<>(dataRecord.getColumns().size());
for (Column each : dataRecord.getColumns()) {
if (each.isUpdated()) {
result.add(each);
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/AbstractResumeBreakPointManager.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/AbstractResumeBreakPointManager.java
index cf8e417..d312c7e 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/AbstractResumeBreakPointManager.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/AbstractResumeBreakPointManager.java
@@ -94,7 +94,7 @@ public abstract class AbstractResumeBreakPointManager implements ResumeBreakPoin
log.info("resume incremental position from {} = {}", taskPath, data);
Map<String, Object> incrementalPosition = GSON.<Map<String, Object>>fromJson(data, Map.class);
for (Entry<String, Object> entry : incrementalPosition.entrySet()) {
- getIncrementalPositionManagerMap().put(entry.getKey(), PositionManagerFactory.newInstance(databaseType, entry.getValue().toString()));
+ incrementalPositionManagerMap.put(entry.getKey(), PositionManagerFactory.newInstance(databaseType, entry.getValue().toString()));
}
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceCheckerTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceCheckerTest.java
index 4e10b15..3164f9d 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceCheckerTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/job/preparer/checker/AbstractDataSourceCheckerTest.java
@@ -27,8 +27,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -57,7 +57,7 @@ public final class AbstractDataSourceCheckerTest {
public void checkVariable(final Collection<? extends DataSource> dataSources) {
}
};
- dataSources = new ArrayList<>();
+ dataSources = new LinkedList<>();
dataSources.add(dataSource);
}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/binlog/BinlogPosition.java b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/binlog/BinlogPosition.java
index 40801c6..ed3ba2a 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/binlog/BinlogPosition.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-mysql/src/main/java/org/apache/shardingsphere/scaling/mysql/binlog/BinlogPosition.java
@@ -58,7 +58,7 @@ public class BinlogPosition implements IncrementalPosition {
}
private long toLong() {
- return Long.parseLong(filename.substring(filename.lastIndexOf(".") + 1)) << 32 | position;
+ return Long.parseLong(filename.substring(filename.lastIndexOf('.') + 1)) << 32 | position;
}
@Override
diff --git a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceCheckerTest.java b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceCheckerTest.java
index 3f91be6..592c907 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceCheckerTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-postgresql/src/test/java/org/apache/shardingsphere/scaling/postgresql/PostgreSQLDataSourceCheckerTest.java
@@ -31,8 +31,8 @@ import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -56,7 +56,7 @@ public class PostgreSQLDataSourceCheckerTest {
DataSource dataSource = mock(DataSource.class);
Connection connection = mockConnection();
when(dataSource.getConnection()).thenReturn(connection);
- dataSources = new ArrayList<>();
+ dataSources = new LinkedList<>();
dataSources.add(dataSource);
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDMLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDMLVisitor.java
index b1520ca..f029daf 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDMLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/impl/PostgreSQLDMLVisitor.java
@@ -53,7 +53,6 @@ import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.Se
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SetClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SetClauseListContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SetTargetContext;
-import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SetTargetListContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.SimpleSelectContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TableReferenceContext;
import org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser.TargetElContext;
@@ -288,11 +287,6 @@ public final class PostgreSQLDMLVisitor extends PostgreSQLVisitor implements DML
}
@Override
- public ASTNode visitSetTargetList(final SetTargetListContext ctx) {
- return super.visitSetTargetList(ctx);
- }
-
- @Override
public ASTNode visitDelete(final DeleteContext ctx) {
DeleteStatement result = new DeleteStatement();
SimpleTableSegment tableSegment = (SimpleTableSegment) visit(ctx.relationExprOptAlias());
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/segment/dml/order/item/TextOrderByItemSegment.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/segment/dml/order/item/TextOrderByItemSegment.java
index deb7d3b..f8b2e94 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/segment/dml/order/item/TextOrderByItemSegment.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/segment/dml/order/item/TextOrderByItemSegment.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.sql.parser.sql.constant.OrderDirection;
*/
public abstract class TextOrderByItemSegment extends OrderByItemSegment {
- public TextOrderByItemSegment(final int startIndex, final int stopIndex, final OrderDirection orderDirection, final OrderDirection nullOrderDirection) {
+ protected TextOrderByItemSegment(final int startIndex, final int stopIndex, final OrderDirection orderDirection, final OrderDirection nullOrderDirection) {
super(startIndex, stopIndex, orderDirection, nullOrderDirection);
}
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourceSwapper.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourceSwapper.java
index beed5d3..a31e537 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourceSwapper.java
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourceSwapper.java
@@ -97,7 +97,7 @@ public final class DataSourceSwapper {
}
private Map<String, Object> getDatabaseAccessConfiguration(final DataSource dataSource) {
- Map<String, Object> result = new HashMap<>();
+ Map<String, Object> result = new HashMap<>(3, 1);
DataSourcePropertyProvider provider = DataSourcePropertyProviderLoader.getProvider(dataSource);
try {
result.put("url", findGetterMethod(dataSource, provider.getURLPropertyName()).invoke(dataSource));