mirror of
https://github.com/apache/rocketmq.git
synced 2026-08-30 18:10:44 +08:00
@@ -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.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
5.2.0
|
||||
6.5.0
|
||||
-14
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
@@ -23,7 +23,6 @@ java_library(
|
||||
deps = [
|
||||
"//common",
|
||||
"//remoting",
|
||||
"//srvutil",
|
||||
"//client",
|
||||
"@maven//:commons_codec_commons_codec",
|
||||
"@maven//:org_apache_commons_commons_lang3",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
@@ -41,6 +41,7 @@ public class RocksDBConsumerOffsetManagerTest {
|
||||
private ConsumerOffsetManager consumerOffsetManager;
|
||||
|
||||
@Before
|
||||
@SuppressWarnings("DoubleBraceInitialization")
|
||||
public void init() {
|
||||
if (notToBeExecuted()) {
|
||||
return;
|
||||
|
||||
@@ -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",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
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;
|
||||
@@ -230,6 +231,8 @@ public class AclUtilsTest {
|
||||
|
||||
@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);
|
||||
|
||||
@@ -23,7 +23,6 @@ java_library(
|
||||
deps = [
|
||||
"//common",
|
||||
"//remoting",
|
||||
"//client",
|
||||
"//srvutil",
|
||||
"@maven//:io_openmessaging_storage_dledger",
|
||||
"@maven//:org_apache_commons_commons_lang3",
|
||||
@@ -65,7 +64,6 @@ java_library(
|
||||
":controller",
|
||||
"//common",
|
||||
"//remoting",
|
||||
"//client",
|
||||
"//srvutil",
|
||||
"@maven//:io_openmessaging_storage_dledger",
|
||||
"//:test_deps",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -85,6 +85,7 @@ java_library(
|
||||
"//broker",
|
||||
"//client",
|
||||
"//common",
|
||||
"//srvutil",
|
||||
"//remoting",
|
||||
"@maven//:ch_qos_logback_logback_core",
|
||||
"@maven//:com_alibaba_fastjson",
|
||||
@@ -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 = [
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.Map;
|
||||
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
|
||||
|
||||
+1
@@ -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);
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.apache.rocketmq.remoting.protocol.RemotingCommand;
|
||||
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";
|
||||
|
||||
@@ -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",
|
||||
@@ -44,7 +43,6 @@ java_library(
|
||||
deps = [
|
||||
":srvutil",
|
||||
"//common",
|
||||
"//remoting",
|
||||
"//:test_deps",
|
||||
"@maven//:org_apache_commons_commons_lang3",
|
||||
"@maven//:io_netty_netty_all",
|
||||
|
||||
@@ -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",
|
||||
@@ -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 = [
|
||||
|
||||
@@ -28,6 +28,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
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;
|
||||
@@ -38,8 +40,6 @@ import org.apache.rocketmq.store.config.MessageStoreConfig;
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -27,17 +27,17 @@ import static org.mockito.Mockito.verify;
|
||||
|
||||
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);
|
||||
|
||||
@@ -49,7 +49,7 @@ class MessageStoreStateMachineTest {
|
||||
* Test the constructor of MessageStoreStateMachine.
|
||||
*/
|
||||
@Test
|
||||
void testConstructor() {
|
||||
public void testConstructor() {
|
||||
// Verify initial state
|
||||
assertEquals(MessageStoreState.INIT, stateMachine.getCurrentState());
|
||||
|
||||
@@ -61,7 +61,7 @@ class MessageStoreStateMachineTest {
|
||||
* Test valid state transition in transitTo method.
|
||||
*/
|
||||
@Test
|
||||
void testValidStateTransition() {
|
||||
public void testValidStateTransition() {
|
||||
// Perform a valid state transition
|
||||
stateMachine.transitTo(MessageStoreState.LOAD_COMMITLOG_OK);
|
||||
|
||||
@@ -77,7 +77,7 @@ class MessageStoreStateMachineTest {
|
||||
* 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),
|
||||
@@ -88,7 +88,7 @@ class MessageStoreStateMachineTest {
|
||||
* 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);
|
||||
@@ -103,7 +103,7 @@ class MessageStoreStateMachineTest {
|
||||
* Test getCurrentState method.
|
||||
*/
|
||||
@Test
|
||||
void testGetCurrentState() {
|
||||
public void testGetCurrentState() {
|
||||
// Verify the current state
|
||||
assertEquals(MessageStoreState.INIT, stateMachine.getCurrentState());
|
||||
}
|
||||
@@ -112,7 +112,7 @@ class MessageStoreStateMachineTest {
|
||||
* Test getTotalRunningTimeMs method.
|
||||
*/
|
||||
@Test
|
||||
void testGetTotalRunningTimeMs() {
|
||||
public void testGetTotalRunningTimeMs() {
|
||||
// Sleep for a short duration to simulate elapsed time
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
@@ -129,7 +129,7 @@ class MessageStoreStateMachineTest {
|
||||
* Test getCurrentStateRunningTimeMs method.
|
||||
*/
|
||||
@Test
|
||||
void testGetCurrentStateRunningTimeMs() {
|
||||
public void testGetCurrentStateRunningTimeMs() {
|
||||
// Perform a state transition
|
||||
stateMachine.transitTo(MessageStoreState.LOAD_COMMITLOG_OK);
|
||||
|
||||
|
||||
@@ -454,6 +454,7 @@ public class AutoSwitchHATest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("DoubleBraceInitialization")
|
||||
public void testCheckSynchronizingSyncStateSetFlag() throws Exception {
|
||||
// Step1: broker1 as leader, broker2 as follower
|
||||
init(defaultMappedFileSize);
|
||||
|
||||
@@ -57,6 +57,7 @@ public class TimerMetricsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("DoubleBraceInitialization")
|
||||
public void testTimingDistribution() {
|
||||
String baseDir = StoreTestUtils.createBaseDir();
|
||||
TimerMetrics first = new TimerMetrics(baseDir);
|
||||
|
||||
@@ -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",
|
||||
|
||||
+1
@@ -48,6 +48,7 @@ public class MessageStoreUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("DoubleBraceInitialization")
|
||||
public void toHumanReadableTest() {
|
||||
Map<Long, String> capacityTable = new HashMap<Long, String>() {
|
||||
{
|
||||
|
||||
@@ -109,6 +109,7 @@ public class DefaultMQAdminExtTest {
|
||||
private static ClusterInfo clusterInfo = new ClusterInfo();
|
||||
|
||||
@BeforeClass
|
||||
@SuppressWarnings("DoubleBraceInitialization")
|
||||
public static void init() throws Exception {
|
||||
mQClientAPIImpl = mock(MQClientAPIImpl.class);
|
||||
defaultMQAdminExt = new DefaultMQAdminExt();
|
||||
|
||||
Reference in New Issue
Block a user