Skip to content

[ISSUE #788] Return unavailable for Ops setting writes - #789

Closed
Aias00 wants to merge 1 commit into
apache:rocketmq-studiofrom
Aias00:fix/studio-ops-settings-unavailable
Closed

[ISSUE #788] Return unavailable for Ops setting writes#789
Aias00 wants to merge 1 commit into
apache:rocketmq-studiofrom
Aias00:fix/studio-ops-settings-unavailable

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Fixes #788

Brief Description

The Ops page exposes NameServer, VIP channel, and TLS write operations, but the current service only updates process-local fields and does not apply those settings to the real RocketMQ AdminClient/configuration path.

This PR keeps the read-only Ops home data available, but changes write operations to fail explicitly with HTTP 501 until they are wired to the real cluster admin configuration flow. This avoids showing users a successful applied change when no runtime MQAdmin setting was changed.

Covered write operations:

  • update current NameServer
  • add NameServer
  • delete NameServer
  • update VIP channel
  • update TLS

How Did You Test This Change?

  • JAVA_HOME=/Users/aias/Library/Java/JavaVirtualMachines/openjdk-21.0.2/Contents/Home mvn -Dtest=OpsServiceTest,OpsControllerTest test

Copilot AI review requested due to automatic review settings August 3, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents the Ops page write endpoints from reporting success when the backend does not actually apply NameServer/VIP/TLS settings to the real RocketMQ admin configuration path, by making those write operations explicitly fail with HTTP 501.

Changes:

  • Update OpsService write operations (NameServer add/update/delete, VIP toggle, TLS toggle) to throw a BusinessException(501, ...) after basic request validation.
  • Update service tests to assert the new “unavailable” behavior and that read-only home page values remain unchanged.
  • Add a controller test asserting that a BusinessException(501, ...) is mapped to HTTP 501 + error payload for the update NameServer endpoint.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
server/src/main/java/org/apache/rocketmq/studio/ops/OpsService.java Makes Ops write methods validate input then fail fast with a consistent 501 “unavailable” error.
server/src/test/java/org/apache/rocketmq/studio/ops/OpsServiceTest.java Updates unit tests to verify write methods now return 501 and do not mutate read-only Ops home state.
server/src/test/java/org/apache/rocketmq/studio/ops/OpsControllerTest.java Adds controller-level coverage that a service-side 501 BusinessException maps to HTTP 501 and correct JSON body.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +90
@Test
void updateNameSvrAddrShouldReturnUnavailableWhenServiceRejects() throws Exception {
doThrow(new BusinessException(501, "Ops settings are not connected to the cluster admin configuration"))
.when(opsService).updateNameServer("10.0.0.1:9876");

@Aias00

Aias00 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Superseded by consolidated PR #938, which contains this change and has passing checks. Closing this narrower PR to keep review focused.

@Aias00 Aias00 closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants