wy471x opened a new pull request, #7051:
URL: https://github.com/apache/shenyu/pull/7051

   <!-- Describe your PR changes -->
   
   Fixes #6813
   
   ## Summary
   
   Adds dedicated unit tests for the sync/register/protocol classes listed in 
#6813 that previously had no direct test coverage. Classes on that list which 
already have their own tests on master (`ProxySelectorRefresh`, 
`DiscoveryUpstreamDataRefresh`, `MqttTransportHandler`, `TcpBootstrapFactory`, 
`TcpProxySelectorDataHandler`) are intentionally not duplicated.
   
   ### Changes
   
   1. `HttpClientRegisterRepositoryTest` — verifies 
URI/meta/apiDoc/MCP-tools/discovery registration paths, multi-server 
registration, heartbeat, offline, `closeRepository`, port-occupied skip, login 
failure, and last-server failure propagation.
   2. `AbstractDataRefreshTest` — verifies the refresh template, null 
conversion handling, and md5/last-modify-time cache update rules.
   3. `DataRefreshFactoryTest` — verifies factory construction, group dispatch 
through `executor`, cache updates, and repeated-config handling.
   4. `AiProxyApiKeyDataRefreshTest` — verifies convert/from-json, 
clear-then-subscribe refresh semantics, empty data/subscriber handling, and 
`cacheConfigData`.
   5. `MqttFactoryTest` — verifies per-message-type dispatch for 
CONNECT/PUBLISH/SUBSCRIBE/UNSUBSCRIBE/PINGREQ and no-op default branches.
   6. `MqttContextTest` — verifies static getters/setters and `isValid` 
credential checks.
   7. `MqttBootstrapServerTest` — verifies repository registration through 
`init` and the start/shutdown lifecycle releases the bound channel and event 
loops.
   8. `TcpConnectionBridgeTest` — verifies bidirectional relay wiring and that 
disposing either connection closes the peer channel.
   9. `DefaultConnectionConfigProviderTest` — verifies upstream selection 
builds the expected URI and that an empty upstream list fails with 
`ShenyuException`.
   10. `AiProxyApiKeyDataHandlerTest` — verifies convert, refresh/update/delete 
subscriber fan-out, and null data/subscriber guards.
   11. `ProxySelectorDataHandlerTest` — verifies convert, refresh/update/delete 
fan-out, and null-item delete handling.
   12. `TcpUpstreamDataHandlerTest` — verifies the plugin name, removal of 
upstreams missing from a new snapshot, and cache refresh when no bootstrap 
server is cached.
   
   ### Test Cases
   
   - 
`shenyu-register-center/shenyu-register-client/shenyu-register-client-http/.../HttpClientRegisterRepositoryTest.java`
 — 8 cases.
   - 
`shenyu-sync-data-center/shenyu-sync-data-http/.../refresh/AbstractDataRefreshTest.java`
 — 5 cases.
   - 
`shenyu-sync-data-center/shenyu-sync-data-http/.../refresh/DataRefreshFactoryTest.java`
 — 3 cases.
   - 
`shenyu-sync-data-center/shenyu-sync-data-http/.../refresh/AiProxyApiKeyDataRefreshTest.java`
 — 7 cases.
   - `shenyu-protocol/shenyu-protocol-mqtt/.../MqttFactoryTest.java` — 8 cases.
   - `shenyu-protocol/shenyu-protocol-mqtt/.../MqttContextTest.java` — 5 cases.
   - `shenyu-protocol/shenyu-protocol-mqtt/.../MqttBootstrapServerTest.java` — 
2 cases.
   - 
`shenyu-protocol/shenyu-protocol-tcp/.../connection/TcpConnectionBridgeTest.java`
 — 3 cases.
   - 
`shenyu-protocol/shenyu-protocol-tcp/.../connection/DefaultConnectionConfigProviderTest.java`
 — 2 cases.
   - 
`shenyu-sync-data-center/shenyu-sync-data-websocket/.../handler/AiProxyApiKeyDataHandlerTest.java`
 — 6 cases.
   - 
`shenyu-sync-data-center/shenyu-sync-data-websocket/.../handler/ProxySelectorDataHandlerTest.java`
 — 5 cases.
   - 
`shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-tcp/.../handler/TcpUpstreamDataHandlerTest.java`
 — 3 cases.
   
   ## Verification
   
   - Full test suites pass for all six affected modules: 
`shenyu-register-client-http`, `shenyu-sync-data-http`, `shenyu-protocol-mqtt`, 
`shenyu-protocol-tcp`, `shenyu-sync-data-websocket`, `shenyu-plugin-tcp`.
   - Checkstyle (bound to `validate`) and RAT pass for each touched module.
   - `./mvnw clean install -Dmaven.javadoc.skip=true` passes for all six 
touched modules with their `-am` dependencies.
   
   ---
   
   - [x] I have read the [Contributor 
Guide](https://shenyu.apache.org/community/contributor).
   - [x] Test cases have been added to prove that the change is effective.
   - [x] I have passed `./mvnw clean install -Dmaven.javadoc.skip=true` locally 
for the touched modules and their dependencies.
   
   Fixes #6813
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to