This is an automated email from the ASF dual-hosted git repository. lizhimins pushed a commit to branch rocketmq-studio in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
commit 33e995baedc6d1fa1f757cb54b216e3352e4170a Author: aias00 <[email protected]> AuthorDate: Mon Aug 10 12:00:41 2026 +0800 refactor: remove unused NameSrvAdminClient stub (#1246) * [ISSUE #1245] Remove unused NameSrvAdminClient * test: remove obsolete NameSrvAdminClient coverage --- .../studio/instance/topic/NameSrvAdminClient.java | 79 ---------------------- .../instance/topic/NameSrvAdminClientTest.java | 48 ------------- 2 files changed, 127 deletions(-) diff --git a/server/src/main/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClient.java b/server/src/main/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClient.java deleted file mode 100644 index 349e68e6..00000000 --- a/server/src/main/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClient.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.rocketmq.studio.instance.topic; - -import org.apache.rocketmq.studio.provider.apache.AdminClient; -import org.apache.rocketmq.studio.common.exception.BusinessException; -import org.apache.rocketmq.studio.instance.group.ConsumerGroupVO; - -import lombok.extern.slf4j.Slf4j; - -/** - * Stub admin client. Disabled in favor of RocketMQAdminClientImpl. - */ -@Slf4j -public class NameSrvAdminClient implements AdminClient { - - @Override - public TopicVO getTopic(String name) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public ConsumerGroupVO getConsumerGroup(String instanceId, String name) { - throw consumerGroupAdminUnavailable(); - } - - @Override - public TopicVO createTopic(TopicVO topic) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public TopicVO updateTopic(TopicVO topic) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public void deleteTopic(String instanceId, String name) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public SendMessageVO sendMessage(SendMessageDTO request) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public ConsumerGroupVO createConsumerGroup(ConsumerGroupVO group) { - throw consumerGroupAdminUnavailable(); - } - - @Override - public void deleteConsumerGroup(String instanceId, String name) { - throw consumerGroupAdminUnavailable(); - } - - @Override - public void resetOffset(String instanceId, String name, long timestamp, String topic) { - throw consumerGroupAdminUnavailable(); - } - - private BusinessException consumerGroupAdminUnavailable() { - return new BusinessException(501, "Consumer group admin client is not configured"); - } -} diff --git a/server/src/test/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClientTest.java b/server/src/test/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClientTest.java deleted file mode 100644 index 5626d4e3..00000000 --- a/server/src/test/java/org/apache/rocketmq/studio/instance/topic/NameSrvAdminClientTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.rocketmq.studio.instance.topic; - -import org.apache.rocketmq.studio.common.exception.BusinessException; -import org.apache.rocketmq.studio.instance.group.ConsumerGroupVO; -import org.assertj.core.api.ThrowableAssert; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -class NameSrvAdminClientTest { - - private final NameSrvAdminClient adminClient = new NameSrvAdminClient(); - - @Test - void consumerGroupOperationsShouldReturnAdminUnavailable() { - ConsumerGroupVO group = new ConsumerGroupVO(); - group.setName("cg-order"); - - assertUnavailable(() -> adminClient.getConsumerGroup("instance-a", "cg-order")); - assertUnavailable(() -> adminClient.createConsumerGroup(group)); - assertUnavailable(() -> adminClient.deleteConsumerGroup("instance-a", "cg-order")); - assertUnavailable(() -> adminClient.resetOffset("instance-a", "cg-order", 1784246400000L, "order-topic")); - } - - private void assertUnavailable(ThrowableAssert.ThrowingCallable callable) { - assertThatThrownBy(callable) - .isInstanceOf(BusinessException.class) - .hasMessage("Consumer group admin client is not configured") - .satisfies(ex -> assertThat(((BusinessException) ex).getCode()).isEqualTo(501)); - } -}
