You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2023/05/21 17:43:14 UTC

[shardingsphere] branch master updated: Fix sonar issues on Upper-case this literal "f" and "d" suffix (#25832)

This is an automated email from the ASF dual-hosted git repository.

sunnianjun 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 0a9defb5972 Fix sonar issues on Upper-case this literal "f" and "d" suffix (#25832)
0a9defb5972 is described below

commit 0a9defb5972c841fac778d2f624232285aeb64bf
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon May 22 01:43:07 2023 +0800

    Fix sonar issues on Upper-case this literal "f" and "d" suffix (#25832)
---
 .../advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java    | 4 ++--
 .../core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java      | 4 ++--
 .../collector/type/PrometheusMetricsCounterCollectorTest.java     | 2 +-
 .../collector/type/PrometheusMetricsGaugeCollectorTest.java       | 4 ++--
 .../type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java     | 2 +-
 .../column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java  | 4 ++--
 .../column/value/decimal/MySQLFloatBinlogProtocolValueTest.java   | 4 ++--
 .../execute/protocol/MySQLDoubleBinaryProtocolValueTest.java      | 8 ++++----
 .../execute/protocol/MySQLFloatBinaryProtocolValueTest.java       | 8 ++++----
 .../bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java    | 2 +-
 .../bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java     | 2 +-
 .../query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java      | 8 ++++----
 12 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
index 8379ba539e2..8ba1a362819 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/jdbc/AbstractExecuteLatencyHistogramAdviceTest.java
@@ -50,7 +50,7 @@ class AbstractExecuteLatencyHistogramAdviceTest {
         advice.beforeMethod(targetObject, method, new Object[]{}, "FIXTURE");
         Awaitility.await().pollDelay(200L, TimeUnit.MILLISECONDS).until(() -> true);
         advice.afterMethod(targetObject, method, new Object[]{}, null, "FIXTURE");
-        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(200d));
+        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(200D));
     }
     
     @Test
@@ -61,6 +61,6 @@ class AbstractExecuteLatencyHistogramAdviceTest {
         advice.beforeMethod(targetObject, method, new Object[]{}, "FIXTURE");
         Awaitility.await().pollDelay(200L, TimeUnit.MILLISECONDS).until(() -> true);
         advice.afterMethod(targetObject, method, new Object[]{}, null, "FIXTURE");
-        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(200d));
+        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(200D));
     }
 }
diff --git a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
index c8a22106942..d1857ef129f 100644
--- a/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
+++ b/agent/plugins/metrics/core/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/core/advice/proxy/ExecuteLatencyHistogramAdviceTest.java
@@ -55,7 +55,7 @@ class ExecuteLatencyHistogramAdviceTest {
         advice.beforeMethod(targetObject, method, args, "FIXTURE");
         Awaitility.await().pollDelay(500L, TimeUnit.MILLISECONDS).until(() -> true);
         advice.afterMethod(targetObject, method, args, null, "FIXTURE");
-        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(500d));
+        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), greaterThanOrEqualTo(500D));
     }
     
     @Test
@@ -67,6 +67,6 @@ class ExecuteLatencyHistogramAdviceTest {
         advice.beforeMethod(targetObject, method, args, "FIXTURE");
         Awaitility.await().pollDelay(20L, TimeUnit.MILLISECONDS).until(() -> true);
         advice.afterMethod(targetObject, method, args, null, "FIXTURE");
-        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), equalTo(0d));
+        assertThat(Double.parseDouble(MetricsCollectorRegistry.get(config, "FIXTURE").toString()), equalTo(0D));
     }
 }
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
index 806e9d4afcf..1bc601b0ffb 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsCounterCollectorTest.java
@@ -36,6 +36,6 @@ class PrometheusMetricsCounterCollectorTest {
                 MetricCollectorType.COUNTER, "foo_help", Collections.emptyList(), Collections.emptyMap()));
         collector.inc();
         Counter counter = (Counter) Plugins.getMemberAccessor().get(PrometheusMetricsCounterCollector.class.getDeclaredField("counter"), collector);
-        assertThat(counter.get(), is(1d));
+        assertThat(counter.get(), is(1D));
     }
 }
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
index de6ad0a7682..8eaceadef39 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeCollectorTest.java
@@ -36,8 +36,8 @@ class PrometheusMetricsGaugeCollectorTest {
                 MetricCollectorType.GAUGE, "foo_help", Collections.emptyList(), Collections.emptyMap()));
         collector.inc();
         Gauge gauge = (Gauge) Plugins.getMemberAccessor().get(PrometheusMetricsGaugeCollector.class.getDeclaredField("gauge"), collector);
-        assertThat(gauge.get(), is(1d));
+        assertThat(gauge.get(), is(1D));
         collector.dec();
-        assertThat(gauge.get(), is(0d));
+        assertThat(gauge.get(), is(0D));
     }
 }
diff --git a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
index 732b8267a44..4c1619cf36e 100644
--- a/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
+++ b/agent/plugins/metrics/type/prometheus/src/test/java/org/apache/shardingsphere/agent/plugin/metrics/prometheus/collector/type/PrometheusMetricsGaugeMetricFamilyCollectorTest.java
@@ -34,7 +34,7 @@ class PrometheusMetricsGaugeMetricFamilyCollectorTest {
     void assertCreate() throws ReflectiveOperationException {
         PrometheusMetricsGaugeMetricFamilyCollector collector = new PrometheusMetricsGaugeMetricFamilyCollector(new MetricConfiguration("foo_gauge_metric_family",
                 MetricCollectorType.GAUGE_METRIC_FAMILY, "foo_help", Collections.emptyList(), Collections.emptyMap()));
-        collector.addMetric(Collections.emptyList(), 1d);
+        collector.addMetric(Collections.emptyList(), 1D);
         assertThat(Plugins.getMemberAccessor().get(PrometheusMetricsGaugeMetricFamilyCollector.class.getDeclaredField("gaugeMetricFamily"), collector), instanceOf(GaugeMetricFamily.class));
     }
 }
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
index 19c24ca60e9..0bdbbfb8482 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLDoubleBinlogProtocolValueTest.java
@@ -44,8 +44,8 @@ class MySQLDoubleBinlogProtocolValueTest {
     @Test
     void assertRead() {
         when(payload.getByteBuf()).thenReturn(byteBuf);
-        when(byteBuf.readDoubleLE()).thenReturn(1.1d);
+        when(byteBuf.readDoubleLE()).thenReturn(1.1D);
         MySQLDoubleBinlogProtocolValue actual = new MySQLDoubleBinlogProtocolValue();
-        assertThat(actual.read(columnDef, payload), is(1.1d));
+        assertThat(actual.read(columnDef, payload), is(1.1D));
     }
 }
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
index b79332d9ade..55a2c165fc6 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/decimal/MySQLFloatBinlogProtocolValueTest.java
@@ -44,8 +44,8 @@ class MySQLFloatBinlogProtocolValueTest {
     @Test
     void assertRead() {
         when(payload.getByteBuf()).thenReturn(byteBuf);
-        when(byteBuf.readFloatLE()).thenReturn(1.1f);
+        when(byteBuf.readFloatLE()).thenReturn(1.1F);
         MySQLFloatBinlogProtocolValue actual = new MySQLFloatBinlogProtocolValue();
-        assertThat(actual.read(columnDef, payload), is(1.1f));
+        assertThat(actual.read(columnDef, payload), is(1.1F));
     }
 }
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
index 21e76d3eb10..b15c0bb0d3a 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLDoubleBinaryProtocolValueTest.java
@@ -39,13 +39,13 @@ class MySQLDoubleBinaryProtocolValueTest {
     
     @Test
     void assertRead() {
-        when(byteBuf.readDoubleLE()).thenReturn(1.0d);
-        assertThat(new MySQLDoubleBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), false), is(1.0d));
+        when(byteBuf.readDoubleLE()).thenReturn(1.0D);
+        assertThat(new MySQLDoubleBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), false), is(1.0D));
     }
     
     @Test
     void assertWrite() {
-        new MySQLDoubleBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1.0d);
-        verify(byteBuf).writeDoubleLE(1.0d);
+        new MySQLDoubleBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1.0D);
+        verify(byteBuf).writeDoubleLE(1.0D);
     }
 }
diff --git a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
index 3beaa90b75c..64051b8eaa1 100644
--- a/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
+++ b/db-protocol/mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/protocol/MySQLFloatBinaryProtocolValueTest.java
@@ -39,13 +39,13 @@ class MySQLFloatBinaryProtocolValueTest {
     
     @Test
     void assertRead() {
-        when(byteBuf.readFloatLE()).thenReturn(1.0f);
-        assertThat(new MySQLFloatBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), false), is(1.0f));
+        when(byteBuf.readFloatLE()).thenReturn(1.0F);
+        assertThat(new MySQLFloatBinaryProtocolValue().read(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), false), is(1.0F));
     }
     
     @Test
     void assertWrite() {
-        new MySQLFloatBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1.0f);
-        verify(byteBuf).writeFloatLE(1.0f);
+        new MySQLFloatBinaryProtocolValue().write(new MySQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1.0F);
+        verify(byteBuf).writeFloatLE(1.0F);
     }
 }
diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
index b1c1f3ee88c..217652137ae 100644
--- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
+++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
@@ -51,6 +51,6 @@ class PostgreSQLDoubleBinaryProtocolValueTest {
     @Test
     void assertWrite() {
         new PostgreSQLDoubleBinaryProtocolValue().write(new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1D);
-        verify(byteBuf).writeDouble(1.0d);
+        verify(byteBuf).writeDouble(1.0D);
     }
 }
diff --git a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
index 3ab932111ea..eb85485858d 100644
--- a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
+++ b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
@@ -51,6 +51,6 @@ class PostgreSQLFloatBinaryProtocolValueTest {
     @Test
     void assertWrite() {
         new PostgreSQLFloatBinaryProtocolValue().write(new PostgreSQLPacketPayload(byteBuf, StandardCharsets.UTF_8), 1F);
-        verify(byteBuf).writeFloat(1.0f);
+        verify(byteBuf).writeFloat(1.0F);
     }
 }
diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
index 3fbe2cf51e6..e50898caceb 100644
--- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
+++ b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtilsTest.java
@@ -80,8 +80,8 @@ class ResultSetUtilsTest {
         assertThat(ResultSetUtils.convertValue((short) 1, short.class), is((short) 1));
         assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), int.class), is(1));
         assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), long.class), is(1L));
-        assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), double.class), is(1.0d));
-        assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), float.class), is(1.0f));
+        assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), double.class), is(1.0D));
+        assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), float.class), is(1.0F));
         assertThat(ResultSetUtils.convertValue(new BigDecimal("1"), BigDecimal.class), is(new BigDecimal("1")));
         assertThat(ResultSetUtils.convertValue((short) 1, BigDecimal.class), is(new BigDecimal("1")));
         assertThat(ResultSetUtils.convertValue(new Date(0L), Date.class), is(new Date(0L)));
@@ -137,8 +137,8 @@ class ResultSetUtilsTest {
         assertThat(ResultSetUtils.convertValue(Shorts.toByteArray((short) 1), short.class), is((short) 1));
         assertThat(ResultSetUtils.convertValue(Ints.toByteArray(1), int.class), is(1));
         assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), long.class), is(1L));
-        assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), double.class), is(1.0d));
-        assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), float.class), is(1.0f));
+        assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), double.class), is(1.0D));
+        assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), float.class), is(1.0F));
         assertThat(ResultSetUtils.convertValue(Longs.toByteArray(1L), BigDecimal.class), is(new BigDecimal("1")));
     }