Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ 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 --java_language_version=8
build:remote --java_runtime_version=8
build:remote --define=EXECUTOR=remote

# Enable remote execution so actions are performed on the remote systems.
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.0
6.5.0
14 changes: 0 additions & 14 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
load("@bazel_toolchains//rules/exec_properties:exec_properties.bzl", "create_rbe_exec_properties_dict")

platform(
name = "custom_platform",
# Inherit from the platform target generated by 'rbe_configs_gen' assuming the generated configs
# were imported as a Bazel external repository named 'rbe_default'. If you extracted the
# generated configs elsewhere in your source repository, replace the following with the label
# to the 'platform' target in the generated configs.
parents = ["@rbe_default//config:platform"],
# Example custom execution property instructing RBE to use e2-standard-2 GCE VMs.
exec_properties = create_rbe_exec_properties_dict(
container_image = "ubuntu:latest",
),
)

java_library(
name = "test_deps",
Expand Down
32 changes: 26 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ maven_install(
"org.awaitility:awaitility:4.1.0",
"commons-cli:commons-cli:1.5.0",
"com.google.guava:guava:31.0.1-jre",
"org.yaml:snakeyaml:1.30",
"org.yaml:snakeyaml:2.0",
"commons-codec:commons-codec:1.13",
"commons-io:commons-io:2.7",
"com.google.truth:truth:0.30",
Expand Down Expand Up @@ -134,11 +134,31 @@ load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
buildbuddy(name = "buildbuddy_toolchain")

http_archive(
name = "bazel_toolchains",
sha256 = "1adf5db506a7e3c465a26988514cfc3971af6d5b3c2218925cd6e71ee443fc3f",
strip_prefix = "bazel-toolchains-4.0.0",
name = "bazel_skylib",
sha256 = "51b5105a760b353773f904d2bbc5e664d0987fbaf22265164de65d43e910d8ac",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.0.0/bazel-toolchains-4.0.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.8.1/bazel-skylib-1.8.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.8.1/bazel-skylib-1.8.1.tar.gz",
],
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

http_archive(
name = "rules_java",
urls = [
"https://github.com/bazelbuild/rules_java/releases/download/7.12.5/rules_java-7.12.5.tar.gz",
],
sha256 = "17b18cb4f92ab7b94aa343ce78531b73960b1bed2ba166e5b02c9fdf0b0ac270",
)
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
rules_java_dependencies()
rules_java_toolchains()

load("@rules_java//toolchains:local_java_repository.bzl", "local_java_repository")
local_java_repository(
name = "jdk8",
version = "8",
java_home = "/usr/lib/jvm/java-8-openjdk-amd64",
)
1 change: 0 additions & 1 deletion auth/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ java_library(
deps = [
"//common",
"//remoting",
"//srvutil",
"//client",
"@maven//:commons_codec_commons_codec",
"@maven//:org_apache_commons_commons_lang3",
Expand Down
2 changes: 1 addition & 1 deletion bazel/GenTestRules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def GenTestRules(
runtime_deps = deps,
resources = resources,
size = test_size,
jvm_flags = jvm_flags,
jvm_flags = jvm_flags + ["-Dbuild.bazel=true"],
args = args,
flaky = flaky,
tags = tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public class BrokerMetricsManager {
public static LongCounter rollBackMessagesTotal = new NopLongCounter();
public static LongHistogram transactionFinishLatency = new NopLongHistogram();

@SuppressWarnings("DoubleBraceInitialization")
public static final List<String> SYSTEM_GROUP_PREFIX_LIST = new ArrayList<String>() {
{
add(MixAll.CID_RMQ_SYS_PREFIX.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ConsumerOffsetManagerTest {
private ConsumerOffsetManager consumerOffsetManager;

@Before
@SuppressWarnings("DoubleBraceInitialization")
public void init() {
brokerController = Mockito.mock(BrokerController.class);
consumerOffsetManager = new ConsumerOffsetManager(brokerController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class RocksDBConsumerOffsetManagerTest {
private ConsumerOffsetManager consumerOffsetManager;

@Before
@SuppressWarnings("DoubleBraceInitialization")
public void init() {
if (notToBeExecuted()) {
return;
Expand Down
1 change: 1 addition & 0 deletions client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ GenTestRules(
],
exclude_tests = [
"src/test/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumerTest",
"src/test/java/org/apache/rocketmq/client/impl/mqclient/MQClientAPITest",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.remoting.RPCHook;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;

import java.io.File;
Expand Down Expand Up @@ -230,6 +231,8 @@ public void getAclRPCHookTest() throws IOException {

@Test
public void testGetAclRPCHookByFileName() {
// Skip this test if running in Bazel, as the resource path is a path inside the JAR.
Assume.assumeTrue(System.getProperty("build.bazel") == null);
RPCHook actual = AclUtils.getAclRPCHook(Objects.requireNonNull(AclUtilsTest.class.getResource("/acl_hook/plain_acl.yml")).getPath());
assertNotNull(actual);
assertTrue(actual instanceof AclClientRPCHook);
Expand Down
2 changes: 0 additions & 2 deletions controller/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ java_library(
deps = [
"//common",
"//remoting",
"//client",
"//srvutil",
"@maven//:io_openmessaging_storage_dledger",
"@maven//:org_apache_commons_commons_lang3",
Expand Down Expand Up @@ -65,7 +64,6 @@ java_library(
":controller",
"//common",
"//remoting",
"//client",
"//srvutil",
"@maven//:io_openmessaging_storage_dledger",
"//:test_deps",
Expand Down
2 changes: 0 additions & 2 deletions filter/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ java_library(
visibility = ["//visibility:public"],
deps = [
"//common",
"//remoting",
"//srvutil",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:commons_validator_commons_validator",
"@maven//:com_github_luben_zstd_jni",
Expand Down
2 changes: 2 additions & 0 deletions proxy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ java_library(
"//broker",
"//client",
"//common",
"//srvutil",
"//remoting",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_alibaba_fastjson",
Expand Down Expand Up @@ -118,6 +119,7 @@ GenTestRules(
name = "GeneratedTestRules",
exclude_tests = [
"src/test/java/org/apache/rocketmq/proxy/config/InitConfigTest",
"src/test/java/org/apache/rocketmq/proxy/service/cert/TlsCertificateManagerTest",
],
test_files = glob(["src/test/java/**/*Test.java"]),
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.rocketmq.remoting.protocol.RequestCode;

public class RequestMapping {
@SuppressWarnings("DoubleBraceInitialization")
private final static Map<String, Integer> REQUEST_MAP = new HashMap<String, Integer>() {
{
// v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ 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";
@SuppressWarnings("DoubleBraceInitialization")
private static final Map<ProxyExceptionCode, Integer> PROXY_EXCEPTION_RESPONSE_CODE_MAP = new HashMap<ProxyExceptionCode, Integer>() {
{
put(ProxyExceptionCode.FORBIDDEN, ResponseCode.NO_PERMISSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.rocketmq.remoting.protocol.RequestCode;
import org.apache.rocketmq.remoting.protocol.ResponseCode;

@SuppressWarnings("DoubleBraceInitialization")
public class RemotingHelper {
public static final String DEFAULT_CHARSET = "UTF-8";
public static final String DEFAULT_CIDR_ALL = "0.0.0.0/0";
Expand Down
2 changes: 0 additions & 2 deletions srvutil/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ java_library(
visibility = ["//visibility:public"],
deps = [
"//common",
"//remoting",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:commons_validator_commons_validator",
"@maven//:com_github_luben_zstd_jni",
Expand All @@ -44,7 +43,6 @@ java_library(
deps = [
":srvutil",
"//common",
"//remoting",
"//:test_deps",
"@maven//:org_apache_commons_commons_lang3",
"@maven//:io_netty_netty_all",
Expand Down
2 changes: 2 additions & 0 deletions store/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ GenTestRules(
# These tests are extremely slow and flaky, exclude them before they are properly fixed.
"src/test/java/org/apache/rocketmq/store/ha/autoswitch/AutoSwitchHATest",
"src/test/java/org/apache/rocketmq/store/dledger/DLedgerCommitlogTest",
"src/test/java/org/apache/rocketmq/store/dledger/DLedgerMultiPathTest",
],
medium_tests = [
"src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest",
Expand All @@ -85,6 +86,7 @@ GenTestRules(
"src/test/java/org/apache/rocketmq/store/queue/BatchConsumeMessageTest",
"src/test/java/org/apache/rocketmq/store/dledger/MixCommitlogTest",
"src/test/java/org/apache/rocketmq/store/RocksDBMessageStoreTest",
"src/test/java/org/apache/rocketmq/store/timer/TimerMessageStoreTest",
],
test_files = glob(["src/test/java/**/*Test.java"]),
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.common.BoundaryType;
import org.apache.rocketmq.common.CheckRocksdbCqWriteResult;
import org.apache.rocketmq.logging.org.slf4j.Logger;
import org.apache.rocketmq.logging.org.slf4j.LoggerFactory;
import org.apache.rocketmq.common.Pair;
import org.apache.rocketmq.common.constant.LoggerName;
import org.apache.rocketmq.common.message.MessageExtBrokerInner;
Expand All @@ -38,8 +40,6 @@
import org.apache.rocketmq.store.exception.ConsumeQueueException;
import org.apache.rocketmq.store.exception.StoreException;
import org.rocksdb.RocksDBException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CombineConsumeQueueStore implements ConsumeQueueStoreInterface {
private static final Logger log = LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class TimerMetrics extends ConfigManager {
private final ConcurrentMap<Integer, Metric> timingDistribution =
new ConcurrentHashMap<>(1024);

@SuppressWarnings("DoubleBraceInitialization")
public List<Integer> timerDist = new ArrayList<Integer>() {{
add(5);
add(60);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@

import org.apache.rocketmq.logging.org.slf4j.Logger;
import org.apache.rocketmq.store.MessageStoreStateMachine.MessageStoreState;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import org.junit.Before;
import org.mockito.Mockito;

class MessageStoreStateMachineTest {
public class MessageStoreStateMachineTest {

private Logger mockLogger;
private MessageStoreStateMachine stateMachine;

@BeforeEach
void setUp() {
@Before
public void setUp() {
// Mock Logger
mockLogger = Mockito.mock(Logger.class);

Expand All @@ -49,7 +49,7 @@ void setUp() {
* Test the constructor of MessageStoreStateMachine.
*/
@Test
void testConstructor() {
public void testConstructor() {
// Verify initial state
assertEquals(MessageStoreState.INIT, stateMachine.getCurrentState());

Expand All @@ -61,7 +61,7 @@ void testConstructor() {
* Test valid state transition in transitTo method.
*/
@Test
void testValidStateTransition() {
public void testValidStateTransition() {
// Perform a valid state transition
stateMachine.transitTo(MessageStoreState.LOAD_COMMITLOG_OK);

Expand All @@ -77,7 +77,7 @@ void testValidStateTransition() {
* Test fail state transition in transitTo method.
*/
@Test
void testValidFailStateTransition() {
public void testValidFailStateTransition() {
stateMachine.transitTo(MessageStoreState.LOAD_COMMITLOG_OK, false);
assertEquals(MessageStoreState.INIT, stateMachine.getCurrentState());
verify(mockLogger).warn(anyString(), eq(MessageStoreState.INIT), eq(MessageStoreState.LOAD_COMMITLOG_OK),
Expand All @@ -88,7 +88,7 @@ void testValidFailStateTransition() {
* Test invalid state transition in transitTo method.
*/
@Test
void testInvalidStateTransition() {
public void testInvalidStateTransition() {
// Perform an invalid state transition
Exception exception = assertThrows(IllegalStateException.class, () -> {
stateMachine.transitTo(MessageStoreState.INIT);
Expand All @@ -103,7 +103,7 @@ void testInvalidStateTransition() {
* Test getCurrentState method.
*/
@Test
void testGetCurrentState() {
public void testGetCurrentState() {
// Verify the current state
assertEquals(MessageStoreState.INIT, stateMachine.getCurrentState());
}
Expand All @@ -112,7 +112,7 @@ void testGetCurrentState() {
* Test getTotalRunningTimeMs method.
*/
@Test
void testGetTotalRunningTimeMs() {
public void testGetTotalRunningTimeMs() {
// Sleep for a short duration to simulate elapsed time
try {
Thread.sleep(100);
Expand All @@ -129,7 +129,7 @@ void testGetTotalRunningTimeMs() {
* Test getCurrentStateRunningTimeMs method.
*/
@Test
void testGetCurrentStateRunningTimeMs() {
public void testGetCurrentStateRunningTimeMs() {
// Perform a state transition
stateMachine.transitTo(MessageStoreState.LOAD_COMMITLOG_OK);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ public void testAddBrokerAndSyncFromLastFile() throws Exception {
}

@Test
@SuppressWarnings("DoubleBraceInitialization")
public void testCheckSynchronizingSyncStateSetFlag() throws Exception {
// Step1: broker1 as leader, broker2 as follower
init(defaultMappedFileSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void testTimingCount() {
}

@Test
@SuppressWarnings("DoubleBraceInitialization")
public void testTimingDistribution() {
String baseDir = StoreTestUtils.createBaseDir();
TimerMetrics first = new TimerMetrics(baseDir);
Expand Down
5 changes: 0 additions & 5 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ java_library(
srcs = glob(["src/main/java/**/*.java"]),
visibility = ["//visibility:public"],
deps = [
"//broker",
"//client",
"//common",
"//container",
"//controller",
"//namesrv",
"//proxy",
"//remoting",
"//srvutil",
"//tools",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static void deleteStoreDirectory(String storePath) {
}

@Test
@SuppressWarnings("DoubleBraceInitialization")
public void toHumanReadableTest() {
Map<Long, String> capacityTable = new HashMap<Long, String>() {
{
Expand Down
Loading
Loading