You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2024/08/29 14:49:57 UTC

(rocketmq) branch bazel-dev created (now fe0893b0f8)

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

lizhanhui pushed a change to branch bazel-dev
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


      at fe0893b0f8 fix: upgrade bazel version and fix DoubleBraceInitialization issue

This branch includes the following new commits:

     new 0745007ec8 fix: upgrade bazel version
     new fe0893b0f8 fix: upgrade bazel version and fix DoubleBraceInitialization issue

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(rocketmq) 02/02: fix: upgrade bazel version and fix DoubleBraceInitialization issue

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch bazel-dev
in repository https://gitbox.apache.org/repos/asf/rocketmq.git

commit fe0893b0f80493b6582c099dbedd5e7ff7fafb6b
Author: Li Zhanhui <li...@gmail.com>
AuthorDate: Thu Aug 29 14:48:08 2024 +0000

    fix: upgrade bazel version and fix DoubleBraceInitialization issue
---
 .bazelrc                                           | 35 +++++-----------------
 WORKSPACE                                          |  6 ++--
 .../broker/metrics/BrokerMetricsManager.java       |  7 ++---
 .../broker/offset/ConsumerOffsetManagerTest.java   |  8 ++---
 .../offset/RocksDBConsumerOffsetManagerTest.java   |  8 ++---
 .../proxy/grpc/interceptor/RequestMapping.java     | 27 ++++++++---------
 .../activity/AbstractRemotingActivity.java         | 16 +++++-----
 .../rocketmq/remoting/common/RemotingHelper.java   | 23 +++++++-------
 .../apache/rocketmq/store/timer/TimerMetrics.java  | 19 ++++++------
 .../store/ha/autoswitch/AutoSwitchHATest.java      |  7 ++---
 .../rocketmq/store/timer/TimerMetricsTest.java     | 19 ++++++------
 .../tieredstore/util/MessageStoreUtilTest.java     | 27 ++++++++---------
 .../tools/admin/DefaultMQAdminExtTest.java         | 10 +++----
 13 files changed, 94 insertions(+), 118 deletions(-)

diff --git a/.bazelrc b/.bazelrc
index acc666c240..143e2f0820 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -20,15 +20,13 @@ run --color=yes
 
 build --color=yes
 build --enable_platform_specific_config
+build --experimental_strict_java_deps=warn
+build --jvmopt=--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
 
 test --action_env=TEST_TMPDIR=/tmp
-
 test  --experimental_strict_java_deps=warn
 test  --experimental_ui_max_stdouterr_bytes=10485760
-build --experimental_strict_java_deps=warn
-build --jvmopt=--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
 test  --jvmopt=--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
-
 test --test_output=errors
 
 
@@ -43,29 +41,12 @@ test --test_output=errors
 # for a remote machine to execute them.
 build:remote --jobs=150
 
+build:remote --bes_results_url=https://app.buildbuddy.io/invocation/
+build:remote --bes_backend=grpcs://remote.buildbuddy.io
+build:remote --remote_cache=grpcs://remote.buildbuddy.io
+build:remote --remote_timeout=3600
 build:remote --remote_executor=grpcs://remote.buildbuddy.io
+build:remote --remote_header=x-buildbuddy-api-key=FD819nUEY7WjvqmoufsU
 build:remote --host_platform=@buildbuddy_toolchain//:platform
 build:remote --platforms=@buildbuddy_toolchain//:platform
-build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform
-build:remote --crosstool_top=@buildbuddy_toolchain//:toolchain
-build:remote --extra_toolchains=@buildbuddy_toolchain//:cc_toolchain
-build:remote --javabase=@buildbuddy_toolchain//:javabase_jdk8
-build:remote --host_javabase=@buildbuddy_toolchain//:javabase_jdk8
-build:remote --java_toolchain=@buildbuddy_toolchain//:toolchain_jdk8
-build:remote --host_java_toolchain=@buildbuddy_toolchain//:toolchain_jdk8
-build:remote --define=EXECUTOR=remote
-
-# Enable remote execution so actions are performed on the remote systems.
-build:remote --remote_executor=grpcs://remote.buildbuddy.io
-
-# Enforce stricter environment rules, which eliminates some non-hermetic
-# behavior and therefore improves both the remote cache hit rate and the
-# correctness and repeatability of the build.
-build:remote --incompatible_strict_action_env=true
-
-# Set a higher timeout value, just in case.
-build:remote --remote_timeout=3600
-
-# Use a pre-configured account, such that we may have pull-request replacing pull-request-target
-build:remote --remote_header=x-buildbuddy-api-key=FD819nUEY7WjvqmoufsU
-test:remote --remote_header=x-buildbuddy-api-key=FD819nUEY7WjvqmoufsU
+build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform
\ No newline at end of file
diff --git a/WORKSPACE b/WORKSPACE
index e1f7743302..5bb59521cd 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -122,9 +122,9 @@ maven_install(
 
 http_archive(
     name = "io_buildbuddy_buildbuddy_toolchain",
-    sha256 = "b12273608db627eb14051eb75f8a2134590172cd69392086d392e25f3954ea6e",
-    strip_prefix = "buildbuddy-toolchain-8d5d18373adfca9d8e33b4812915abc9b132f1ee",
-    urls = ["https://github.com/buildbuddy-io/buildbuddy-toolchain/archive/8d5d18373adfca9d8e33b4812915abc9b132f1ee.tar.gz"],
+    sha256 = "baa9af1b9fcc96d18ac90a4dd68ebd2046c8beb76ed89aea9aabca30959ad30c",
+    strip_prefix = "buildbuddy-toolchain-287d6042ad151be92de03c83ef48747ba832c4e2",
+    urls = ["https://github.com/buildbuddy-io/buildbuddy-toolchain/archive/287d6042ad151be92de03c83ef48747ba832c4e2.tar.gz"],
 )
 load("@io_buildbuddy_buildbuddy_toolchain//:deps.bzl", "buildbuddy_deps")
 buildbuddy_deps()
diff --git a/broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java b/broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java
index d8d94f8e69..38af2134ac 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java
@@ -162,10 +162,9 @@ public class BrokerMetricsManager {
     public static LongCounter rollBackMessagesTotal = new NopLongCounter();
     public static LongHistogram transactionFinishLatency = new NopLongHistogram();
 
-    public static final List<String> SYSTEM_GROUP_PREFIX_LIST = new ArrayList<String>() {
-        {
-            add(MixAll.CID_RMQ_SYS_PREFIX.toLowerCase());
-        }
+    public static final List<String> SYSTEM_GROUP_PREFIX_LIST = new ArrayList<String>();
+    static {
+        SYSTEM_GROUP_PREFIX_LIST.add(MixAll.CID_RMQ_SYS_PREFIX.toLowerCase());
     };
 
     public BrokerMetricsManager(BrokerController brokerController) {
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManagerTest.java b/broker/src/test/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
index 7bd289a6f1..5e043ee70e 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
@@ -46,10 +46,10 @@ public class ConsumerOffsetManagerTest {
         Mockito.when(brokerController.getMessageStoreConfig()).thenReturn(messageStoreConfig);
 
         ConcurrentHashMap<String, ConcurrentMap<Integer, Long>> offsetTable = new ConcurrentHashMap<>(512);
-        offsetTable.put(KEY,new ConcurrentHashMap<Integer, Long>() {{
-                put(1,2L);
-                put(2,3L);
-            }});
+        ConcurrentMap<Integer, Long> queueOffsets = new ConcurrentHashMap<Integer, Long>();
+        queueOffsets.put(1,2L);
+        queueOffsets.put(2,3L);
+        offsetTable.put(KEY, queueOffsets);
         consumerOffsetManager.setOffsetTable(offsetTable);
     }
 
diff --git a/broker/src/test/java/org/apache/rocketmq/broker/offset/RocksDBConsumerOffsetManagerTest.java b/broker/src/test/java/org/apache/rocketmq/broker/offset/RocksDBConsumerOffsetManagerTest.java
index 58b690c9a3..f439c63e55 100644
--- a/broker/src/test/java/org/apache/rocketmq/broker/offset/RocksDBConsumerOffsetManagerTest.java
+++ b/broker/src/test/java/org/apache/rocketmq/broker/offset/RocksDBConsumerOffsetManagerTest.java
@@ -52,10 +52,10 @@ public class RocksDBConsumerOffsetManagerTest {
         consumerOffsetManager.load();
 
         ConcurrentHashMap<String, ConcurrentMap<Integer, Long>> offsetTable = new ConcurrentHashMap<>(512);
-        offsetTable.put(KEY,new ConcurrentHashMap<Integer, Long>() {{
-                put(1,2L);
-                put(2,3L);
-            }});
+        ConcurrentMap<Integer, Long> queueOffsets = new ConcurrentHashMap<Integer, Long>();
+        queueOffsets.put(1,2L);
+        queueOffsets.put(2,3L);
+        offsetTable.put(KEY, queueOffsets);
         consumerOffsetManager.setOffsetTable(offsetTable);
     }
 
diff --git a/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/interceptor/RequestMapping.java b/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/interceptor/RequestMapping.java
index 866124d747..41c62e455e 100644
--- a/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/interceptor/RequestMapping.java
+++ b/proxy/src/main/java/org/apache/rocketmq/proxy/grpc/interceptor/RequestMapping.java
@@ -32,20 +32,19 @@ import java.util.Map;
 import org.apache.rocketmq.remoting.protocol.RequestCode;
 
 public class RequestMapping {
-    private final static Map<String, Integer> REQUEST_MAP = new HashMap<String, Integer>() {
-        {
-            // v2
-            put(QueryRouteRequest.getDescriptor().getFullName(), RequestCode.GET_ROUTEINFO_BY_TOPIC);
-            put(HeartbeatRequest.getDescriptor().getFullName(), RequestCode.HEART_BEAT);
-            put(SendMessageRequest.getDescriptor().getFullName(), RequestCode.SEND_MESSAGE_V2);
-            put(QueryAssignmentRequest.getDescriptor().getFullName(), RequestCode.GET_ROUTEINFO_BY_TOPIC);
-            put(ReceiveMessageRequest.getDescriptor().getFullName(), RequestCode.PULL_MESSAGE);
-            put(AckMessageRequest.getDescriptor().getFullName(), RequestCode.UPDATE_CONSUMER_OFFSET);
-            put(ForwardMessageToDeadLetterQueueResponse.getDescriptor().getFullName(), RequestCode.CONSUMER_SEND_MSG_BACK);
-            put(EndTransactionRequest.getDescriptor().getFullName(), RequestCode.END_TRANSACTION);
-            put(NotifyClientTerminationRequest.getDescriptor().getFullName(), RequestCode.UNREGISTER_CLIENT);
-            put(ChangeInvisibleDurationRequest.getDescriptor().getFullName(), RequestCode.CONSUMER_SEND_MSG_BACK);
-        }
+    private final static Map<String, Integer> REQUEST_MAP = new HashMap<String, Integer>();
+    static {
+        // v2
+        REQUEST_MAP.put(QueryRouteRequest.getDescriptor().getFullName(), RequestCode.GET_ROUTEINFO_BY_TOPIC);
+        REQUEST_MAP.put(HeartbeatRequest.getDescriptor().getFullName(), RequestCode.HEART_BEAT);
+        REQUEST_MAP.put(SendMessageRequest.getDescriptor().getFullName(), RequestCode.SEND_MESSAGE_V2);
+        REQUEST_MAP.put(QueryAssignmentRequest.getDescriptor().getFullName(), RequestCode.GET_ROUTEINFO_BY_TOPIC);
+        REQUEST_MAP.put(ReceiveMessageRequest.getDescriptor().getFullName(), RequestCode.PULL_MESSAGE);
+        REQUEST_MAP.put(AckMessageRequest.getDescriptor().getFullName(), RequestCode.UPDATE_CONSUMER_OFFSET);
+        REQUEST_MAP.put(ForwardMessageToDeadLetterQueueResponse.getDescriptor().getFullName(), RequestCode.CONSUMER_SEND_MSG_BACK);
+        REQUEST_MAP.put(EndTransactionRequest.getDescriptor().getFullName(), RequestCode.END_TRANSACTION);
+        REQUEST_MAP.put(NotifyClientTerminationRequest.getDescriptor().getFullName(), RequestCode.UNREGISTER_CLIENT);
+        REQUEST_MAP.put(ChangeInvisibleDurationRequest.getDescriptor().getFullName(), RequestCode.CONSUMER_SEND_MSG_BACK);
     };
 
     public static int map(String rpcFullName) {
diff --git a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/AbstractRemotingActivity.java b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/AbstractRemotingActivity.java
index 299d8def03..863ea1414e 100644
--- a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/AbstractRemotingActivity.java
+++ b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/AbstractRemotingActivity.java
@@ -45,14 +45,14 @@ public abstract class AbstractRemotingActivity implements NettyRequestProcessor
     protected final MessagingProcessor messagingProcessor;
     protected static final String BROKER_NAME_FIELD = "bname";
     protected static final String BROKER_NAME_FIELD_FOR_SEND_MESSAGE_V2 = "n";
-    private static final Map<ProxyExceptionCode, Integer> PROXY_EXCEPTION_RESPONSE_CODE_MAP = new HashMap<ProxyExceptionCode, Integer>() {
-        {
-            put(ProxyExceptionCode.FORBIDDEN, ResponseCode.NO_PERMISSION);
-            put(ProxyExceptionCode.MESSAGE_PROPERTY_CONFLICT_WITH_TYPE, ResponseCode.MESSAGE_ILLEGAL);
-            put(ProxyExceptionCode.INTERNAL_SERVER_ERROR, ResponseCode.SYSTEM_ERROR);
-            put(ProxyExceptionCode.TRANSACTION_DATA_NOT_FOUND, ResponseCode.SUCCESS);
-        }
-    };
+    private static final Map<ProxyExceptionCode, Integer> PROXY_EXCEPTION_RESPONSE_CODE_MAP = new HashMap<ProxyExceptionCode, Integer>();
+    static {
+        PROXY_EXCEPTION_RESPONSE_CODE_MAP.put(ProxyExceptionCode.FORBIDDEN, ResponseCode.NO_PERMISSION);
+        PROXY_EXCEPTION_RESPONSE_CODE_MAP.put(ProxyExceptionCode.MESSAGE_PROPERTY_CONFLICT_WITH_TYPE, ResponseCode.MESSAGE_ILLEGAL);
+        PROXY_EXCEPTION_RESPONSE_CODE_MAP.put(ProxyExceptionCode.INTERNAL_SERVER_ERROR, ResponseCode.SYSTEM_ERROR);
+        PROXY_EXCEPTION_RESPONSE_CODE_MAP.put(ProxyExceptionCode.TRANSACTION_DATA_NOT_FOUND, ResponseCode.SUCCESS);
+    }
+    
     protected final RequestPipeline requestPipeline;
 
     public AbstractRemotingActivity(RequestPipeline requestPipeline, MessagingProcessor messagingProcessor) {
diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java b/remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java
index 552fd2b15f..1010b8e1c1 100644
--- a/remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java
+++ b/remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingHelper.java
@@ -51,13 +51,15 @@ public class RemotingHelper {
 
     private static final Logger log = LoggerFactory.getLogger(LoggerName.ROCKETMQ_REMOTING_NAME);
 
-    public static final Map<Integer, String> REQUEST_CODE_MAP = new HashMap<Integer, String>() {
+    // See https://errorprone.info/bugpattern/DoubleBraceInitialization
+    public static final Map<Integer, String> REQUEST_CODE_MAP = new HashMap<Integer, String>();
+    static {
         {
             try {
                 Field[] f = RequestCode.class.getFields();
                 for (Field field : f) {
                     if (field.getType() == int.class) {
-                        put((int) field.get(null), field.getName().toLowerCase());
+                        REQUEST_CODE_MAP.put((int) field.get(null), field.getName().toLowerCase());
                     }
                 }
             } catch (IllegalAccessException ignore) {
@@ -65,17 +67,16 @@ public class RemotingHelper {
         }
     };
 
-    public static final Map<Integer, String> RESPONSE_CODE_MAP = new HashMap<Integer, String>() {
-        {
-            try {
-                Field[] f = ResponseCode.class.getFields();
-                for (Field field : f) {
-                    if (field.getType() == int.class) {
-                        put((int) field.get(null), field.getName().toLowerCase());
-                    }
+    public static final Map<Integer, String> RESPONSE_CODE_MAP = new HashMap<Integer, String>();
+    static {
+        try {
+            Field[] f = ResponseCode.class.getFields();
+            for (Field field : f) {
+                if (field.getType() == int.class) {
+                    RESPONSE_CODE_MAP.put((int) field.get(null), field.getName().toLowerCase());
                 }
-            } catch (IllegalAccessException ignore) {
             }
+        } catch (IllegalAccessException ignore) {
         }
     };
 
diff --git a/store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java b/store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java
index 7f8fedd8a5..b0586d5f49 100644
--- a/store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java
+++ b/store/src/main/java/org/apache/rocketmq/store/timer/TimerMetrics.java
@@ -57,22 +57,21 @@ public class TimerMetrics extends ConfigManager {
     private final ConcurrentMap<Integer, Metric> timingDistribution =
             new ConcurrentHashMap<>(1024);
 
-    public List<Integer> timerDist = new ArrayList<Integer>() {{
-            add(5);
-            add(60);
-            add(300); // 5s, 1min, 5min
-            add(900);
-            add(3600);
-            add(14400); // 15min, 1h, 4h
-            add(28800);
-            add(86400); // 8h, 24h
-        }};
+    public List<Integer> timerDist = new ArrayList<Integer>();
     private final DataVersion dataVersion = new DataVersion();
 
     private final String configPath;
 
     public TimerMetrics(String configPath) {
         this.configPath = configPath;
+        timerDist.add(5);     // 5s
+        timerDist.add(60);    // 1min
+        timerDist.add(300);   // 5min
+        timerDist.add(900);   // 15min
+        timerDist.add(3600);  // 1h
+        timerDist.add(14400); // 4h
+        timerDist.add(28800); // 8h
+        timerDist.add(86400); // 24h
     }
 
     public long updateDistPair(int period, int value) {
diff --git a/store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java b/store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java
index 7d659d2f6a..2ecdfeeacc 100644
--- a/store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java
+++ b/store/src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest.java
@@ -471,10 +471,9 @@ public class AutoSwitchHATest {
         Assert.assertTrue(syncStateSet.contains(1L));
 
         // Step3: set new syncStateSet
-        HashSet<Long> newSyncStateSet = new HashSet<Long>() {{
-                add(1L);
-                add(2L);
-                }};
+        HashSet<Long> newSyncStateSet = new HashSet<Long>();
+        newSyncStateSet.add(1L);
+        newSyncStateSet.add(2L);
         masterHAService.setSyncStateSet(newSyncStateSet);
         Assert.assertFalse(masterHAService.isSynchronizingSyncStateSet());
     }
diff --git a/store/src/test/java/org/apache/rocketmq/store/timer/TimerMetricsTest.java b/store/src/test/java/org/apache/rocketmq/store/timer/TimerMetricsTest.java
index 3c7b9b67fb..273cce62bd 100644
--- a/store/src/test/java/org/apache/rocketmq/store/timer/TimerMetricsTest.java
+++ b/store/src/test/java/org/apache/rocketmq/store/timer/TimerMetricsTest.java
@@ -60,16 +60,15 @@ public class TimerMetricsTest {
     public void testTimingDistribution() {
         String baseDir = StoreTestUtils.createBaseDir();
         TimerMetrics first = new TimerMetrics(baseDir);
-        List<Integer> timerDist = new ArrayList<Integer>() {{
-                add(5);
-                add(60);
-                add(300); // 5s, 1min, 5min
-                add(900);
-                add(3600);
-                add(14400); // 15min, 1h, 4h
-                add(28800);
-                add(86400); // 8h, 24h
-            }};
+        List<Integer> timerDist = new ArrayList<Integer>();
+        timerDist.add(5);
+        timerDist.add(60);
+        timerDist.add(300); // 5s, 1min, 5min
+        timerDist.add(900);
+        timerDist.add(3600);
+        timerDist.add(14400); // 15min, 1h, 4h
+        timerDist.add(28800);
+        timerDist.add(86400); // 8h, 24h
         for (int period : timerDist) {
             first.updateDistPair(period, period);
         }
diff --git a/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/util/MessageStoreUtilTest.java b/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/util/MessageStoreUtilTest.java
index cadaef8708..ed207dc9cb 100644
--- a/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/util/MessageStoreUtilTest.java
+++ b/tieredstore/src/test/java/org/apache/rocketmq/tieredstore/util/MessageStoreUtilTest.java
@@ -49,20 +49,19 @@ public class MessageStoreUtilTest {
 
     @Test
     public void toHumanReadableTest() {
-        Map<Long, String> capacityTable = new HashMap<Long, String>() {
-            {
-                put(-1L, "-1");
-                put(0L, "0B");
-                put(1023L, "1023B");
-                put(1024L, "1KB");
-                put(12_345L, "12.06KB");
-                put(10_123_456L, "9.65MB");
-                put(10_123_456_798L, "9.43GB");
-                put(123 * 1024L * 1024L * 1024L * 1024L, "123TB");
-                put(123 * 1024L * 1024L * 1024L * 1024L * 1024L, "123PB");
-                put(1_777_777_777_777_777_777L, "1.54EB");
-            }
-        };
+        // https://errorprone.info/bugpattern/DoubleBraceInitialization
+        Map<Long, String> capacityTable = new HashMap<Long, String>();
+        capacityTable.put(-1L, "-1");
+        capacityTable.put(0L, "0B");
+        capacityTable.put(1023L, "1023B");
+        capacityTable.put(1024L, "1KB");
+        capacityTable.put(12_345L, "12.06KB");
+        capacityTable.put(10_123_456L, "9.65MB");
+        capacityTable.put(10_123_456_798L, "9.43GB");
+        capacityTable.put(123 * 1024L * 1024L * 1024L * 1024L, "123TB");
+        capacityTable.put(123 * 1024L * 1024L * 1024L * 1024L * 1024L, "123PB");
+        capacityTable.put(1_777_777_777_777_777_777L, "1.54EB");
+
         capacityTable.forEach((in, expected) ->
             Assert.assertEquals(expected, MessageStoreUtil.toHumanReadable(in)));
     }
diff --git a/tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java b/tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
index dc5642f88c..91f6bb7b84 100644
--- a/tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
+++ b/tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
@@ -29,6 +29,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 import org.apache.rocketmq.client.ClientConfig;
 import org.apache.rocketmq.client.exception.MQBrokerException;
 import org.apache.rocketmq.client.exception.MQClientException;
@@ -255,11 +256,10 @@ public class DefaultMQAdminExtTest {
         when(mQClientAPIImpl.getConsumerRunningInfo(anyString(), anyString(), anyString(), anyBoolean(), anyLong())).thenReturn(consumerRunningInfo);
 
         TopicConfigSerializeWrapper topicConfigSerializeWrapper = new TopicConfigSerializeWrapper();
-        topicConfigSerializeWrapper.setTopicConfigTable(new ConcurrentHashMap<String, TopicConfig>() {
-            {
-                put("topic_test_examine_topicConfig", new TopicConfig("topic_test_examine_topicConfig"));
-            }
-        });
+
+        ConcurrentMap<String, TopicConfig> topicConfigTable = new ConcurrentHashMap<>();
+        topicConfigTable.put("topic_test_examine_topicConfig", new TopicConfig("topic_test_examine_topicConfig"));
+        topicConfigSerializeWrapper.setTopicConfigTable(topicConfigTable);
         //when(mQClientAPIImpl.getAllTopicConfig(anyString(),anyLong())).thenReturn(topicConfigSerializeWrapper);
         when(mQClientAPIImpl.getTopicConfig(anyString(), anyString(), anyLong())).thenReturn(new TopicConfigAndQueueMapping(new TopicConfig("topic_test_examine_topicConfig"), null));
     }


(rocketmq) 01/02: fix: upgrade bazel version

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch bazel-dev
in repository https://gitbox.apache.org/repos/asf/rocketmq.git

commit 0745007ec894861052fc07d22e00f3ad908d9e7a
Author: Zhanhui Li <li...@gmail.com>
AuthorDate: Thu Aug 29 18:09:42 2024 +0800

    fix: upgrade bazel version
    
    Signed-off-by: Zhanhui Li <li...@gmail.com>
---
 .bazelrc      | 2 ++
 .bazelversion | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.bazelrc b/.bazelrc
index 6ebc08d0dc..acc666c240 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -26,6 +26,8 @@ test --action_env=TEST_TMPDIR=/tmp
 test  --experimental_strict_java_deps=warn
 test  --experimental_ui_max_stdouterr_bytes=10485760
 build --experimental_strict_java_deps=warn
+build --jvmopt=--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
+test  --jvmopt=--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
 
 test --test_output=errors
 
diff --git a/.bazelversion b/.bazelversion
index 7cbea073be..1502020768 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-5.2.0
\ No newline at end of file
+7.3.0