Skip to content

Commit 44f9626

Browse files
committed
test: Allow protocol selection in api-test app
1 parent f4fedbf commit 44f9626

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [Unreleased](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.2...main)
2+
3+
### Changed
4+
- Added protocol selection to the API Test App: `[--legacy | --rpc-v2]`
5+
16
## [0.5.2](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.1...v0.5.2)
27

38
### Changed

test/api_test_app/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The app binary name is:
1717
## Command Line Usage
1818

1919
```bash
20-
api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--dbg] [--help]
20+
api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--legacy | --rpc-v2] [--dbg] [--help]
2121
```
2222

2323
### Options
@@ -34,6 +34,12 @@ api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--dbg] [--help]
3434
- `--url URL`
3535
Set the WebSocket endpoint to the specified URL.
3636

37+
- `--legacy`
38+
Override default protocol communication to legacy.
39+
40+
- `--rpc-v2`
41+
Override default protocol communication to JSON-RPC compliant.
42+
3743
- `--dbg`
3844
Enable debug logging.
3945

test/api_test_app/main.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ int main(int argc, char** argv)
4242

4343
Firebolt::LogLevel logLevel = Firebolt::LogLevel::Notice;
4444
std::string url;
45+
std::optional<bool> legacyRPCv1;
4546

4647
for (int i = 1; i < argc; ++i)
4748
{
@@ -66,6 +67,14 @@ int main(int argc, char** argv)
6667
}
6768
url = argv[++i];
6869
}
70+
else if (std::string(argv[i]) == "--legacy")
71+
{
72+
legacyRPCv1 = true;
73+
}
74+
else if (std::string(argv[i]) == "--rpc-v2")
75+
{
76+
legacyRPCv1 = false;
77+
}
6978
else if (std::string(argv[i]) == "--dbg")
7079
{
7180
logLevel = Firebolt::LogLevel::Debug;
@@ -81,6 +90,8 @@ int main(int argc, char** argv)
8190
std::cout << " --mock Connect to a local mock server instead of the default Firebolt Demo Service" << std::endl;
8291
std::cout << " --platform Connect to the platform's Firebolt service (default if available)" << std::endl;
8392
std::cout << " --url <URL> Specify a custom URL for the Firebolt service" << std::endl;
93+
std::cout << " --legacy Use legacy communication" << std::endl;
94+
std::cout << " --rpc-v2 Use JSON-RPC compliant communication" << std::endl;
8495
std::cout << " --dbg Enable debug logging" << std::endl;
8596
std::cout << " --help Show this help message" << std::endl;
8697
/* clang-format on */
@@ -106,6 +117,10 @@ int main(int argc, char** argv)
106117
config.wsUrl = url;
107118
config.waitTime_ms = 1000;
108119
config.log.level = logLevel;
120+
if (legacyRPCv1.has_value())
121+
{
122+
config.legacyRPCv1 = legacyRPCv1.value();
123+
}
109124

110125
std::promise<bool> connectionPromise;
111126
std::once_flag connectionOnce;

0 commit comments

Comments
 (0)