Skip to content

[tests] Add JSON-RPC versioning unit tests for R4 dispatch and validation#2166

Draft
smanes0213 wants to merge 5 commits into
R4_4-RDKfrom
development/jsonrpc-versioning-tests-rdk
Draft

[tests] Add JSON-RPC versioning unit tests for R4 dispatch and validation#2166
smanes0213 wants to merge 5 commits into
R4_4-RDKfrom
development/jsonrpc-versioning-tests-rdk

Conversation

@smanes0213

@smanes0213 smanes0213 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tests cover:

  • CreateHandler/GetHandler versioned dispatch (explicit and unversioned)
  • v1-cloned handler inherits methods registered before clone
  • Methods registered after clone are absent on v1
  • Unknown version returns Core::ERROR_INVALID_RANGE
  • Unknown method returns Core::ERROR_UNKNOWN_METHOD
  • exists built-in returns '0' (found) or '22' (not found)
  • TokenCheckFunction: VALID / INVALID (ERROR_PRIVILIGED_REQUEST) / DEFERRED (ERROR_PRIVILIGED_DEFERRED)
  • Validation fires before handler dispatch (Validate then Invoke pattern)
  • Scenario A: single {1} handler
  • Scenario B: single {1,2} multi-version handler
  • Virtual-base explicit init to avoid C++ default-ctor silent failure

Uses IDispatcher::Validate + IDispatcher::Invoke(nullptr,...) to preserve the version prefix; not ILocalDispatcher::Invoke which strips it.

…tion

Tests cover:
- CreateHandler/GetHandler versioned dispatch (explicit and unversioned)
- v1-cloned handler inherits methods registered before clone
- Methods registered after clone are absent on v1
- Unknown version returns Core::ERROR_INVALID_RANGE
- Unknown method returns Core::ERROR_UNKNOWN_METHOD
- exists built-in returns '0' (found) or '22' (not found)
- TokenCheckFunction: VALID / INVALID (ERROR_PRIVILIGED_REQUEST) /
  DEFERRED (ERROR_PRIVILIGED_DEFERRED)
- Validation fires before handler dispatch (Validate then Invoke pattern)
- Scenario A: single {1} handler
- Scenario B: single {1,2} multi-version handler
- Virtual-base explicit init to avoid C++ default-ctor silent failure

Uses IDispatcher::Validate + IDispatcher::Invoke(nullptr,...) to preserve
the version prefix; not ILocalDispatcher::Invoke which strips it.

Refs: Source/plugins/JSONRPC.h, Source/core/Portability.h
@smanes0213 smanes0213 changed the title [tests] Add JSON-RPC versioning unit tests for R4 dispatch and valida… [tests] Add JSON-RPC versioning unit tests for R4 dispatch and validation Jul 1, 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.

1 participant