diff --git a/.github/workflows/cxx-build.yml b/.github/workflows/cxx-build.yml index 679fc5ca4..9bb941537 100644 --- a/.github/workflows/cxx-build.yml +++ b/.github/workflows/cxx-build.yml @@ -90,18 +90,6 @@ jobs: name: core path: src/sdks/core - - name: Upload Manage SDK - uses: actions/upload-artifact@v4 - with: - name: manage - path: src/sdks/manage - - - name: Upload Discovery SDK - uses: actions/upload-artifact@v4 - with: - name: discovery - path: src/sdks/discovery - core_sdk: name: Build Core SDK needs: [thunder, openrpc] @@ -175,143 +163,6 @@ jobs: append: true path: code-coverage-results.md - - manage_sdk: - name: Build Manage SDK - needs: [thunder, openrpc] - runs-on: ubuntu-latest - container: - image: node:23.3.0 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Download Manage SDK - uses: actions/download-artifact@v4 - with: - name: manage - path: /__w/firebolt-apis/firebolt-apis/src/sdks/manage - - - name: Download Thunder - uses: actions/download-artifact@v4 - with: - name: thunder - path: /__w/thunder/install/ - - - name: Cache npm dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: deps-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Install npm dependencies - run: | - apt update - apt install -y cmake - npm install - - - name: Generate manage SDK source code - run: | - .github/workflows/utils.sh generate_cpp_manage_sdk_source_code - - - name: Build CXX Manage SDK - run: | - apt install -y python3-pip python3.11-venv - python3 -m venv firebolt-env - source firebolt-env/bin/activate - pip install gcovr - - .github/workflows/utils.sh build_manage_cpp_sdk - - - name: Test and Generate coverage report - run: .github/workflows/utils.sh generate_manage_sdk_coverage_report - - - name: Display coverage report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: coverage/coverage.cobertura.xml - badge: true - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: true - indicators: true - output: both - thresholds: '50 20' - - - name: Replace badge title in PR comment - run: sed -i 's/Code%20Coverage/Manage%20Coverage%20Report/g' code-coverage-results.md - - - name: Add coverage PR comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - recreate: false - append: true - path: code-coverage-results.md - - discovery_sdk: - name: Build Discovery SDK - needs: [thunder, openrpc] - runs-on: ubuntu-latest - container: - image: node:23.3.0 - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Download Discovery SDK - uses: actions/download-artifact@v4 - with: - name: discovery - path: /__w/firebolt-apis/firebolt-apis/src/sdks/discovery - - - name: Download Thunder - uses: actions/download-artifact@v4 - with: - name: thunder - path: /__w/thunder/install/ - - - name: Cache npm dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: deps-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Install npm dependencies - run: | - apt update - apt install -y cmake - npm install - - - name: Generate discovery SDK source code - run: | - .github/workflows/utils.sh generate_cpp_discovery_sdk_source_code - - - name: Build CXX Discovery SDK - run: | - apt install -y python3-pip python3.11-venv - python3 -m venv firebolt-env - source firebolt-env/bin/activate - pip install gcovr - - .github/workflows/utils.sh build_discovery_cpp_sdk - - - name: Test and Generate coverage report - run: .github/workflows/utils.sh generate_discovery_sdk_coverage_report - - - name: Display coverage report - uses: irongut/CodeCoverageSummary@v1.3.0 - with: - filename: coverage/coverage.cobertura.xml - badge: true - fail_below_min: false - format: markdown - hide_branch_rate: false - hide_complexity: true - indicators: true - output: both - thresholds: '50 20' - - name: Replace badge title in PR comment run: sed -i 's/Code%20Coverage/Discovery%20Coverage%20Report/g' code-coverage-results.md diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 296664bb8..4ef66edaa 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -5,7 +5,7 @@ on: types: - "completed" workflows: - - "MFOS standalone sanity report - CORE,MANAGE,DISCOVERY" + - "MFOS standalone sanity report - CORE" jobs: comment-on-pr: diff --git a/.github/workflows/run-standalone-mfos-tests.yml b/.github/workflows/run-standalone-mfos-tests.yml index 4ad784a31..018a39dd4 100644 --- a/.github/workflows/run-standalone-mfos-tests.yml +++ b/.github/workflows/run-standalone-mfos-tests.yml @@ -1,4 +1,4 @@ -name: MFOS standalone sanity report - CORE,MANAGE,DISCOVERY +name: MFOS standalone sanity report - CORE on: repository_dispatch: @@ -26,7 +26,7 @@ jobs: fi # Run tests - - name: Run Core Manage and Discovery tests and create assets + - name: Run Core tests and create assets env: EVENT_NAME: ${{ github.event_name }} GITHUB_REF: ${{ github.ref }} diff --git a/.github/workflows/utils.cjs b/.github/workflows/utils.cjs index 067cc8b9b..53411d153 100755 --- a/.github/workflows/utils.cjs +++ b/.github/workflows/utils.cjs @@ -34,7 +34,7 @@ async function createComment(github, context) { const { issue_number, Passes, Failures, Pending, Skipped, ARTIFACT_URL, JOB_PATH } = process.env; const body = ` - MFOS standalone sanity report - CORE,MANAGE,DISCOVERY: + MFOS standalone sanity report - CORE: Total Passes - ${Passes} Failures - ${Failures} Pending - ${Pending} Skipped - ${Skipped} Report JSON/HTML Files: ${ARTIFACT_URL} Job Logs: ${JOB_PATH} diff --git a/.github/workflows/utils.sh b/.github/workflows/utils.sh index bfbecf4ee..b532b513d 100755 --- a/.github/workflows/utils.sh +++ b/.github/workflows/utils.sh @@ -299,15 +299,10 @@ case "$1" in getArtifactData) getArtifactData ;; unzipArtifact) unzipArtifact ;; generate_cpp_core_sdk_source_code) generate_cpp_sdk_source_code "core" ;; - generate_cpp_manage_sdk_source_code) generate_cpp_sdk_source_code "manage" ;; - generate_cpp_discovery_sdk_source_code) generate_cpp_sdk_source_code "discovery" ;; cloneAndInstallThunder) cloneAndInstallThunder ;; build_core_cpp_sdk) build_cpp_sdk "core" ;; - build_manage_cpp_sdk) build_cpp_sdk "manage" ;; build_discovery_cpp_sdk) build_cpp_sdk "discovery" ;; generate_core_sdk_coverage_report) generate_coverage_report "core" ;; - generate_manage_sdk_coverage_report) generate_coverage_report "manage" ;; - generate_discovery_sdk_coverage_report) generate_coverage_report "discovery" ;; *) echo "Invalid function specified." exit 1 diff --git a/.gitignore b/.gitignore index b267a7cd3..9a7909b6d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,12 +3,6 @@ dist/* src/sdks/core/build/* src/sdks/core/dist/* src/sdks/core/test/transpiled-suite/* -src/sdks/discovery/build/* -src/sdks/discovery/dist/* -src/sdks/discovery/test/transpiled-suite/* -src/sdks/manage/build/* -src/sdks/manage/dist/* -src/sdks/manage/test/transpiled-suite/* node_modules/* test/transpiled-suite/* .DS_Store diff --git a/.releaserc b/.releaserc index 7fe28fe58..6b1e3f564 100644 --- a/.releaserc +++ b/.releaserc @@ -45,7 +45,7 @@ [ "@semantic-release/git", { - "assets": ["CHANGELOG.md", "package.json", "package-lock.json", "npm-shrinkwrap.json", "src/sdks/core/package.json", "src/sdks/manage/package.json", "src/sdks/discovery/package.json"] + "assets": ["CHANGELOG.md", "package.json", "package-lock.json", "npm-shrinkwrap.json", "src/sdks/core/package.json"] } ], [ diff --git a/package-lock.json b/package-lock.json index 86bf5a09e..ebf87d652 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,7 @@ "version": "1.5.0-next.21", "license": "Apache-2.0", "workspaces": [ - "src/sdks/core", - "src/sdks/manage", - "src/sdks/discovery" + "src/sdks/core" ], "bin": { "firebolt-version": "src/js/version.mjs" @@ -919,14 +917,6 @@ "node": ">=8" } }, - "node_modules/@firebolt-js/discovery-sdk": { - "resolved": "src/sdks/discovery", - "link": true - }, - "node_modules/@firebolt-js/manage-sdk": { - "resolved": "src/sdks/manage", - "link": true - }, "node_modules/@firebolt-js/openrpc": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@firebolt-js/openrpc/-/openrpc-3.2.0.tgz", @@ -17370,7 +17360,7 @@ }, "src/sdks/core": { "name": "@firebolt-js/sdk", - "version": "1.5.0-next.16", + "version": "1.5.0-next.21", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -17382,6 +17372,7 @@ "src/sdks/discovery": { "name": "@firebolt-js/discovery-sdk", "version": "1.5.0-next.16", + "extraneous": true, "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -17393,6 +17384,7 @@ "src/sdks/manage": { "name": "@firebolt-js/manage-sdk", "version": "1.5.0-next.16", + "extraneous": true, "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", diff --git a/package.json b/package.json index faf4794b3..47a4661d5 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,7 @@ "firebolt-version": "./src/js/version.mjs" }, "workspaces": [ - "src/sdks/core", - "src/sdks/manage", - "src/sdks/discovery" + "src/sdks/core" ], "scripts": { "fs:setup": "npm run clean && mkdir -p dist", diff --git a/src/cpp/src/Logger/Logger.h b/src/cpp/src/Logger/Logger.h index 1ec8d3723..0ade91a2f 100755 --- a/src/cpp/src/Logger/Logger.h +++ b/src/cpp/src/Logger/Logger.h @@ -45,8 +45,6 @@ class Logger { OpenRPC, Core, - Manage, - Discovery, PlayerProvider, PlayerManager, }; diff --git a/src/js/github.io/index.mjs b/src/js/github.io/index.mjs index 904c97150..cf8c67b44 100644 --- a/src/js/github.io/index.mjs +++ b/src/js/github.io/index.mjs @@ -95,8 +95,6 @@ packageJson.workspaces.forEach(async workspace => { const specification = await readJson(path.join('dist', 'firebolt-specification.json')) const openrpc = await readJson(path.join('dist', 'firebolt-open-rpc.json')) const corerpc = await readJson(path.join('dist', 'firebolt-core-open-rpc.json')) -const managerpc = await readJson(path.join('dist', 'firebolt-manage-open-rpc.json')) -const discoveryrpc = await readJson(path.join('dist', 'firebolt-discovery-open-rpc.json')) const capabilities = () => { const getOrCreateCapMethodList = (capabilities, c) => capabilities[c] = capabilities[c] || { uses: [], manages: [], provides: [] } @@ -178,18 +176,6 @@ if (version === 'latest') { writeJson(path.join(parsedArgs.output, 'requirements', packageJson.version, 'specifications', 'firebolt-core-open-rpc.json'), corerpc) } -// this is the firebolt Manage OpenRPC spec JSON -writeJson(path.join(parsedArgs.output, 'requirements', version, 'specifications', 'firebolt-manage-open-rpc.json'), managerpc) -if (version === 'latest') { - writeJson(path.join(parsedArgs.output, 'requirements', packageJson.version, 'specifications', 'firebolt-manage-open-rpc.json'), managerpc) -} - -// this is the firebolt Discovery OpenRPC spec JSON -writeJson(path.join(parsedArgs.output, 'requirements', version, 'specifications', 'firebolt-discovery-open-rpc.json'), discoveryrpc) -if (version === 'latest') { - writeJson(path.join(parsedArgs.output, 'requirements', packageJson.version, 'specifications', 'firebolt-discovery-open-rpc.json'), discoveryrpc) -} - function channel(version) { const parts = version.split("-") diff --git a/src/sdks/discovery/.npmignore b/src/sdks/discovery/.npmignore deleted file mode 100644 index 0e2ba4d22..000000000 --- a/src/sdks/discovery/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -build/* -src/* -test/* -.DS_Store -jest.config.* -tsconfig.* \ No newline at end of file diff --git a/src/sdks/discovery/CHANGELOG.md b/src/sdks/discovery/CHANGELOG.md deleted file mode 100644 index 946ac8781..000000000 --- a/src/sdks/discovery/CHANGELOG.md +++ /dev/null @@ -1,12 +0,0 @@ -# [1.4.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.4.0...v1.4.1) (2024-01-10) - -# [1.4.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0...v1.4.0) (2024-23-09) - -# [1.3.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) - -# [1.2.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.1.0...v1.2.0) (2024-06-14) - -### Features - -* Introduced Discovery SDK for first-party aggregated experiences to connect with third-party apps. -* [User Interest](https://github.com/rdkcentral/firebolt-apis/blob/main/requirements/specifications/discovery/user-interest.md) ([#170](https://github.com/rdkcentral/firebolt-apis/issues/170)) ([48a1094](https://github.com/rdkcentral/firebolt-apis/commit/48a1094aaab6418f09db662dbc81f090a34f32ed)) diff --git a/src/sdks/discovery/CONTRIBUTING.md b/src/sdks/discovery/CONTRIBUTING.md deleted file mode 120000 index c97564d93..000000000 --- a/src/sdks/discovery/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -../../../CONTRIBUTING.md \ No newline at end of file diff --git a/src/sdks/discovery/LICENSE b/src/sdks/discovery/LICENSE deleted file mode 120000 index 5853aaea5..000000000 --- a/src/sdks/discovery/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../LICENSE \ No newline at end of file diff --git a/src/sdks/discovery/NOTICE b/src/sdks/discovery/NOTICE deleted file mode 120000 index 295f6bdb3..000000000 --- a/src/sdks/discovery/NOTICE +++ /dev/null @@ -1 +0,0 @@ -../../../NOTICE \ No newline at end of file diff --git a/src/sdks/discovery/README.md b/src/sdks/discovery/README.md deleted file mode 100644 index 2ec46b95d..000000000 --- a/src/sdks/discovery/README.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Firebolt Discovery SDK ---- - -[![semantic-release: conventional](https://img.shields.io/badge/semantic--release-conventional-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) - -# Firebolt Discovery SDK -For building Firebolt compliant apps for discovering first-party content on Firebolt devices. - -## Usage -To install, run: - -``` -npm install @firebolt-js/discovery-sdk -``` - -To use the package, import one of it's modules, e.g.: - -```js -import { Content } from '@firebolt-js/discovery-sdk' -``` - -## Contributing -The Firebolt SDKs are built using the Firebolt OpenRPC toolset: - -See [Firebolt OpenRPC](https://www.github.com/rdkcentral/firebolt-openrpc/), for more info. diff --git a/src/sdks/discovery/jest.config.json b/src/sdks/discovery/jest.config.json deleted file mode 100644 index 745370cfa..000000000 --- a/src/sdks/discovery/jest.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?)$", - "transform": {}, - "testPathIgnorePatterns": ["/node_modules/", "/../../../test"], - "moduleFileExtensions": ["js", "jsx", "mjs"], - "verbose": true, - "testEnvironment": "jest-environment-jsdom" - } \ No newline at end of file diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json deleted file mode 100644 index 4192e2271..000000000 --- a/src/sdks/discovery/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@firebolt-js/discovery-sdk", - "version": "1.5.0-next.21", - "description": "The Firebolt Discovery JS SDK", - "main": "./dist/lib/firebolt-discovery.mjs", - "types": "./dist/lib/firebolt-discovery.d.ts", - "type": "module", - "scripts": { - "validate": "npx firebolt-openrpc validate --input ./dist/firebolt-discovery-open-rpc.json", - "sdk": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/javascript/src", - "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", - "cpp": "npm run cpp:compile && cp ./dist/firebolt-discovery-open-rpc.json ./build/cpp/src && npm run cpp:install", - "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery -v $sdkVersion", - "compile": "cd ../../.. && npm run compile", - "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-discovery-open-rpc.json", - "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-discovery-open-rpc.json --output build/docs/markdown --as-path", - "wiki": "npx firebolt-openrpc docs --input ./dist/firebolt-discovery-open-rpc.json --output build/docs/markdown", - "dist:notest": "npm run clean && npm run slice && npm run validate && npm run sdk && npm run docs && npm run prettier && npm run dist:copy && echo 'Firebolt Discovery SDK /dist/ is ready.\n'", - "dist:copy": "npm run dist:copy:sdk && npm run dist:copy:docs", - "dist:copy:sdk": "mkdirp ./dist && cp -R build/javascript/src dist/lib && cp ./dist/firebolt-discovery-open-rpc.json ../../../dist/firebolt-discovery-open-rpc.json", - "dist:copy:docs": "mkdirp ./dist && cp -R build/docs/markdown dist/docs", - "dist": "npm run dist:notest && npm run test", - "clean": "rm -rf ./build && rm -rf ./dist", - "test:setup": "rm -rf test/transpiled-suite && npx tsc --target es6 --moduleResolution node --outDir test/transpiled-suite", - "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", - "prepack": "node ../../js/version.mjs validate && npm run broilerplate", - "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.ts --write --parser typescript && prettier build/**/*.md --write --parser markdown", - "getVersion": "node -p \"require('./package.json').version\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/rdkcentral/firebolt-core-sdk", - "directory": "src/sdks/discovery" - }, - "author": "", - "bugs": { - "url": "https://github.com/rdkcentral/firebolt-core-sdk/issues" - }, - "homepage": "https://github.com/rdkcentral/firebolt-core-sdk#readme", - "devDependencies": { - "jest": "^28.1.0", - "jest-environment-jsdom": "^28.1.3", - "prettier": "^3.1.0", - "typescript": "^4.6.4" - }, - "keywords": [ - "firebolt", - "apps", - "sdk" - ], - "license": "Apache-2.0" -} \ No newline at end of file diff --git a/src/sdks/discovery/sdk.config.json b/src/sdks/discovery/sdk.config.json deleted file mode 100644 index 535d3bb12..000000000 --- a/src/sdks/discovery/sdk.config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "info": { - "title": "Firebolt Discovery SDK" - }, - "methods": [ - { - "module": "Content", - "use": [ - "xrn:firebolt:capability:discovery:purchased-content", - "xrn:firebolt:capability:discovery:entity-info", - "xrn:firebolt:capability:discovery:interest" - ] - } - ] -} diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt deleted file mode 100644 index f352515e2..000000000 --- a/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt +++ /dev/null @@ -1,135 +0,0 @@ -# Copyright 2023 Comcast Cable Communications Management, LLC -# -# Licensed 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. -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.3) - -project(FireboltDiscoverySDKTests) - -if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) - set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) -endif() - -list(APPEND CMAKE_MODULE_PATH - "${SYSROOT_PATH}/usr/lib/cmake" - "${SYSROOT_PATH}/tools/cmake") -message("FIREBOLT_PATH inside cmake " ${FIREBOLT_PATH}) -if (FIREBOLT_PATH) - set(CMAKE_FIREBOLT_PATH - "${FIREBOLT_PATH}/usr/lib/cmake/Firebolt" - "${FIREBOLT_PATH}/usr/lib/cmake/FireboltSDK") - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIREBOLT_PATH}) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_FIREBOLT_PATH}) -else () - set(FIREBOLT_PATH "${SYSROOT_PATH}" CACHE INTERNAL "" FORCE) -endif () - -find_package(WPEFramework CONFIG REQUIRED) -find_package(${NAMESPACE}Core CONFIG REQUIRED) - -set(TESTAPP TestFireboltDiscovery) - -message("Setup ${TESTAPP}") - -add_executable(${TESTAPP} DiscoverySDKTest.cpp Main.cpp) - -target_link_libraries(${TESTAPP} - PRIVATE - ${NAMESPACE}Core::${NAMESPACE}Core - ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK - nlohmann_json_schema_validator - gtest_main -) - -target_include_directories(${TESTAPP} - PRIVATE - $ -) - -if (POLYMORPHICS_REDUCER_METHODS) - target_compile_definitions(${TESTAPP} - PUBLIC - POLYMORPHICS_REDUCER_METHODS=1) -endif() - -set_target_properties(${TESTAPP} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES -) - -add_custom_command( - TARGET ${TESTAPP} - POST_BUILD - COMMENT "=================== Installing TestApp ======================" - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin -) - -if(ENABLE_UNIT_TESTS) - set(UNIT_TESTS_APP FireboltDiscoveryUnitTests) - - message("Setup ${UNIT_TESTS_APP}") - - add_executable(${UNIT_TESTS_APP} - DiscoverySDKTest.cpp - ) - - link_directories(${CMAKE_SOURCE_DIR}/../../Thunder/install/usr/lib/) - target_link_libraries(${UNIT_TESTS_APP} - PRIVATE - ${NAMESPACE}Core::${NAMESPACE}Core - ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK - nlohmann_json_schema_validator - gtest_main - ) - - target_include_directories(${UNIT_TESTS_APP} - PRIVATE - $ - ) - - set_target_properties(${UNIT_TESTS_APP} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - ) - - include(GoogleTest) - gtest_discover_tests(${UNIT_TESTS_APP}) -endif() - -if(ENABLE_COVERAGE) - include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake) - - set(COVERAGE_MAIN "coverage") - set(COVERAGE_EXCLUDES - "${CMAKE_SOURCE_DIR}/build/*" - "${CMAKE_SOURCE_DIR}/cmake/*" - "${CMAKE_SOURCE_DIR}/include/*" - "${CMAKE_SOURCE_DIR}/test/*" - "/usr/include/*") - - set(COVERAGE_EXTRA_FLAGS) - set(COVERAGE_DEPENDENCIES ${UNIT_TESTS_APP}) - - setup_target_for_coverage_gcovr_html( - NAME ${COVERAGE_MAIN} - BASE_DIRECTORY ${CMAKE_SOURCE_DIR} - EXECUTABLE ctest - EXECUTABLE_ARGS "--test-dir ../build/ --output-on-failure" - DEPENDENCIES ${COVERAGE_DEPENDENCIES} - ) - -endif() diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp deleted file mode 100644 index 62d3f0282..000000000 --- a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include "DiscoverySDKTest.h" - -using namespace std; -bool DiscoverySDKTest::_connected; -DiscoverySDKTest::OnUserInterestNotification DiscoverySDKTest::_userInterestNotification; - -void DiscoverySDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error) -{ - cout << "Change in connection: connected: " << connected << " error: " << static_cast(error) << endl; - _connected = connected; -} - -void DiscoverySDKTest::CreateFireboltInstance(const std::string& url) -{ - const std::string config = "{\ - \"waitTime\": 100000,\ - \"logLevel\": \"Info\",\ - \"workerPool\":{\ - \"queueSize\": 8,\ - \"threadCount\": 3\ - },\ - \"wsUrl\": " + url + "}"; - - _connected = false; - Firebolt::IFireboltAccessor::Instance().Initialize(config); - Firebolt::IFireboltAccessor::Instance().Connect(ConnectionChanged); -} - -void DiscoverySDKTest::DestroyFireboltInstance() -{ - Firebolt::IFireboltAccessor::Instance().Disconnect(); - Firebolt::IFireboltAccessor::Instance().Deinitialize(); - Firebolt::IFireboltAccessor::Instance().Dispose(); -} - -bool DiscoverySDKTest::WaitOnConnectionReady() -{ - uint32_t waiting = 10000; - static constexpr uint32_t SLEEPSLOT_TIME = 100; - - // Right, a wait till connection is closed is requested.. - while ((waiting > 0) && (_connected == false)) { - - uint32_t sleepSlot = (waiting > SLEEPSLOT_TIME ? SLEEPSLOT_TIME : waiting); - // Right, lets sleep in slices of 100 ms - usleep(sleepSlot); - waiting -= sleepSlot; - } - return _connected; -} - -template -using EnumMap = std::unordered_map; -template -inline const string& ConvertFromEnum(EnumMap enumMap, T type) -{ - return enumMap[type]; -} -template -inline const T ConvertToEnum(EnumMap enumMap, const string& str) -{ - T value; - for (auto element: enumMap) { - if (element.second == str) { - value = element.first; - break; - } - } - return value; -} - -void DiscoverySDKTest::OnUserInterestNotification::onUserInterest( const Firebolt::Content::InterestEvent& interest) -{ - cout << "User Interest changed notification" << endl; -} - -void DiscoverySDKTest::SubscribeUserInterest() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ContentInterface().subscribe(_userInterestNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Content.UserInterest is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("Subscribe Content.UserInterest failed. " + errorMessage); - } -} - -void DiscoverySDKTest::UnsubscribeUserInterest() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ContentInterface().unsubscribe(_userInterestNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Content.UserInterest is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("Unsubscribe Content.UserInterest failed." + errorMessage); - } -} - -void DiscoverySDKTest::RequestUserInterest() -{ - Firebolt::Discovery::InterestType type = Firebolt::Discovery::InterestType::INTEREST; - Firebolt::Discovery::InterestReason reason = Firebolt::Discovery::InterestReason::REACTION; - Firebolt::Error error = Firebolt::Error::None; - - Firebolt::IFireboltAccessor::Instance().ContentInterface().requestUserInterest(type, reason, &error); - - if (error == Firebolt::Error::None) { - cout << "Content.requestuserInterest call is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("Content.requestUserInterest failed." + errorMessage); - } -} diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h deleted file mode 100644 index cdb70ca65..000000000 --- a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include "firebolt.h" - -class DiscoverySDKTest { - class OnUserInterestNotification : public Firebolt::Content::IContent::IOnUserInterestNotification { - public: - void onUserInterest( const Firebolt::Content::InterestEvent& ) override; - }; - -public: - DiscoverySDKTest() = default; - virtual ~DiscoverySDKTest() = default; - - static void CreateFireboltInstance(const std::string& url); - static void DestroyFireboltInstance(); - static void TestDiscoveryStaticSDK(); - - static void SubscribeUserInterest(); - static void UnsubscribeUserInterest(); - static void RequestUserInterest(); - - static bool WaitOnConnectionReady(); - -private: - static void ConnectionChanged(const bool, const Firebolt::Error); - static bool _connected; - static OnUserInterestNotification _userInterestNotification; - -}; \ No newline at end of file diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp deleted file mode 100644 index aee23e31f..000000000 --- a/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include "DiscoverySDKTest.h" - -using namespace std; - -const char* options = ":hu:"; - -void RunAllTests() { - bool allTestsPassed = true; - vector errorMessages; - - auto runTest = [&allTestsPassed, &errorMessages](auto testFunction, const string& testName) { - try { - testFunction(); - } catch (const exception& e) { - errorMessages.push_back("Test " + testName + " failed: " + e.what()); - allTestsPassed = false; - } - }; - - // Ensure the connection is ready before running tests - if (DiscoverySDKTest::WaitOnConnectionReady()) { - - runTest(DiscoverySDKTest::SubscribeUserInterest, "SubscribeUserInterest"); - runTest(DiscoverySDKTest::UnsubscribeUserInterest, "UnsubscribeUserInterest"); - runTest(DiscoverySDKTest::RequestUserInterest, "RequestUserInterest"); - - if (allTestsPassed) { - cout << "============================" << endl; - cout << "ALL DISCOVERY SDK TESTS SUCCEEDED!" << endl; - cout << "============================" << endl; - } else { - cout << "============================" << endl; - cout << "SOME TESTS FAILED:" << endl; - for (const auto& errorMessage : errorMessages) { - cout << errorMessage << endl; - } - cout << "============================" << endl; - exit(1); - } - } else { - cout << "Discovery Test not able to connect with server..." << endl; - exit(1); - } -} - -int main(int argc, char* argv[]) { - int c; - string url = "ws://127.0.0.1:9998"; - while ((c = getopt(argc, argv, options)) != -1) { - switch (c) { - case 'u': - url = optarg; - break; - case 'h': - printf("./TestFireboltDiscovery -u ws://ip:port\n"); - exit(1); - } - } - - printf("Firebolt Discovery SDK Test\n"); - - DiscoverySDKTest::CreateFireboltInstance(url); - RunAllTests(); - DiscoverySDKTest::DestroyFireboltInstance(); - - return 0; -} \ No newline at end of file diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh b/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh deleted file mode 100644 index 4db39cbe8..000000000 --- a/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -usage() -{ - echo "options:" - echo " -t test path" - echo " -s sysroot path" - echo " -f firebolt path" - echo " -c clear build" - echo " -h : help" - echo - echo "usage: " - echo " ./build.sh -t testpath -c -f fireboltpath -s sysrootpath" -} - -TestPath="." -FireboltPath=${FIREBOLT_PATH} -SysrootPath=${SYSROOT_PATH} -ClearBuild="N" -while getopts t:s:f:ch flag -do - case "${flag}" in - t) TestPath="${OPTARG}";; - s) SysrootPath="${OPTARG}";; - f) FireboltPath="${OPTARG}";; - c) ClearBuild="Y";; - h) usage && exit 1;; - esac -done - -if [ "${ClearBuild}" == "Y" ]; -then - rm -rf ${TestPath}/build -fi - -echo "TestPath" -echo "${TestPath}" -echo "FireboltPath" -echo ${FireboltPath} -cmake -B${TestPath}/build -S${TestPath} -DSYSROOT_PATH=${SysrootPath} -DFIREBOLT_PATH=${FireboltPath} -cmake --build ${TestPath}/build diff --git a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp deleted file mode 100644 index 1b174038b..000000000 --- a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "${info.title.lowercase}_impl.h" - -${if.implementations} -namespace Firebolt { -namespace ${info.Title} { -${if.providers} -/* ${PROVIDERS} */${end.if.providers} - - // Methods - /* requestUserInterest - Provide information about the entity currently displayed or selected on the screen. */ - InterestResult ContentImpl::requestUserInterest( const Discovery::InterestType& type, const Discovery::InterestReason& reason, Firebolt::Error *err ) - { - Firebolt::Error status = Firebolt::Error::NotConnected; - InterestResult interest; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - JsonObject jsonParameters; - Firebolt::Discovery::JsonData_InterestType jsonType = type; - WPEFramework::Core::JSON::Variant typeVariant(jsonType.Data()); - jsonParameters.Set(_T("type"), typeVariant); - Firebolt::Discovery::JsonData_InterestReason jsonReason = reason; - WPEFramework::Core::JSON::Variant reasonVariant(jsonReason.Data()); - jsonParameters.Set(_T("reason"), reasonVariant); - JsonData_InterestResult jsonResult; - status = transport->Invoke("content.requestUserInterest", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Content.requestUserInterest is successfully invoked"); - InterestResult interestResult; - interestResult.appId = jsonResult.AppId.Value(); - { - string identifiersStr; - jsonResult.Entity.Identifiers.ToString(identifiersStr); - interestResult.entity.identifiers = identifiersStr; - if (jsonResult.Entity.Info.IsSet()) { - interestResult.entity.info = std::make_optional(); - if (jsonResult.Entity.Info.Title.IsSet()) { - interestResult.entity.info.value().title = jsonResult.Entity.Info.Title; - } - if (jsonResult.Entity.Info.Synopsis.IsSet()) { - interestResult.entity.info.value().synopsis = jsonResult.Entity.Info.Synopsis; - } - if (jsonResult.Entity.Info.SeasonNumber.IsSet()) { - interestResult.entity.info.value().seasonNumber = jsonResult.Entity.Info.SeasonNumber; - } - if (jsonResult.Entity.Info.SeasonCount.IsSet()) { - interestResult.entity.info.value().seasonCount = jsonResult.Entity.Info.SeasonCount; - } - if (jsonResult.Entity.Info.EpisodeNumber.IsSet()) { - interestResult.entity.info.value().episodeNumber = jsonResult.Entity.Info.EpisodeNumber; - } - if (jsonResult.Entity.Info.EpisodeCount.IsSet()) { - interestResult.entity.info.value().episodeCount = jsonResult.Entity.Info.EpisodeCount; - } - if (jsonResult.Entity.Info.ReleaseDate.IsSet()) { - interestResult.entity.info.value().releaseDate = jsonResult.Entity.Info.ReleaseDate; - } - if (jsonResult.Entity.Info.ContentRatings.IsSet()) { - interestResult.entity.info.value().contentRatings = std::make_optional>(); - auto index(jsonResult.Entity.Info.ContentRatings.Elements()); - while (index.Next() == true) { - Entertainment::ContentRating contentRatingsResult1; - Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); - { - contentRatingsResult1.scheme = jsonResult.Scheme; - contentRatingsResult1.rating = jsonResult.Rating; - if (jsonResult.Advisories.IsSet()) { - contentRatingsResult1.advisories = std::make_optional>(); - auto index(jsonResult.Advisories.Elements()); - while (index.Next() == true) { - contentRatingsResult1.advisories.value().push_back(index.Current().Value()); - } - } - } - interestResult.entity.info.value().contentRatings->push_back(contentRatingsResult1); - } - } - } - if (jsonResult.Entity.WaysToWatch.IsSet()) { - interestResult.entity.waysToWatch = std::make_optional>(); - auto index(jsonResult.Entity.WaysToWatch.Elements()); - while (index.Next() == true) { - Entertainment::WayToWatch waysToWatchResult1; - Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); - { - { - if (jsonResult.Identifiers.AssetId.IsSet()) { - waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; - } - if (jsonResult.Identifiers.EntityId.IsSet()) { - waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; - } - if (jsonResult.Identifiers.SeasonId.IsSet()) { - waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; - } - if (jsonResult.Identifiers.SeriesId.IsSet()) { - waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; - } - if (jsonResult.Identifiers.AppContentData.IsSet()) { - waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; - } - } - if (jsonResult.Expires.IsSet()) { - waysToWatchResult1.expires = jsonResult.Expires; - } - if (jsonResult.Entitled.IsSet()) { - waysToWatchResult1.entitled = jsonResult.Entitled; - } - if (jsonResult.EntitledExpires.IsSet()) { - waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; - } - if (jsonResult.OfferingType.IsSet()) { - waysToWatchResult1.offeringType = jsonResult.OfferingType; - } - if (jsonResult.HasAds.IsSet()) { - waysToWatchResult1.hasAds = jsonResult.HasAds; - } - if (jsonResult.Price.IsSet()) { - waysToWatchResult1.price = jsonResult.Price; - } - if (jsonResult.VideoQuality.IsSet()) { - waysToWatchResult1.videoQuality = std::make_optional>(); - auto index(jsonResult.VideoQuality.Elements()); - while (index.Next() == true) { - waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); - } - } - auto index(jsonResult.AudioProfile.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioProfile.push_back(index.Current().Value()); - } - if (jsonResult.AudioLanguages.IsSet()) { - waysToWatchResult1.audioLanguages = std::make_optional>(); - auto index(jsonResult.AudioLanguages.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); - } - } - if (jsonResult.ClosedCaptions.IsSet()) { - waysToWatchResult1.closedCaptions = std::make_optional>(); - auto index(jsonResult.ClosedCaptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); - } - } - if (jsonResult.Subtitles.IsSet()) { - waysToWatchResult1.subtitles = std::make_optional>(); - auto index(jsonResult.Subtitles.Elements()); - while (index.Next() == true) { - waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); - } - } - if (jsonResult.AudioDescriptions.IsSet()) { - waysToWatchResult1.audioDescriptions = std::make_optional>(); - auto index(jsonResult.AudioDescriptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); - } - } - } - interestResult.entity.waysToWatch->push_back(waysToWatchResult1); - } - } - } - interest = interestResult; - } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); - } - if (err != nullptr) { - *err = status; - } - - return interest; - } - - - // Events - /* onUserInterest - Provide information about the entity currently displayed or selected on the screen. */ - static void onUserInterestInnerCallback( void* notification, const void* userData, void* jsonResponse ) - { - WPEFramework::Core::ProxyType& proxyResponse = *(reinterpret_cast*>(jsonResponse)); - - ASSERT(proxyResponse.IsValid() == true); - - if (proxyResponse.IsValid() == true) { - InterestEvent interest; - - interest.appId = proxyResponse->AppId; - interest.type = proxyResponse->Type; - interest.reason = proxyResponse->Reason; - { - string identifiersStr; - (*proxyResponse).Entity.Identifiers.ToString(identifiersStr); - interest.entity.identifiers = identifiersStr; - if ((*proxyResponse).Entity.Info.IsSet()) { - interest.entity.info = std::make_optional(); - if ((*proxyResponse).Entity.Info.Title.IsSet()) { - interest.entity.info.value().title = (*proxyResponse).Entity.Info.Title; - } - if ((*proxyResponse).Entity.Info.Synopsis.IsSet()) { - interest.entity.info.value().synopsis = (*proxyResponse).Entity.Info.Synopsis; - } - if ((*proxyResponse).Entity.Info.SeasonNumber.IsSet()) { - interest.entity.info.value().seasonNumber = (*proxyResponse).Entity.Info.SeasonNumber; - } - if ((*proxyResponse).Entity.Info.SeasonCount.IsSet()) { - interest.entity.info.value().seasonCount = (*proxyResponse).Entity.Info.SeasonCount; - } - if ((*proxyResponse).Entity.Info.EpisodeNumber.IsSet()) { - interest.entity.info.value().episodeNumber = (*proxyResponse).Entity.Info.EpisodeNumber; - } - if ((*proxyResponse).Entity.Info.EpisodeCount.IsSet()) { - interest.entity.info.value().episodeCount = (*proxyResponse).Entity.Info.EpisodeCount; - } - if ((*proxyResponse).Entity.Info.ReleaseDate.IsSet()) { - interest.entity.info.value().releaseDate = (*proxyResponse).Entity.Info.ReleaseDate; - } - if ((*proxyResponse).Entity.Info.ContentRatings.IsSet()) { - interest.entity.info.value().contentRatings = std::make_optional>(); - auto index((*proxyResponse).Entity.Info.ContentRatings.Elements()); - while (index.Next() == true) { - Entertainment::ContentRating contentRatingsResult1; - Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); - contentRatingsResult1.scheme = jsonResult.Scheme; - contentRatingsResult1.rating = jsonResult.Rating; - if (jsonResult.Advisories.IsSet()) { - contentRatingsResult1.advisories = std::make_optional>(); - auto index(jsonResult.Advisories.Elements()); - while (index.Next() == true) { - contentRatingsResult1.advisories.value().push_back(index.Current().Value()); - } - } - interest.entity.info.value().contentRatings.value().push_back(contentRatingsResult1); - } - } - } - if ((*proxyResponse).Entity.WaysToWatch.IsSet()) { - interest.entity.waysToWatch = std::make_optional>(); - auto index((*proxyResponse).Entity.WaysToWatch.Elements()); - while (index.Next() == true) { - Entertainment::WayToWatch waysToWatchResult1; - Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); - { - if (jsonResult.Identifiers.AssetId.IsSet()) { - waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; - } - if (jsonResult.Identifiers.EntityId.IsSet()) { - waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; - } - if (jsonResult.Identifiers.SeasonId.IsSet()) { - waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; - } - if (jsonResult.Identifiers.SeriesId.IsSet()) { - waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; - } - if (jsonResult.Identifiers.AppContentData.IsSet()) { - waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; - } - } - if (jsonResult.Expires.IsSet()) { - waysToWatchResult1.expires = jsonResult.Expires; - } - if (jsonResult.Entitled.IsSet()) { - waysToWatchResult1.entitled = jsonResult.Entitled; - } - if (jsonResult.EntitledExpires.IsSet()) { - waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; - } - if (jsonResult.OfferingType.IsSet()) { - waysToWatchResult1.offeringType = jsonResult.OfferingType; - } - if (jsonResult.HasAds.IsSet()) { - waysToWatchResult1.hasAds = jsonResult.HasAds; - } - if (jsonResult.Price.IsSet()) { - waysToWatchResult1.price = jsonResult.Price; - } - if (jsonResult.VideoQuality.IsSet()) { - waysToWatchResult1.videoQuality = std::make_optional>(); - auto index(jsonResult.VideoQuality.Elements()); - while (index.Next() == true) { - waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); - } - } - auto index(jsonResult.AudioProfile.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioProfile.push_back(index.Current().Value()); - } - if (jsonResult.AudioLanguages.IsSet()) { - waysToWatchResult1.audioLanguages = std::make_optional>(); - auto index(jsonResult.AudioLanguages.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); - } - } - if (jsonResult.ClosedCaptions.IsSet()) { - waysToWatchResult1.closedCaptions = std::make_optional>(); - auto index(jsonResult.ClosedCaptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); - } - } - if (jsonResult.Subtitles.IsSet()) { - waysToWatchResult1.subtitles = std::make_optional>(); - auto index(jsonResult.Subtitles.Elements()); - while (index.Next() == true) { - waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); - } - } - if (jsonResult.AudioDescriptions.IsSet()) { - waysToWatchResult1.audioDescriptions = std::make_optional>(); - auto index(jsonResult.AudioDescriptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); - } - } - interest.entity.waysToWatch.value().push_back(waysToWatchResult1); - } - } - } - - proxyResponse.Release(); - - IContent::IOnUserInterestNotification& notifier = *(reinterpret_cast(notification)); - notifier.onUserInterest(interest); - } - } - void ContentImpl::subscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err ) - { - const string eventName = _T("content.onUserInterest"); - Firebolt::Error status = Firebolt::Error::None; - - JsonObject jsonParameters; - - status = FireboltSDK::Event::Instance().Subscribe(eventName, jsonParameters, onUserInterestInnerCallback, reinterpret_cast(¬ification), nullptr); - - if (err != nullptr) { - *err = status; - } - } - void ContentImpl::unsubscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err ) - { - Firebolt::Error status = FireboltSDK::Event::Instance().Unsubscribe(_T("content.onUserInterest"), reinterpret_cast(¬ification)); - - if (err != nullptr) { - *err = status; - } - } - - -}//namespace ${info.Title} -}${end.if.implementations} - -${if.enums} - -namespace WPEFramework { - -/* ${ENUMS} */ -}${end.if.enums} - diff --git a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h deleted file mode 100644 index a01a3eb3e..000000000 --- a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "FireboltSDK.h" -#include "IModule.h" -/* ${IMPORTS} */ -#include "${info.title.lowercase}.h" - -${if.implementations} -namespace Firebolt { -namespace ${info.Title} { - - - // Types - class JsonData_InterestResult: public WPEFramework::Core::JSON::Container { - public: - ~JsonData_InterestResult() override = default; - - public: - JsonData_InterestResult() - : WPEFramework::Core::JSON::Container() - { - Add(_T("appId"), &AppId); - Add(_T("entity"), &Entity); - } - - JsonData_InterestResult(const JsonData_InterestResult& other) - { - Add(_T("appId"), &AppId); - AppId = other.AppId; - Add(_T("entity"), &Entity); - Entity = other.Entity; - } - - JsonData_InterestResult& operator=(const JsonData_InterestResult& other) - { - Add(_T("appId"), &AppId); - AppId = other.AppId; - Add(_T("entity"), &Entity); - Entity = other.Entity; - return (*this); - } - - public: - FireboltSDK::JSON::String AppId; - Firebolt::Entity::JsonData_EntityDetails Entity; - }; - - class JsonData_InterestEvent: public WPEFramework::Core::JSON::Container { - public: - ~JsonData_InterestEvent() override = default; - - public: - JsonData_InterestEvent() - : WPEFramework::Core::JSON::Container() - { - Add(_T("appId"), &AppId); - Add(_T("type"), &Type); - Add(_T("reason"), &Reason); - Add(_T("entity"), &Entity); - } - - JsonData_InterestEvent(const JsonData_InterestEvent& other) - { - Add(_T("appId"), &AppId); - AppId = other.AppId; - Add(_T("type"), &Type); - Type = other.Type; - Add(_T("reason"), &Reason); - Reason = other.Reason; - Add(_T("entity"), &Entity); - Entity = other.Entity; - } - - JsonData_InterestEvent& operator=(const JsonData_InterestEvent& other) - { - Add(_T("appId"), &AppId); - AppId = other.AppId; - Add(_T("type"), &Type); - Type = other.Type; - Add(_T("reason"), &Reason); - Reason = other.Reason; - Add(_T("entity"), &Entity); - Entity = other.Entity; - return (*this); - } - - public: - FireboltSDK::JSON::String AppId; - Firebolt::Discovery::JsonData_InterestType Type; - Firebolt::Discovery::JsonData_InterestReason Reason; - Firebolt::Entity::JsonData_EntityDetails Entity; - }; - - class ContentImpl : public IContent, public IModule { - - public: - ContentImpl() = default; - ContentImpl(const ContentImpl&) = delete; - ContentImpl& operator=(const ContentImpl&) = delete; - - ~ContentImpl() override = default; - - // Methods & Events - // signature callback params: - // method result properties : - void subscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err = nullptr ) override; - void unsubscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err = nullptr ) override; - - /* - requestUserInterest - Provide information about the entity currently displayed or selected on the screen. - */ - InterestResult requestUserInterest( const Discovery::InterestType& type, const Discovery::InterestReason& reason, Firebolt::Error *err = nullptr ) override; - - }; - -}//namespace ${info.Title} -}${end.if.implementations} diff --git a/src/sdks/discovery/src/js/sdk/index.mjs b/src/sdks/discovery/src/js/sdk/index.mjs deleted file mode 100644 index a9f2f5ca6..000000000 --- a/src/sdks/discovery/src/js/sdk/index.mjs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { setMockResponses } from './Transport/MockTransport.mjs' - -/* ${MOCK_IMPORTS} */ - -setMockResponses({ - /* ${MOCK_OBJECTS} */ -}) - -/* ${EXPORTS} */ -export { default as Log } from './Log/index.mjs' -export { default as Events } from './Events/index.mjs' -export { default as Settings } from './Settings/index.mjs' diff --git a/src/sdks/discovery/test/suite/content.test.ts b/src/sdks/discovery/test/suite/content.test.ts deleted file mode 100644 index 1ab4e98c8..000000000 --- a/src/sdks/discovery/test/suite/content.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { Content } from "../../build/javascript/src/firebolt-discovery"; - -test("Content.requestUserInterest()", () => { - return Content.requestUserInterest(Content.InterestType.INTEREST, Content.InterestReason.PLAYLIST).then((interest: Content.InterestResult) => { - const entity = interest.entity - const appId = interest.appId - expect(appId).toBeDefined() - expect(entity).toBeDefined() - expect(entity.info.title).toBe("Cool Runnings") - }) -}); - -test("Content.onUserInterest()", () => { - return Content.listen('userInterest', (interest: Content.InterestEvent) => { - const entity = interest.entity - const appId = interest.appId - const reason = interest.reason - expect(interest['type']).toBeDefined() - expect(reason).toBeDefined() - expect(appId).toBeDefined() - expect(entity).toBeDefined() - expect(entity.info.title).toBe("Cool Runnings") - }) -}); diff --git a/src/sdks/discovery/tsconfig.json b/src/sdks/discovery/tsconfig.json deleted file mode 100644 index 56ff58bc8..000000000 --- a/src/sdks/discovery/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "include": [ - "test/suite/*" - ] -} \ No newline at end of file diff --git a/src/sdks/manage/.npmignore b/src/sdks/manage/.npmignore deleted file mode 100644 index 0e2ba4d22..000000000 --- a/src/sdks/manage/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -build/* -src/* -test/* -.DS_Store -jest.config.* -tsconfig.* \ No newline at end of file diff --git a/src/sdks/manage/CHANGELOG.md b/src/sdks/manage/CHANGELOG.md deleted file mode 100644 index c61c16dab..000000000 --- a/src/sdks/manage/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -# [1.4.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.4.0...v1.4.1) (2024-01-10) - -# [1.4.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0...v1.4.0) (2024-23-09) - -# [1.3.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) - -# [1.2.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.1.0...v1.2.0) (2024-06-14) - -# [1.1.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.0.0...v1.1.0) (2024-02-09) - -### Bug Fixes - -* Modified account:uid to SHOULD ([#224](https://github.com/rdkcentral/firebolt-apis/issues/224)) ([70c8b24](https://github.com/rdkcentral/firebolt-apis/commit/70c8b24decfcbff2c32fb1b0d21290afc00a8432)) - -### Features - -* HDMI Low Latency Mode ([#156](https://github.com/rdkcentral/firebolt-apis/issues/156)) ([06d3624](https://github.com/rdkcentral/firebolt-apis/commit/06d3624b69ee0529d4c1a1c78a15dbfdf54c8b16)) - -# [1.0.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.1...v1.0.0) (2023-11-03) - -Upgraded to 1.0 at part of RDK6 release. This API is still compatibile with 0.x versions. - -### Bug Fixes - - * Account.session params to be mandatory ([#196](https://github.com/rdkcentral/firebolt-apis/issues/196)) ([fc5c638](https://github.com/rdkcentral/firebolt-apis/commit/fc5c63886d9b4eb30b32c1edc75f0f6afe80a827)) - * CI looking for legacy 0.x version ([923d02a](https://github.com/rdkcentral/firebolt-apis/commit/923d02ae96716a5272c5507e864f366012824642)) - * Permission schema with Capability as required ([74d9de9](https://github.com/rdkcentral/firebolt-apis/commit/74d9de9b125baffb415e11ba3888c1c464cf5b12)) - * Provider error ([#202](https://github.com/rdkcentral/firebolt-apis/issues/202)) ([4666a5e](https://github.com/rdkcentral/firebolt-apis/commit/4666a5ee56846f14dd1ba79dab82891505b5a2ec)) - * schemas version upgraded to 2.0.0-next.1 ([#199](https://github.com/rdkcentral/firebolt-apis/issues/199)) ([b0fb8cf](https://github.com/rdkcentral/firebolt-apis/commit/b0fb8cfbda6bbef055000dc9911f344ab9ee8771)) - * Update schemas & 1.0.0 version! ([#200](https://github.com/rdkcentral/firebolt-apis/issues/200)) ([ea29f33](https://github.com/rdkcentral/firebolt-apis/commit/ea29f3323a22ffa36904bdc6cf6e76a31fa8cb76)) - * Updated metrics:distributor capability to could ([#185](https://github.com/rdkcentral/firebolt-apis/issues/185)) ([9ca2206](https://github.com/rdkcentral/firebolt-apis/commit/9ca2206a2dca7149dcf93df3d303806d136785ed)) - -### Features - -* Added optional parameter 'force' in usergrants.request ([#186](https://github.com/rdkcentral/firebolt-apis/issues/186)) ([31801ca](https://github.com/rdkcentral/firebolt-apis/commit/31801caec6bea0e8b295ea6a9ec54ca1d8e08d16)) - -# [0.17.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0...v0.17.1) (2023-09-15) - -### Bug Fixes - -fix: Add enumerated values for fontFamily/fontEdge (#181) - -# [0.17.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0...v0.17.0) (2023-09-07) - -### Bug Fixes - -* fix: Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) - -# [0.16.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0...v0.16.0) (2023-08-14) - -### Features - -* Added Manage APIs for `windlowColor` and `windowOpacity` ([#157](https://github.com/rdkcentral/firebolt-apis/issues/157)) ([f508358](https://github.com/rdkcentral/firebolt-apis/commit/f508358aeb2f58bb3893bbfaf09e2340fcadac8f)) - -# [0.15.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0...v0.15.0) (2023-07-31) - -### Bug Fixes - -* Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) -* window fix from firebolt-openrpc 2.0.3 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) - -### Features - -* **Nullable CC Styles** Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) -* **Window CC Styles** Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) -* **Audio Descriptions** Audio Description and Preferred Audio Languages Settings ([#45](https://github.com/rdkcentral/firebolt-apis/issues/45)) ([58f6ea1](https://github.com/rdkcentral/firebolt-apis/commit/58f6ea1dde7a819883eb3da24f879b6a9ecc9a41)) - -# [0.14.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.13.0...v0.14.0) (2023-06-22) - -### Bug Fixes - -* **Advertising:** put resetAdvertisingIdentifier back in manage sdk ([ce92ae7](https://github.com/rdkcentral/firebolt-apis/commit/ce92ae7bfff58fa1d3e4bee78c88d5edf0266473)) -* * **VoiceGuidance** Change voice guidance limits to 0.5 and 2 ([#137](https://github.com/rdkcentral/firebolt-apis/issues/137)) ([b8f1944](https://github.com/rdkcentral/firebolt-apis/commit/b8f19449efd808639599b162aba61c08ec089c41)) - -### Features - -* **Discovery** Add an event when apps call signIn or signOut ([#133](https://github.com/rdkcentral/firebolt-apis/issues/133)) ([8ba2515](https://github.com/rdkcentral/firebolt-apis/commit/8ba2515948c433ccc38662f223f5fb399cf34841)) - -# [0.13.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.12.0...v0.13.0) (2023-06-09) - -### Bug Fixes - -* Grant providers should allow null responses for deferred challenges ([#128](https://github.com/rdkcentral/firebolt-apis/issues/128)) ([0ddd11a](https://github.com/rdkcentral/firebolt-apis/commit/0ddd11af282aed85112fb739993ae58cfc1c4910)) -* Point to `firebolt-openrpc` 2.0.1 ([c57cb21](https://github.com/rdkcentral/firebolt-apis/commit/c57cb218343fd058e2e6e676d52d9d0c904ad9a8)) -* Added Changelog note about accessory removal ([02e81c0](https://github.com/rdkcentral/firebolt-apis/commit/02e81c0f0233862e2d2386989943a840eddc5b6a)) - -### Features - -* Add SecureStorage.setForApp, removeForApp, .clearForApp methods. ([#127](https://github.com/rdkcentral/firebolt-apis/issues/127)) ([4422c79](https://github.com/rdkcentral/firebolt-apis/commit/4422c79122fc35e7b35180254be52bf33c64ab5b)) - -# [0.12.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.11.0...v0.12.0) (2023-05-18) - -### Bug Fixes - -* Updated `Advertising.resetIdentifier` capability ([47e730c](https://github.com/rdkcentral/firebolt-core-sdk/commit/47e730c4572ca2b8b9fdc3b2062121ef802914aa)) -* Removed `Accessory` module, which was not finished or ready for release ([6bcbb3f](https://github.com/rdkcentral/firebolt-apis/commit/6bcbb3fa347cb412e0d973beb6ecff7fe966607a)) - -### Features - -* Add the `Advertising.skipRestriction` API and included in Manage SDK ([#122](https://github.com/rdkcentral/firebolt-core-sdk/issues/122)) ([da9d75f](https://github.com/rdkcentral/firebolt-core-sdk/commit/da9d75f8c29bf04674e3de692874888796665a9a)) - - -# [0.11.0](https://github.com/rdkcentral/firebolt-core-sdk/compare/v0.10.0...v0.11.0) (2023-05-01) - -This is the first release of the Firebolt Manage SDK, which is used by first party, or trusted, apps to manage a Firebolt device. - -### Features - -* Accessory module -* Account module -* AcknowledgeChallenge module -* Advertising module -* ClosedCaptions module -* Device module -* Keyboard module -* Localization module -* Metrics module -* PinChallenge module -* Privacy module -* UserGrants module -* VoiceGuidance module -* Wifi module diff --git a/src/sdks/manage/CONTRIBUTING.md b/src/sdks/manage/CONTRIBUTING.md deleted file mode 120000 index c97564d93..000000000 --- a/src/sdks/manage/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -../../../CONTRIBUTING.md \ No newline at end of file diff --git a/src/sdks/manage/LICENSE b/src/sdks/manage/LICENSE deleted file mode 120000 index 5853aaea5..000000000 --- a/src/sdks/manage/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../../LICENSE \ No newline at end of file diff --git a/src/sdks/manage/NOTICE b/src/sdks/manage/NOTICE deleted file mode 120000 index 295f6bdb3..000000000 --- a/src/sdks/manage/NOTICE +++ /dev/null @@ -1 +0,0 @@ -../../../NOTICE \ No newline at end of file diff --git a/src/sdks/manage/README.md b/src/sdks/manage/README.md deleted file mode 100644 index 68abd2898..000000000 --- a/src/sdks/manage/README.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Firebolt Manage SDK ---- - -[![semantic-release: conventional](https://img.shields.io/badge/semantic--release-conventional-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) - -# Firebolt Manage SDK -For building Firebolt compliant apps that manage Firebolt devices. - -## Usage -To install, run: - -``` -npm install @firebolt-js/manage-sdk -``` - -To use the package, import one of it's modules, e.g.: - -```js -import { Privacy } from '@firebolt-js/manage-sdk' -``` - -## Contributing -The Firebolt SDKs are built using the Firebolt OpenRPC toolset: - -See [Firebolt OpenRPC](https://www.github.com/rdkcentral/firebolt-openrpc/), for more info. diff --git a/src/sdks/manage/Setup.js b/src/sdks/manage/Setup.js deleted file mode 100644 index 472edc35c..000000000 --- a/src/sdks/manage/Setup.js +++ /dev/null @@ -1,36 +0,0 @@ -if (!window.__firebolt) { - window.__firebolt = {} -} - -// wires up the mock transport w/out waiting -window.__firebolt.mockTransportLayer = true - -// sets a flag that mock defaults impls can use to speed things up, e.g. Lifecycle/defaults.js -window.__firebolt.automation = true - -let sendListener -let receiver - -export const transport = { - send: function(message) { - const json = JSON.parse(message) - sendListener && sendListener(json) - }, - receive: function(callback) { - // store the callback - receiver = callback - }, - onSend: function(listener) { - sendListener = listener - }, - response: function(id, result) { - let response = { - jsonrpc: '2.0', - id: id, - result: result - } - receiver && receiver(JSON.stringify(response)) - } -} - -window.__firebolt.setTransportLayer(transport) \ No newline at end of file diff --git a/src/sdks/manage/jest.config.json b/src/sdks/manage/jest.config.json deleted file mode 100644 index 745370cfa..000000000 --- a/src/sdks/manage/jest.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|js?)$", - "transform": {}, - "testPathIgnorePatterns": ["/node_modules/", "/../../../test"], - "moduleFileExtensions": ["js", "jsx", "mjs"], - "verbose": true, - "testEnvironment": "jest-environment-jsdom" - } \ No newline at end of file diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json deleted file mode 100644 index 026dc018f..000000000 --- a/src/sdks/manage/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@firebolt-js/manage-sdk", - "version": "1.5.0-next.21", - "description": "The Firebolt Manage JS SDK", - "main": "./dist/lib/firebolt-manage.mjs", - "types": "./dist/lib/firebolt-manage.d.ts", - "type": "module", - "scripts": { - "validate": "npx firebolt-openrpc validate --input ./dist/firebolt-manage-open-rpc.json", - "sdk": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/js --output ./build/javascript/src", - "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", - "cpp": "npm run cpp:compile && cp ./dist/firebolt-manage-open-rpc.json ./build/cpp/src && npm run cpp:install", - "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-manage-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", - "cpp:install": "chmod +x ./build/cpp/src/scripts/install.sh && sdkVersion=$(npm run -s getVersion) && ./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m manage -v $sdkVersion", - "compile": "cd ../../.. && npm run compile", - "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-manage-open-rpc.json", - "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-manage-open-rpc.json --output build/docs/markdown --as-path", - "wiki": "npx firebolt-openrpc docs --input ./dist/firebolt-manage-open-rpc.json --output build/docs/markdown", - "dist:notest": "npm run clean && npm run slice && npm run validate && npm run sdk && npm run docs && npm run prettier && npm run dist:copy && echo 'Firebolt Manage SDK /dist/ is ready.\n'", - "dist:copy": "npm run dist:copy:sdk && npm run dist:copy:docs", - "dist:copy:sdk": "mkdirp ./dist && cp -R build/javascript/src dist/lib && cp ./dist/firebolt-manage-open-rpc.json ../../../dist/firebolt-manage-open-rpc.json", - "dist:copy:docs": "mkdirp ./dist && cp -R build/docs/markdown dist/docs", - "dist": "npm run dist:notest && npm run test", - "clean": "rm -rf ./build && rm -rf ./dist", - "test:setup": "rm -rf test/transpiled-suite && npx tsc --target es6 --moduleResolution node --outDir test/transpiled-suite", - "test": "npm run test:setup && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest", - "prepack": "node ../../js/version.mjs validate && npm run broilerplate", - "broilerplate": "rm ./CONTRIBUTING.md && cp ../../../CONTRIBUTING.md ./CONTRIBUTING.md && rm ./LICENSE && cp ../../../LICENSE ./LICENSE && rm ./NOTICE && cp ../../../NOTICE ./NOTICE", - "prettier": "prettier build/**/*.mjs --write --parser babel && prettier build/**/*.ts --write --parser typescript && prettier build/**/*.md --write --parser markdown", - "getVersion": "node -p \"require('./package.json').version\"" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/rdkcentral/firebolt-core-sdk", - "directory": "src/sdks/manage" - }, - "author": "", - "bugs": { - "url": "https://github.com/rdkcentral/firebolt-core-sdk/issues" - }, - "homepage": "https://github.com/rdkcentral/firebolt-core-sdk#readme", - "devDependencies": { - "jest": "^28.1.0", - "jest-environment-jsdom": "^28.1.3", - "prettier": "^3.1.0", - "typescript": "^4.6.4" - }, - "keywords": [ - "firebolt", - "apps", - "sdk" - ], - "license": "Apache-2.0" -} \ No newline at end of file diff --git a/src/sdks/manage/sdk.config.json b/src/sdks/manage/sdk.config.json deleted file mode 100644 index 7398c98e1..000000000 --- a/src/sdks/manage/sdk.config.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "info": { - "title": "Firebolt Manage SDK", - "x-interface-names": { - "xrn:firebolt:capability:lifecycle:state": "StateProvider" - } - }, - "methods": [ - { - "module": "Localization", - "use": [ - "xrn:firebolt:capability:localization:locality", - "xrn:firebolt:capability:localization:postal-code", - "xrn:firebolt:capability:localization:country-code", - "xrn:firebolt:capability:localization:language", - "xrn:firebolt:capability:localization:locale", - "xrn:firebolt:capability:localization:time-zone", - "xrn:firebolt:capability:localization:additional-info" - ], - "manage": [ - "xrn:firebolt:capability:localization:locality", - "xrn:firebolt:capability:localization:postal-code", - "xrn:firebolt:capability:localization:country-code", - "xrn:firebolt:capability:localization:language", - "xrn:firebolt:capability:localization:locale", - "xrn:firebolt:capability:localization:time-zone", - "xrn:firebolt:capability:localization:additional-info" - ] - }, - { - "module": "Metrics", - "use": [ - "xrn:firebolt:capability:metrics:distributor" - ] - }, - { - "module": "Wifi", - "use": [ - "xrn:firebolt:capability:protocol:wifi" - ] - }, - { - "module": "ClosedCaptions", - "use": [ - "xrn:firebolt:capability:accessibility:closedcaptions" - ], - "manage": [ - "xrn:firebolt:capability:accessibility:closedcaptions" - ] - }, - { - "module": "AudioDescriptions", - "use": [ - "xrn:firebolt:capability:accessibility:audiodescriptions" - ], - "manage": [ - "xrn:firebolt:capability:accessibility:audiodescriptions" - ] - }, - { - "module": "VoiceGuidance", - "use": [ - "xrn:firebolt:capability:accessibility:voiceguidance" - ], - "manage": [ - "xrn:firebolt:capability:accessibility:voiceguidance" - ] - }, - { - "module": "Device", - "use": [ - "xrn:firebolt:capability:device:name" - ], - "manage": [ - "xrn:firebolt:capability:device:distributor", - "xrn:firebolt:capability:device:id", - "xrn:firebolt:capability:device:name" - ] - }, - { - "module": "UserGrants", - "use": [ - "xrn:firebolt:capability:grants:state" - ], - "manage": [ - "xrn:firebolt:capability:grants:state" - ] - }, - { - "module": "Privacy", - "use": [ - "xrn:firebolt:capability:privacy:settings" - ], - "manage": [ - "xrn:firebolt:capability:privacy:settings" - ] - }, - { - "module": "Advertising", - "manage": [ - "xrn:firebolt:capability:advertising:configuration", - "xrn:firebolt:capability:advertising:identifier" - ] - }, - { - "module": "Account", - "manage": [ - "xrn:firebolt:capability:account:id", - "xrn:firebolt:capability:token:account" - ], - "provide": [ - "xrn:firebolt:capability:token:account" - ] - }, - { - "module": "Keyboard", - "provide": [ - "xrn:firebolt:capability:input:keyboard" - ] - }, - { - "module": "AcknowledgeChallenge", - "provide": [ - "xrn:firebolt:capability:usergrant:acknowledgechallenge" - ] - }, - { - "module": "PinChallenge", - "provide": [ - "xrn:firebolt:capability:usergrant:pinchallenge" - ] - }, - { - "module": "SecureStorage", - "manage": [ - "xrn:firebolt:capability:storage:secure" - ] - }, - { - "module": "Discovery", - "manage": [ - "xrn:firebolt:capability:discovery:sign-in-status" - ] - }, - { - "module": "HDMIInput", - "use": [ - "xrn:firebolt:capability:inputs:hdmi" - ], - "manage": [ - "xrn:firebolt:capability:inputs:hdmi" - ] - } - ] -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt deleted file mode 100644 index 371e3c517..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/CMakeLists.txt +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright 2023 Comcast Cable Communications Management, LLC -# -# Licensed 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. -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.3) - -project(FireboltManageSDKTests) - -if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) - set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) -endif() - -list(APPEND CMAKE_MODULE_PATH - "${SYSROOT_PATH}/usr/lib/cmake" - "${SYSROOT_PATH}/tools/cmake") -message("FIREBOLT_PATH inside cmake " ${FIREBOLT_PATH}) -if (FIREBOLT_PATH) - set(CMAKE_FIREBOLT_PATH - "${FIREBOLT_PATH}/usr/lib/cmake/Firebolt" - "${FIREBOLT_PATH}/usr/lib/cmake/FireboltSDK") - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIREBOLT_PATH}) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_FIREBOLT_PATH}) -else () - set(FIREBOLT_PATH "${SYSROOT_PATH}" CACHE INTERNAL "" FORCE) -endif () - -find_package(WPEFramework CONFIG REQUIRED) -find_package(${NAMESPACE}Core CONFIG REQUIRED) - -set(TESTAPP TestFireboltManage) - -message("Setup ${TESTAPP}") - -add_executable(${TESTAPP} ManageSDKTest.cpp Main.cpp) - -target_link_libraries(${TESTAPP} - PRIVATE - ${NAMESPACE}Core::${NAMESPACE}Core - ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK - nlohmann_json_schema_validator - gtest_main -) - -target_include_directories(${TESTAPP} - PRIVATE - $ - $ - $ - $ -) - -set_target_properties(${TESTAPP} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES -) - -add_custom_command( - TARGET ${TESTAPP} - POST_BUILD - COMMENT "=================== Installing TestApp ======================" - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin -) - -if(ENABLE_UNIT_TESTS) - set(UNIT_TESTS_APP FireboltManageUnitTests) - - message("Setup ${UNIT_TESTS_APP}") - - file(GLOB UNIT_TESTS "unit/*") - - add_executable(${UNIT_TESTS_APP} - ManageSDKTest.cpp - Unit.cpp - ${UNIT_TESTS} - ) - - link_directories(${CMAKE_SOURCE_DIR}/../../Thunder/install/usr/lib/) - target_link_libraries(${UNIT_TESTS_APP} - PRIVATE - ${NAMESPACE}Core::${NAMESPACE}Core - ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK - nlohmann_json_schema_validator - gtest_main - ) - - target_include_directories(${UNIT_TESTS_APP} - PRIVATE - $ - ) - - set_target_properties(${UNIT_TESTS_APP} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - ) - - include(GoogleTest) - gtest_discover_tests(${UNIT_TESTS_APP}) -endif() - -if(ENABLE_COVERAGE) - include(${CMAKE_SOURCE_DIR}/cmake/CodeCoverage.cmake) - - set(COVERAGE_MAIN "coverage") - set(COVERAGE_EXCLUDES - "${CMAKE_SOURCE_DIR}/build/*" - "${CMAKE_SOURCE_DIR}/cmake/*" - "${CMAKE_SOURCE_DIR}/include/*" - "${CMAKE_SOURCE_DIR}/test/*" - "/usr/include/*") - - set(COVERAGE_EXTRA_FLAGS) - set(COVERAGE_DEPENDENCIES ${UNIT_TESTS_APP}) - - setup_target_for_coverage_gcovr_html( - NAME ${COVERAGE_MAIN} - BASE_DIRECTORY ${CMAKE_SOURCE_DIR} - EXECUTABLE ctest - EXECUTABLE_ARGS "--test-dir ../build/ --output-on-failure" - DEPENDENCIES ${COVERAGE_DEPENDENCIES} - ) - -endif() diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp deleted file mode 100644 index 402bda600..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include -#include -#include "ManageSDKTest.h" - -using namespace std; - -const char* options = ":hu:"; - -void RunAllTests() { - bool allTestsPassed = true; - vector errorMessages; - - auto runTest = [&allTestsPassed, &errorMessages](auto testFunction, const string& testName) { - try { - testFunction(); - } catch (const exception& e) { - errorMessages.push_back("Test " + testName + " failed: " + e.what()); - allTestsPassed = false; - } - }; - - // Ensure the connection is ready before running tests - if (ManageSDKTest::WaitOnConnectionReady()) { - // Advertising methods - runTest(ManageSDKTest::GetAdvertisingSkipRestriction, "GetAdvertisingSkipRestriction"); - runTest(ManageSDKTest::SetAdvertisingSkipRestriction, "SetAdvertisingSkipRestriction"); - runTest(ManageSDKTest::ResetAdvertisingIdentifier, "ResetAdvertisingIdentifier"); - - // Account methods - runTest(ManageSDKTest::SetAccountSession, "SetAccountSession"); - - // AudioDescriptions methods - runTest(ManageSDKTest::GetAudioDescriptionsEnabled, "GetAudioDescriptionsEnabled"); - runTest(ManageSDKTest::SetAudioDescriptionsEnabled, "SetAudioDescriptionsEnabled"); - runTest(ManageSDKTest::SubscribeAudioDescriptionsEnabledChanged, "SubscribeAudioDescriptionsEnabledChanged"); - runTest(ManageSDKTest::UnsubscribeAudioDescriptionsEnabledChanged, "UnsubscribeAudioDescriptionsEnabledChanged"); - - // Device methods - runTest(ManageSDKTest::GetDeviceName, "GetDeviceName"); - runTest(ManageSDKTest::SetDeviceName, "SetDeviceName"); - runTest(ManageSDKTest::SubscribeDeviceNameChanged, "SubscribeDeviceNameChanged"); - runTest(ManageSDKTest::UnsubscribeDeviceNameChanged, "UnsubscribeDeviceNameChanged"); - - // ClosedCaptions methods - runTest(ManageSDKTest::GetClosedCaptionsBackgroundOpacity, "GetClosedCaptionsBackgroundOpacity"); - runTest(ManageSDKTest::SetClosedCaptionsBackgroundOpacity, "SetClosedCaptionsBackgroundOpacity"); - runTest(ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged, "SubscribeClosedCaptionsBackgroundOpacityChanged"); - runTest(ManageSDKTest::UnsubscribeClosedCaptionsBackgroundOpacityChanged, "UnsubscribeClosedCaptionsBackgroundOpacityChanged"); - - runTest(ManageSDKTest::GetClosedCaptionsFontFamily, "GetClosedCaptionsFontFamily"); - runTest(ManageSDKTest::SetClosedCaptionsFontFamily, "SetClosedCaptionsFontFamily"); - runTest(ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged, "SubscribeClosedCaptionsFontFamilyChanged"); - runTest(ManageSDKTest::UnsubscribeClosedCaptionsFontFamilyChanged, "UnsubscribeClosedCaptionsFontFamilyChanged"); - - // Localization methods - runTest(ManageSDKTest::GetLocalizationPreferredAudioLanguages, "GetLocalizationPreferredAudioLanguages"); - runTest(ManageSDKTest::SetLocalizationPreferredAudioLanguages, "SetLocalizationPreferredAudioLanguages"); - runTest(ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged, "SubscribeLocalizationPreferredAudioLanguagesChanged"); - runTest(ManageSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged, "UnsubscribeLocalizationPreferredAudioLanguagesChanged"); - - runTest(ManageSDKTest::GetLocalizationAdditionalInfo, "GetLocalizationAdditionalInfo"); - runTest(ManageSDKTest::AddLocalizationAdditionalInfo, "AddLocalizationAdditionalInfo"); - runTest(ManageSDKTest::RemoveLocalizationAdditionalInfo, "RemoveLocalizationAdditionalInfo"); - - // Privacy methods - runTest(ManageSDKTest::GetPrivacyAllowACRCollection, "GetPrivacyAllowACRCollection"); - runTest(ManageSDKTest::SetPrivacyAllowACRCollection, "SetPrivacyAllowACRCollection"); - runTest(ManageSDKTest::SubscribePrivacyAllowACRCollectionChanged, "SubscribePrivacyAllowACRCollectionChanged"); - runTest(ManageSDKTest::UnsubscribePrivacyAllowACRCollectionChanged, "UnsubscribePrivacyAllowACRCollectionChanged"); - - runTest(ManageSDKTest::GetPrivacySettings, "GetPrivacySettings"); - - // Discovery methods - runTest(ManageSDKTest::SubscribeDiscoverySignInNotification, "SubscribeDiscoverySignInNotification"); - runTest(ManageSDKTest::UnsubscribeDiscoverySignInNotification, "UnsubscribeDiscoverySignInNotification"); - runTest(ManageSDKTest::SubscribeDiscoverySignOutNotification, "SubscribeDiscoverySignOutNotification"); - runTest(ManageSDKTest::UnsubscribeDiscoverySignOutNotification, "UnsubscribeDiscoverySignOutNotification"); - - // UserGrants methods - runTest(ManageSDKTest::GetUserGrantsPermission, "GetUserGrantsPermission"); - runTest(ManageSDKTest::GrantUserGrantsPermission, "GrantUserGrantsPermission"); - runTest(ManageSDKTest::DenyUserGrantsPermission, "DenyUserGrantsPermission"); - runTest(ManageSDKTest::ClearUserGrantsPermission, "ClearUserGrantsPermission"); - - // Wifi methods - // runTest(ManageSDKTest::WifiScan, "WifiScan"); - // runTest(ManageSDKTest::WifiConnect, "WifiConnect"); - // runTest(ManageSDKTest::WifiDisconnect, "WifiDisconnect"); - - // Provider registration - runTest(ManageSDKTest::RegisterKeyboardProvider, "RegisterKeyboardProvider"); - runTest(ManageSDKTest::SendResponseMessageToKeyboardProvider, "SendResponseMessageToKeyboardProvider"); - runTest(ManageSDKTest::SendErrorMessageToKeyboardProvider, "SendErrorMessageToKeyboardProvider"); - - runTest(ManageSDKTest::RegisterAcknowledgeChallengeProvider, "RegisterAcknowledgeChallengeProvider"); - runTest(ManageSDKTest::SendResponseMessageToAcknowledgeChallengeProvider, "SendResponseMessageToAcknowledgeChallengeProvider"); - runTest(ManageSDKTest::SendErrorMessageToAcknowledgeChallengeProvider, "SendErrorMessageToAcknowledgeChallengeProvider"); - - runTest(ManageSDKTest::RegisterPinChallengeProvider, "RegisterPinChallengeProvider"); - runTest(ManageSDKTest::SendResponseMessageToPinChallengeProvider, "SendResponseMessageToPinChallengeProvider"); - runTest(ManageSDKTest::SendErrorMessageToPinChallengeProvider, "SendErrorMessageToPinChallengeProvider"); - - runTest(ManageSDKTest::GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged"); - runTest(ManageSDKTest::GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged"); - - runTest(ManageSDKTest::GetAutoLowLatencyModeCapable, "GetAutoLowLatencyModeCapable"); - runTest(ManageSDKTest::SetAutoLowLatencyModeCapable, "SetAutoLowLatencyModeCapable"); - runTest(ManageSDKTest::GetEdidVersion, "GetEdidVersion"); - runTest(ManageSDKTest::SetEdidVersion, "SetEdidVersion"); - runTest(ManageSDKTest::GetHdmiPortInfo, "GetHdmiPortInfo"); - - if (allTestsPassed) { - cout << "============================" << endl; - cout << "ALL MANAGE SDK TESTS SUCCEEDED!" << endl; - cout << "============================" << endl; - } else { - cout << "============================" << endl; - cout << "SOME TESTS FAILED:" << endl; - for (const auto& errorMessage : errorMessages) { - cout << errorMessage << endl; - } - cout << "============================" << endl; - exit(1); - } - } else { - cout << "Manage Test not able to connect with server..." << endl; - exit(1); - } -} - -int main(int argc, char* argv[]) { - int c; - string url = "ws://127.0.0.1:9998"; - while ((c = getopt(argc, argv, options)) != -1) { - switch (c) { - case 'u': - url = optarg; - break; - case 'h': - printf("./TestFireboltManage -u ws://ip:port\n"); - exit(1); - } - } - - printf("Firebolt Manage SDK Test\n"); - - ManageSDKTest::CreateFireboltInstance(url); - RunAllTests(); - ManageSDKTest::DestroyFireboltInstance(); - - return 0; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp deleted file mode 100644 index af9bd9803..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include -#include "ManageSDKTest.h" - -using namespace std; -bool ManageSDKTest::_connected; -ManageSDKTest::OnAudioDescriptionsEnabledChangedNotification ManageSDKTest::_audioDescriptionEnabledChangedNotification; -ManageSDKTest::OnDeviceNameChangedNotification ManageSDKTest::_deviceNameChangedNotification; -ManageSDKTest::OnFontFamilyChangedNotification ManageSDKTest::_fontFamilyChangedNotification; -ManageSDKTest::OnBackgroundOpacityChangedNotification ManageSDKTest::_backgroundOpacityChangedNotification; -ManageSDKTest::OnPreferredAudioLanguagesChangedNotification ManageSDKTest::_preferredAudioLanguagesChangedNotification; -ManageSDKTest::OnAllowACRCollectionChangedNotification ManageSDKTest::_allowACRCollectionChangedNotification; -ManageSDKTest::OnSignInNotification ManageSDKTest::_signInNotification; -ManageSDKTest::OnSignOutNotification ManageSDKTest::_signOutNotification; -ManageSDKTest::OnAutoLowLatencyModeCapableChangedNotification ManageSDKTest::_autoLowLatencyModeCapableChangedNotification; -ManageSDKTest::KeyboardProvider ManageSDKTest::_keyboardProvider; -ManageSDKTest::AcknowledgeChallengeProvider ManageSDKTest::_acknowledgeChallengeProvider; -ManageSDKTest::PinChallengeProvider ManageSDKTest::_pinChallengeProvider; -Firebolt::Wifi::AccessPointList ManageSDKTest::_apList; - -void ManageSDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error) -{ - cout << "Change in connection: connected: " << connected << " error: " << static_cast(error) << endl; - _connected = connected; -} - -void ManageSDKTest::CreateFireboltInstance(const std::string& url) -{ - const std::string config = "{\ - \"waitTime\": 100000,\ - \"logLevel\": \"Info\",\ - \"workerPool\":{\ - \"queueSize\": 8,\ - \"threadCount\": 3\ - },\ - \"wsUrl\": " + url + "}"; - - _connected = false; - Firebolt::IFireboltAccessor::Instance().Initialize(config); - Firebolt::IFireboltAccessor::Instance().Connect(ConnectionChanged); -} - -void ManageSDKTest::DestroyFireboltInstance() -{ - Firebolt::IFireboltAccessor::Instance().Disconnect(); - Firebolt::IFireboltAccessor::Instance().Deinitialize(); - Firebolt::IFireboltAccessor::Instance().Dispose(); -} - -bool ManageSDKTest::WaitOnConnectionReady() -{ - uint32_t waiting = 10000; - static constexpr uint32_t SLEEPSLOT_TIME = 100; - - // Right, a wait till connection is closed is requested.. - while ((waiting > 0) && (_connected == false)) { - - uint32_t sleepSlot = (waiting > SLEEPSLOT_TIME ? SLEEPSLOT_TIME : waiting); - // Right, lets sleep in slices of 100 ms - usleep(sleepSlot); - waiting -= sleepSlot; - } - return _connected; -} - -template -using EnumMap = std::unordered_map; -template -inline const string& ConvertFromEnum(EnumMap enumMap, T type) -{ - return enumMap[type]; -} -template -inline const T ConvertToEnum(EnumMap enumMap, const string& str) -{ - T value; - for (auto element: enumMap) { - if (element.second == str) { - value = element.first; - break; - } - } - return value; -} - -EnumMap skipRestrictionMap = { - { Firebolt::Advertising::SkipRestriction::NONE, "none" }, - { Firebolt::Advertising::SkipRestriction::ADS_UNWATCHED, "adsUnwatched" }, - { Firebolt::Advertising::SkipRestriction::ADS_ALL, "adsAll" }, - { Firebolt::Advertising::SkipRestriction::ALL, "all" }}; - -void ManageSDKTest::GetAdvertisingSkipRestriction() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::Advertising::SkipRestriction skipRestriction = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().skipRestriction(&error); - if (error == Firebolt::Error::None) { - cout << "Get Advertising SkipRestriction is success : " << ConvertFromEnum(skipRestrictionMap, skipRestriction) << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetAdvertisingSkipRestriction failed. " + errorMessage); - } -} - -void ManageSDKTest::SetAdvertisingSkipRestriction() -{ - Firebolt::Error error = Firebolt::Error::None; - cout << "Support SkipRestriction -> " << endl; - for (auto skipRestriction : skipRestrictionMap) { - cout << skipRestriction.second << endl; - } - - std::string skipRestriction = "none"; - - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().setSkipRestriction(ConvertToEnum(skipRestrictionMap, skipRestriction), &error); - if (error == Firebolt::Error::None) { - cout << "Set Advertising SkipRestriction is success " << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetAdvertisingSkipRestriction failed. " + errorMessage); - } -} - -void ManageSDKTest::ResetAdvertisingIdentifier() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().resetIdentifier(&error); - if (error == Firebolt::Error::None) { - cout << "Set Advertising Reset Identifier is success " << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("ResetAdvertisingIdentifier failed. " + errorMessage); - } -} - -void ManageSDKTest::SetAccountSession() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string token = "Test"; - int32_t expiresIn = 60; - Firebolt::IFireboltAccessor::Instance().AccountInterface().session(token, expiresIn, &error); - if (error == Firebolt::Error::None) { - cout << "Set Account Session is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetAccountSession failed. " + errorMessage); - } -} - -void ManageSDKTest::GetAudioDescriptionsEnabled() -{ - Firebolt::Error error = Firebolt::Error::None; - bool enabled = Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().enabled(&error); - if (error == Firebolt::Error::None) { - cout << "Get AudioDescriptions Enabled: " << (enabled ? "true" : "false") << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetAudioDescriptionsEnabled failed. " + errorMessage); - } -} - -void ManageSDKTest::SetAudioDescriptionsEnabled() -{ - Firebolt::Error error = Firebolt::Error::None; - bool enabled = true; - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().setEnabled(enabled, &error); - if (error == Firebolt::Error::None) { - cout << "Set AudioDescriptions Enabled: " << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetAudioDescriptionsEnabled failed. " + errorMessage); - } -} - -void ManageSDKTest::OnAudioDescriptionsEnabledChangedNotification::onEnabledChanged(const bool enabled) -{ - cout << "AudioDescriptions Enabled changed, new value --> " << (enabled ? "true" : "false") << endl; -} - -void ManageSDKTest::SubscribeAudioDescriptionsEnabledChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().subscribe(_audioDescriptionEnabledChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe AudioDescriptions EnabledChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeAudioDescriptionsEnabledChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeAudioDescriptionsEnabledChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().unsubscribe(_audioDescriptionEnabledChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe AudioDescriptions EnabledChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeAudioDescriptionsEnabledChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::GetDeviceName() -{ - Firebolt::Error error = Firebolt::Error::None; - const std::string name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().name(&error); - - if (error == Firebolt::Error::None) { - cout << "Get Device Name = " << name.c_str() << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetDeviceName failed. " + errorMessage); - } -} - -void ManageSDKTest::SetDeviceName() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string name = "Kitchen"; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().setName(name, &error); - - if (error == Firebolt::Error::None) { - cout << "Set Device Name to " << name << " is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetDeviceName failed. " + errorMessage); - } -} - -void ManageSDKTest::OnDeviceNameChangedNotification::onDeviceNameChanged(const std::string& name) -{ - cout << "Name changed, new name --> " << name << endl; -} - -void ManageSDKTest::SubscribeDeviceNameChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(_deviceNameChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Device NameChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeDeviceNameChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeDeviceNameChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(_deviceNameChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Device NameChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeDeviceNameChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::GetClosedCaptionsBackgroundOpacity() -{ - Firebolt::Error error = Firebolt::Error::None; - const float value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().backgroundOpacity(&error); - - if (error == Firebolt::Error::None) { - cout << "Get ClosedCaption BackgroundOpacity = " << value << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetClosedCaptionsBackgroundOpacity failed. " + errorMessage); - } -} - -void ManageSDKTest::SetClosedCaptionsBackgroundOpacity() -{ - Firebolt::Error error = Firebolt::Error::None; - uint32_t bgOpacity = 1; - - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setBackgroundOpacity(bgOpacity, &error); - - if (error == Firebolt::Error::None) { - cout << "Set ClosedCaption BackgroundOpacity to " << bgOpacity << " is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetClosedCaptionsBackgroundOpacity failed. " + errorMessage); - } -} - -void ManageSDKTest::OnBackgroundOpacityChangedNotification::onBackgroundOpacityChanged(const float opacity) -{ - cout << "BackgroundOpacity changed, new value --> " << opacity << endl; -} - -void ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(_backgroundOpacityChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe ClosedCaptions BackgroundOpacityChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeClosedCaptionsBackgroundOpacityChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeClosedCaptionsBackgroundOpacityChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(_backgroundOpacityChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe ClosedCaptions BackgroundOpacityChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeClosedCaptionsBackgroundOpacityChanged failed. " + errorMessage); - } -} - -EnumMap fontFamilyMap = { - { Firebolt::Accessibility::FontFamily::MONOSPACED_SERIF, "MonospacedSerif" }, - { Firebolt::Accessibility::FontFamily::PROPORTIONAL_SERIF, "ProportionalSerif" }, - { Firebolt::Accessibility::FontFamily::MONOSPACED_SANSERIF, "MonospacedSanserif" }, - { Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF, "ProportionalSanserif" }, - { Firebolt::Accessibility::FontFamily::SMALLCAPS, "SmallCaps" }, - { Firebolt::Accessibility::FontFamily::CURSIVE, "Cursive" }, - { Firebolt::Accessibility::FontFamily::CASUAL, "Casual" } -}; - -void ManageSDKTest::GetClosedCaptionsFontFamily() -{ - Firebolt::Error error = Firebolt::Error::None; - const Firebolt::Accessibility::FontFamily value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontFamily(&error); - - if (error == Firebolt::Error::None) { - cout << "Get ClosedCaption FontFamily value = " << ConvertFromEnum(fontFamilyMap, value) << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetClosedCaptionsFontFamily failed. " + errorMessage); - } -} - -void ManageSDKTest::SetClosedCaptionsFontFamily() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::Accessibility::FontFamily fontFamily = Firebolt::Accessibility::FontFamily::MONOSPACED_SERIF; - - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontFamily(fontFamily, &error); - if (error == Firebolt::Error::None) { - cout << "Set ClosedCaption FontFamily to MonospacedSerif is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetClosedCaptionsFontFamily failed. " + errorMessage); - } -} - -void ManageSDKTest::OnFontFamilyChangedNotification::onFontFamilyChanged(const Firebolt::Accessibility::FontFamily& family) -{ - cout << "FontFamily changed, new code --> " << ConvertFromEnum(fontFamilyMap, family) << endl; -} - -void ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(_fontFamilyChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe ClosedCaptions FontFamilyChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeClosedCaptionsFontFamilyChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeClosedCaptionsFontFamilyChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(_fontFamilyChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe ClosedCaptions FontFamilyChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeClosedCaptionsFontFamilyChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::GetLocalizationPreferredAudioLanguages() -{ - Firebolt::Error error = Firebolt::Error::None; - const std::vector languages = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().preferredAudioLanguages(&error); - - if (error == Firebolt::Error::None) { - cout << "Get Localization PreferredAudioLanguages : " << endl; - for (auto language: languages) { - cout << "----- > " << language << endl; - } - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetLocalizationPreferredAudioLanguages failed. " + errorMessage); - } -} - -void ManageSDKTest::SetLocalizationPreferredAudioLanguages() -{ - Firebolt::Error error = Firebolt::Error::None; - std::vector newLanguages = { "eng" }; - - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setPreferredAudioLanguages(newLanguages, &error); - - if (error == Firebolt::Error::None) { - cout << "Set Localization PreferredAudioLanguages to eng is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetLocalizationPreferredAudioLanguages failed. " + errorMessage); - } -} - -void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAudioLanguagesChanged(const std::vector& languages) -{ - cout << "PreferredAudioLanguages Changed, new languages --> " << endl; - for (auto language : languages) { - cout << " -> " << language << endl; - } -} - -void ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(_preferredAudioLanguagesChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Localization PreferredAudioLanguagesChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeLocalizationPreferredAudioLanguagesChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(_preferredAudioLanguagesChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Localization PreferredAudioLanguagesChange is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeLocalizationPreferredAudioLanguagesChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::GetPrivacyAllowACRCollection() -{ - Firebolt::Error error = Firebolt::Error::None; - bool allowACRCollection = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowACRCollection(&error); - - if (error == Firebolt::Error::None) { - cout << "Get Privacy AllowACRCollection : " << (allowACRCollection ? "true" : "false") << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetPrivacyAllowACRCollection failed. " + errorMessage); - } -} - -void ManageSDKTest::SetPrivacyAllowACRCollection() -{ - Firebolt::Error error = Firebolt::Error::None; - bool allowACRCollection = false; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowACRCollection(allowACRCollection, &error); - - if (error == Firebolt::Error::None) { - cout << "Set Privacy AllowACRCollection is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetPrivacyAllowACRCollection failed. " + errorMessage); - } -} - -void ManageSDKTest::OnAllowACRCollectionChangedNotification::onAllowACRCollectionChanged(const bool allowACRCollection) -{ - cout << "AllowACRCollection Changed, new value of allowACRCollection : " << (allowACRCollection ? "true" : "false") << endl; -} - -void ManageSDKTest::SubscribePrivacyAllowACRCollectionChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(_allowACRCollectionChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Privacy AllowACRCollectionChanged is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribePrivacyAllowACRCollectionChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribePrivacyAllowACRCollectionChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(_allowACRCollectionChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Privacy AllowACRCollectionChanged is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribePrivacyAllowACRCollectionChanged failed. " + errorMessage); - } -} - -void ManageSDKTest::GetPrivacySettings() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::Privacy::PrivacySettings privacySettings = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().settings(&error); - - if (error == Firebolt::Error::None) { - cout << "Get Privacy Settings -> " << endl; - cout << "\tallowACRCollection : " << privacySettings.allowACRCollection << endl; - cout << "\tallowResumePoints : " << privacySettings.allowResumePoints << endl; - cout << "\tallowAppContentAdTargeting : " << privacySettings.allowAppContentAdTargeting << endl; - cout << "\tallowCameraAnalytics : " << privacySettings.allowCameraAnalytics << endl; - cout << "\tallowPersonalization : " << privacySettings.allowPersonalization << endl; - cout << "\tallowPrimaryBrowseAdTargeting : " << privacySettings.allowPrimaryBrowseAdTargeting << endl; - cout << "\tallowPrimaryContentAdTargeting : " << privacySettings.allowPrimaryContentAdTargeting << endl; - cout << "\tallowProductAnalytics : " << privacySettings.allowProductAnalytics << endl; - cout << "\tallowRemoteDiagnostics : " << privacySettings.allowRemoteDiagnostics << endl; - cout << "\tallowUnentitledPersonalization : " << privacySettings.allowUnentitledPersonalization << endl; - cout << "\tallowUnentitledResumePoints : " << privacySettings.allowUnentitledResumePoints << endl; - cout << "\tallowWatchHistory : " << privacySettings.allowWatchHistory << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetPrivacySettings failed. " + errorMessage); - } -} - -void ManageSDKTest::OnSignInNotification::onSignIn(const Firebolt::Discovery::Event& event) -{ - cout << "Discovery SignIn Event for appId --> " << event.appId << endl; -} - -void ManageSDKTest::SubscribeDiscoverySignInNotification() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(_signInNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Discovery SignIn Notification is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeDiscoverySignInNotification failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeDiscoverySignInNotification() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(_signInNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Discovery SignIn Notification is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeDiscoverySignInNotification failed. " + errorMessage); - } -} - -void ManageSDKTest::OnSignOutNotification::onSignOut(const Firebolt::Discovery::Event& event) -{ - cout << "Discovery SignOut Event for appId --> " << event.appId << endl; -} - -void ManageSDKTest::SubscribeDiscoverySignOutNotification() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(_signOutNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Subscribe Discovery SignOut Notification is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeDiscoverySignOutNotification failed. " + errorMessage); - } -} - -void ManageSDKTest::UnsubscribeDiscoverySignOutNotification() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(_signOutNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Unsubscribe Discovery SignOut Notification is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeDiscoverySignOutNotification failed. " + errorMessage); - } -} - -ManageSDKTest::KeyboardProvider::KeyboardProvider() - : _session(nullptr) - , _parameters() - , _keyInput(false) -{ -} - -void ManageSDKTest::KeyboardProvider::SendMessage(bool response) -{ - if (_keyInput) { - cout << " Invoking _session->focus " << endl; - _session->focus(); - getchar(); - - string key; - cout << _parameters.message << " : "; - getline(cin, key); - if (response) { - std::string keyboardResult = key; - cout << " Invoking _session->result " << endl; - _session->result(keyboardResult); - } else { - Firebolt::Keyboard::KeyboardError keyboardError; - keyboardError.code = 123; - keyboardError.message = key; - keyboardError.data = "nothing to send"; - cout << " Invoking _session->error " << endl; - _session->error(keyboardError); - } - _keyInput = false; - cin.putback('\n'); - } else { - cout << " there is no active keyboard input session " << endl; - } -} - -void ManageSDKTest::KeyboardProvider::standard(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - cout << "KeyboardProvider Standard is invoked" << endl; - startKeyboardSession(parameters, std::move(session)); -} - -void ManageSDKTest::KeyboardProvider::password(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - cout << "KeyboardProvider Password is invoked" << endl; - startKeyboardSession(parameters, std::move(session)); -} - -void ManageSDKTest::KeyboardProvider::email(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - cout << "KeyboardProvider Email is invoked" << endl; - startKeyboardSession(parameters, std::move(session)); -} - -void ManageSDKTest::KeyboardProvider::startKeyboardSession(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _keyInput = true; -} - -void ManageSDKTest::RegisterKeyboardProvider() -{ - Firebolt::IFireboltAccessor::Instance().KeyboardInterface().provide(_keyboardProvider); -} - -void ManageSDKTest::SendResponseMessageToKeyboardProvider() -{ - _keyboardProvider.SendMessage(true); -} - -void ManageSDKTest::SendErrorMessageToKeyboardProvider() -{ - _keyboardProvider.SendMessage(false); -} - -ManageSDKTest::AcknowledgeChallengeProvider::AcknowledgeChallengeProvider() - : _session(nullptr) - , _parameters() - , _challengeInput(false) -{ -} - -void ManageSDKTest::AcknowledgeChallengeProvider::SendMessage(bool response) -{ - if (_challengeInput) { - cout << " Invoking _session->focus " << endl; - _session->focus(); - cout << " capability : " << _parameters.capability << endl; - cout << " id : " << _parameters.requestor.id << endl; - cout << " name : " << _parameters.requestor.name << endl; - if (response) { - Firebolt::AcknowledgeChallenge::GrantResult challengeResult; - challengeResult.granted = true; - cout << " Invoking _session->result " << endl; - _session->result(challengeResult); - } else { - string key; - getline(cin, key); - - Firebolt::AcknowledgeChallenge::AcknowledgeChallengeError challengeError; - challengeError.code = 234; - challengeError.message = key; - cout << " Invoking _session->error " << endl; - _session->error(challengeError); - cin.putback('\n'); - } - _challengeInput = false; - } else { - cout << " there is no active acknowledge challenge input session " << endl; - } -} - -void ManageSDKTest::AcknowledgeChallengeProvider::challenge(const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session) -{ - cout << "AcknowledgeChallengeProvider challenge is invoked" << endl; - startAcknowledgeChallengeSession(parameters, std::move(session)); -} - -void ManageSDKTest::AcknowledgeChallengeProvider::startAcknowledgeChallengeSession(const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _challengeInput = true; -} - -void ManageSDKTest::RegisterAcknowledgeChallengeProvider() -{ - Firebolt::IFireboltAccessor::Instance().AcknowledgeChallengeInterface().provide(_acknowledgeChallengeProvider); -} - -void ManageSDKTest::SendResponseMessageToAcknowledgeChallengeProvider() -{ - _acknowledgeChallengeProvider.SendMessage(true); -} - -void ManageSDKTest::SendErrorMessageToAcknowledgeChallengeProvider() -{ - _acknowledgeChallengeProvider.SendMessage(false); -} - -ManageSDKTest::PinChallengeProvider::PinChallengeProvider() - : _session(nullptr) - , _parameters() - , _challengeInput(false) -{ -} - -void ManageSDKTest::PinChallengeProvider::SendMessage(bool response) -{ - if (_challengeInput) { - cout << " Invoking _session->focus " << endl; - _session->focus(); - cout << " pinSpace : " << static_cast(_parameters.pinSpace) << endl; - if (_parameters.capability.has_value()) { - cout << " capability : " << _parameters.capability.value() << endl; - } - cout << " id : " << _parameters.requestor.id << endl; - cout << " name : " << _parameters.requestor.name << endl; - - if (response) { - Firebolt::PinChallenge::PinChallengeResult challengeResult; - challengeResult.granted = true; - challengeResult.reason = Firebolt::PinChallenge::ResultReason::CORRECT_PIN; - cout << " Invoking _session->result " << endl; - _session->result(challengeResult); - } else { - string key; - getline(cin, key); - - Firebolt::PinChallenge::PinChallengeError challengeError; - challengeError.code = 234; - challengeError.message = key; - cout << " Invoking _session->error " << endl; - _session->error(challengeError); - cin.putback('\n'); - } - _challengeInput = false; - } else { - cout << " there is no active pin challenge input session " << endl; - } -} - -void ManageSDKTest::PinChallengeProvider::challenge(const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session) -{ - cout << "PinChallengeProvider challenge is invoked" << endl; - startPinChallengeSession(parameters, std::move(session)); -} - -void ManageSDKTest::PinChallengeProvider::startPinChallengeSession(const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _challengeInput = true; -} - -void ManageSDKTest::RegisterPinChallengeProvider() -{ - Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().provide(_pinChallengeProvider); -} - -void ManageSDKTest::SendResponseMessageToPinChallengeProvider() -{ - _pinChallengeProvider.SendMessage(true); -} - -void ManageSDKTest::SendErrorMessageToPinChallengeProvider() -{ - _pinChallengeProvider.SendMessage(false); -} - -void ManageSDKTest::GetLocalizationAdditionalInfo() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::Localization::Info info = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().additionalInfo(&error); - if (error == Firebolt::Error::None) { - cout << "AdditionalInfo is success, Info : " << endl; - for (auto element : info) { - cout << " " << element.first << " : " << element.second << endl; - } - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetLocalizationAdditionalInfo failed. " + errorMessage); - } -} - -void ManageSDKTest::AddLocalizationAdditionalInfo() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string key = "testKey"; - float value = 1.0f; - - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().addAdditionalInfo(key, value, &error); - if (error == Firebolt::Error::None) { - cout << "Add AdditionalInfo is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("AddLocalizationAdditionalInfo failed. " + errorMessage); - } -} - -void ManageSDKTest::RemoveLocalizationAdditionalInfo() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string key = "testKey"; - - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().removeAdditionalInfo(key, &error); - if (error == Firebolt::Error::None) { - cout << "Remove AdditionalInfo is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("RemoveLocalizationAdditionalInfo failed. " + errorMessage); - } -} - -void ManageSDKTest::GetUserGrantsPermission() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string appId = "certApp"; - - std::vector grantInfo = Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().app(appId, &error); - if (error == Firebolt::Error::None) { - cout << "Get UserGrants Permission is success" << endl; - if (grantInfo.size() > 0) { - cout << "Grant Permission list : " << endl; - for (auto info : grantInfo) { - cout << "GrantState : " << static_cast(info.state) << endl; - cout << "Capability : " << info.capability << endl; - cout << "Role : " << static_cast(info.role) << endl; - cout << "Lifespan : " << static_cast(info.lifespan) << endl; - } - } - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetUserGrantsPermission failed. " + errorMessage); - } -} - -void ManageSDKTest::GrantUserGrantsPermission() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::UserGrants::GrantModificationOptions grantModificationOptions; - std::string appId = "certApp"; - grantModificationOptions.appId = std::make_optional(appId); - - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().grant(Firebolt::Capabilities::Role::USE, "xrn:firebolt:capability:device:model", grantModificationOptions, &error); - if (error == Firebolt::Error::None) { - cout << "Grant UserGrants Permission is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GrantUserGrantsPermission failed. " + errorMessage); - } -} - -void ManageSDKTest::DenyUserGrantsPermission() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::UserGrants::GrantModificationOptions grantModificationOptions; - std::string appId = "certApp"; - grantModificationOptions.appId = std::make_optional(appId); - - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().deny(Firebolt::Capabilities::Role::USE, "xrn:firebolt:capability:device:model", grantModificationOptions, &error); - if (error == Firebolt::Error::None) { - cout << "Deny UserGrants Permission is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("DenyUserGrantsPermission failed. " + errorMessage); - } -} - -void ManageSDKTest::ClearUserGrantsPermission() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::UserGrants::GrantModificationOptions grantModificationOptions; - std::string appId = "certApp"; - grantModificationOptions.appId = std::make_optional(appId); - - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().clear(Firebolt::Capabilities::Role::USE, "xrn:firebolt:capability:device:model", grantModificationOptions, &error); - if (error == Firebolt::Error::None) { - cout << "Clear UserGrants Permission is success" << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("ClearUserGrantsPermission failed. " + errorMessage); - } -} - -void PrintAP(const Firebolt::Wifi::AccessPoint ap) -{ - if (ap.ssid.has_value()) { - cout << " SSID : " << ap.ssid.value() << endl; - } - if (ap.securityMode.has_value()) { - cout << " SecurityMode : " << static_cast(ap.securityMode.value()) << endl; - } - if (ap.signalStrength.has_value()) { - cout << " SignalStrength : " << ap.signalStrength.value() << endl; - } - if (ap.frequency.has_value()) { - cout << " Frequency : " << ap.frequency.value() << endl; - } -} - -void PrintAPList(const Firebolt::Wifi::AccessPointList& apList) -{ - if (apList.list.has_value()) { - cout<< "list ---->" << endl; - uint32_t index = 0; - for (const auto ap : apList.list.value()) { - cout << index << ". " << endl; - PrintAP(ap); - cout << endl; - index++; - } - } else { - cout << "empty list " << endl; - } -} - -void ManageSDKTest::WifiScan() -{ - Firebolt::Error error = Firebolt::Error::None; - int32_t timeout = 1; - _apList = Firebolt::IFireboltAccessor::Instance().WifiInterface().scan(timeout, &error); - if (error == Firebolt::Error::None) { - cout << "Wifi Scan is success, "; - PrintAPList(_apList); - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("WifiScan failed. " + errorMessage); - } -} - -void ManageSDKTest::WifiConnect() -{ - Firebolt::Error error = Firebolt::Error::None; - if (_apList.list.has_value()) { - cout << "Scanned access pointlist : " << endl; - PrintAPList(_apList); - cout << "Select access point from the list: enter index : "; - int32_t index; - cin >> index; - Firebolt::Wifi::AccessPoint ap = _apList.list.value()[index]; - std::string passphrase; - cout << "Enter passphrase to connect "; - cin >> passphrase; - - string ssid = ap.ssid.has_value() ? ap.ssid.value() : ""; - printf("%s:%s:%d _apList.list.value()[index] = %s\n", __FILE__, __func__, __LINE__, ssid.c_str()); - Firebolt::Wifi::WifiSecurityMode securityMode = ap.securityMode.has_value() ? ap.securityMode.value() : Firebolt::Wifi::WifiSecurityMode::NONE; - Firebolt::Wifi::AccessPoint connectedAP = Firebolt::IFireboltAccessor::Instance().WifiInterface().connect(ssid, passphrase, securityMode , &error); - if (error == Firebolt::Error::None) { - cout << "Wifi Connect is success, "; - PrintAP(connectedAP); - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("WifiConnect failed. " + errorMessage); - } - } else { - cout << "Empty AP list, please initiate scan before trying connect " << endl; - } -} - -void ManageSDKTest::WifiDisconnect() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().WifiInterface().disconnect(&error); - if (error == Firebolt::Error::None) { - cout << "Wifi Disconnect is success, "; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("WifiDisconnect failed. " + errorMessage); - } -} - -void ManageSDKTest::OnAutoLowLatencyModeCapableChangedNotification::onAutoLowLatencyModeCapableChanged( const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo& info) -{ - cout << "Low latency capable changed" << endl; -} - -void ManageSDKTest::GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().globalSubscribe(_autoLowLatencyModeCapableChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Global Subscribe for HDMIInput AutoLowLatencyModeCapable is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SubscribeHDMIInputAutoLowLatencyModeCapable failed." + errorMessage); - } -} - -void ManageSDKTest::GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().globalUnsubscribe(_autoLowLatencyModeCapableChangedNotification, &error); - if (error == Firebolt::Error::None) { - cout << "Global Unsubscribe for HDMIInput AutoLowLatencyModeCapable is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("UnsubscribeHDMIInputAutoLowLatencyModeCapable failed." + errorMessage); - } -} - -void ManageSDKTest::GetAutoLowLatencyModeCapable() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string port = "HDMI1"; - bool result = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().autoLowLatencyModeCapable(port, &error); - - if (error == Firebolt::Error::None) { - cout << "GetAutoLowLatencyModeCapable is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetAutoLowLatencyModeCapable failed. " + errorMessage); - } -} - -void ManageSDKTest::SetAutoLowLatencyModeCapable() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string port = "HDMI1"; - bool value = false; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setAutoLowLatencyModeCapable(port, value, &error); - - if (error == Firebolt::Error::None) { - cout << "SetAutoLowLatencyModeCapable is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetAutoLowLatencyModeCapable failed. " + errorMessage); - } -} - -void ManageSDKTest::GetEdidVersion() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string port = "HDMI1"; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().edidVersion(port, &error); - - if (error == Firebolt::Error::None) { - cout << "GetEdidVersion is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetEdidVersion failed. " + errorMessage); - } -} - -void ManageSDKTest::SetEdidVersion() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string port = "HDMI1"; - Firebolt::HDMIInput::EDIDVersion value = Firebolt::HDMIInput::EDIDVersion::V1_4; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setEdidVersion(port, value, &error); - - if (error == Firebolt::Error::None) { - cout << "SetEdidVersion is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("SetEdidVersionfailed. " + errorMessage); - } -} - -void ManageSDKTest::GetHdmiPortInfo() -{ - Firebolt::Error error = Firebolt::Error::None; - std::string portId = "HDMI1"; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().port(portId, &error); - - if (error == Firebolt::Error::None) { - cout << "GetHdmiPortInfo is a success." << endl; - } else { - std::string errorMessage = "Error: " + std::to_string(static_cast(error)); - throw std::runtime_error("GetHdmiPortInfo failed. " + errorMessage); - } -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h deleted file mode 100644 index 018350ec2..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include "firebolt.h" - -class ManageSDKTest { - class OnAudioDescriptionsEnabledChangedNotification : public Firebolt::AudioDescriptions::IAudioDescriptions::IOnEnabledChangedNotification { - public: - void onEnabledChanged( const bool ) override; - }; - - class OnDeviceNameChangedNotification : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification { - public: - void onDeviceNameChanged( const std::string& ) override; - }; - - class OnFontFamilyChangedNotification : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontFamilyChangedNotification { - void onFontFamilyChanged( const Firebolt::Accessibility::FontFamily& ) override; - }; - - class OnBackgroundOpacityChangedNotification : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundOpacityChangedNotification { - void onBackgroundOpacityChanged( const float ) override; - }; - - class OnPreferredAudioLanguagesChangedNotification : public Firebolt::Localization::ILocalization::IOnPreferredAudioLanguagesChangedNotification { - public: - void onPreferredAudioLanguagesChanged( const std::vector& ) override; - }; - - class OnAllowACRCollectionChangedNotification : public Firebolt::Privacy::IPrivacy::IOnAllowACRCollectionChangedNotification { - public: - void onAllowACRCollectionChanged( const bool ) override; - }; - - class OnSignInNotification : public Firebolt::Discovery::IDiscovery::IOnSignInNotification { - public: - void onSignIn( const Firebolt::Discovery::Event& ) override; - }; - - class OnSignOutNotification : public Firebolt::Discovery::IDiscovery::IOnSignOutNotification { - public: - void onSignOut( const Firebolt::Discovery::Event& ) override; - }; - - class KeyboardProvider : public Firebolt::Keyboard::IKeyboardProvider { - public: - KeyboardProvider(); - ~KeyboardProvider() override = default; - void standard( const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session ) override; - void password( const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session ) override; - void email( const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session ) override; - void SendMessage(bool response); - - private: - void startKeyboardSession(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session); - - private: - std::unique_ptr _session; - Firebolt::Keyboard::KeyboardParameters _parameters; - bool _keyInput; - }; - class AcknowledgeChallengeProvider : public Firebolt::AcknowledgeChallenge::IAcknowledgeChallengeProvider { - public: - AcknowledgeChallengeProvider(); - ~AcknowledgeChallengeProvider() override = default; - void challenge( const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session ) override; - void SendMessage(bool response); - - private: - void startAcknowledgeChallengeSession(const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session); - - private: - std::unique_ptr _session; - Firebolt::AcknowledgeChallenge::Challenge _parameters; - bool _challengeInput; - }; - class PinChallengeProvider : public Firebolt::PinChallenge::IPinChallengeProvider { - public: - PinChallengeProvider(); - ~PinChallengeProvider() override = default; - void challenge( const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session ) override; - void SendMessage(bool response); - - private: - void startPinChallengeSession(const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session); - - private: - std::unique_ptr _session; - Firebolt::PinChallenge::PinChallenge _parameters; - bool _challengeInput; - }; - - class OnAutoLowLatencyModeCapableChangedNotification : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeCapableChangedNotification { - public: - void onAutoLowLatencyModeCapableChanged( const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo& ) override; - }; - -public: - ManageSDKTest() = default; - virtual ~ManageSDKTest() = default; - - static void CreateFireboltInstance(const std::string& url); - static void DestroyFireboltInstance(); - static void TestManageStaticSDK(); - - static void GetAdvertisingSkipRestriction(); - static void SetAdvertisingSkipRestriction(); - static void ResetAdvertisingIdentifier(); - - static void SetAccountSession(); - - static void GetAudioDescriptionsEnabled(); - static void SetAudioDescriptionsEnabled(); - static void SubscribeAudioDescriptionsEnabledChanged(); - static void UnsubscribeAudioDescriptionsEnabledChanged(); - - static void GetDeviceName(); - static void SetDeviceName(); - static void SubscribeDeviceNameChanged(); - static void UnsubscribeDeviceNameChanged(); - - static void GetClosedCaptionsBackgroundOpacity(); - static void SetClosedCaptionsBackgroundOpacity(); - static void SubscribeClosedCaptionsBackgroundOpacityChanged(); - static void UnsubscribeClosedCaptionsBackgroundOpacityChanged(); - - static void GetClosedCaptionsFontFamily(); - static void SetClosedCaptionsFontFamily(); - static void SubscribeClosedCaptionsFontFamilyChanged(); - static void UnsubscribeClosedCaptionsFontFamilyChanged(); - - static void GetLocalizationPreferredAudioLanguages(); - static void SetLocalizationPreferredAudioLanguages(); - static void SubscribeLocalizationPreferredAudioLanguagesChanged(); - static void UnsubscribeLocalizationPreferredAudioLanguagesChanged(); - - static void GetPrivacyAllowACRCollection(); - static void SetPrivacyAllowACRCollection(); - static void SubscribePrivacyAllowACRCollectionChanged(); - static void UnsubscribePrivacyAllowACRCollectionChanged(); - static void GetPrivacySettings(); - - static void SubscribeDiscoverySignInNotification(); - static void UnsubscribeDiscoverySignInNotification(); - static void SubscribeDiscoverySignOutNotification(); - static void UnsubscribeDiscoverySignOutNotification(); - - static void RegisterKeyboardProvider(); - static void SendResponseMessageToKeyboardProvider(); - static void SendErrorMessageToKeyboardProvider(); - - static void RegisterAcknowledgeChallengeProvider(); - static void SendResponseMessageToAcknowledgeChallengeProvider(); - static void SendErrorMessageToAcknowledgeChallengeProvider(); - - static void RegisterPinChallengeProvider(); - static void SendResponseMessageToPinChallengeProvider(); - static void SendErrorMessageToPinChallengeProvider(); - - static void GetLocalizationAdditionalInfo(); - static void AddLocalizationAdditionalInfo(); - static void RemoveLocalizationAdditionalInfo(); - - static void GetUserGrantsPermission(); - static void GrantUserGrantsPermission(); - static void DenyUserGrantsPermission(); - static void ClearUserGrantsPermission(); - - static void WifiScan(); - static void WifiConnect(); - static void WifiDisconnect(); - - static void GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged(); - static void GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged(); - - static void GetAutoLowLatencyModeCapable(); - static void SetAutoLowLatencyModeCapable(); - static void GetEdidVersion(); - static void SetEdidVersion(); - static void GetHdmiPortInfo(); - - static bool WaitOnConnectionReady(); - -private: - static void ConnectionChanged(const bool, const Firebolt::Error); - static bool _connected; - static OnAudioDescriptionsEnabledChangedNotification _audioDescriptionEnabledChangedNotification; - static OnDeviceNameChangedNotification _deviceNameChangedNotification; - static OnFontFamilyChangedNotification _fontFamilyChangedNotification; - static OnBackgroundOpacityChangedNotification _backgroundOpacityChangedNotification; - static OnPreferredAudioLanguagesChangedNotification _preferredAudioLanguagesChangedNotification; - static OnAllowACRCollectionChangedNotification _allowACRCollectionChangedNotification; - static KeyboardProvider _keyboardProvider; - static AcknowledgeChallengeProvider _acknowledgeChallengeProvider; - static PinChallengeProvider _pinChallengeProvider; - static OnSignInNotification _signInNotification; - static OnSignOutNotification _signOutNotification; - static OnAutoLowLatencyModeCapableChangedNotification _autoLowLatencyModeCapableChangedNotification; - - static Firebolt::Wifi::AccessPointList _apList; -}; - diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp deleted file mode 100644 index c3485c0f6..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/Unit.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "gtest/gtest.h" -#include "ManageSDKTest.h" - -int main(int argc, char **argv) -{ - std::string url = "ws://localhost:9998"; - ManageSDKTest::CreateFireboltInstance(url); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/build.sh b/src/sdks/manage/src/cpp/sdk/cpptest/build.sh deleted file mode 100755 index 4db39cbe8..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/build.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -usage() -{ - echo "options:" - echo " -t test path" - echo " -s sysroot path" - echo " -f firebolt path" - echo " -c clear build" - echo " -h : help" - echo - echo "usage: " - echo " ./build.sh -t testpath -c -f fireboltpath -s sysrootpath" -} - -TestPath="." -FireboltPath=${FIREBOLT_PATH} -SysrootPath=${SYSROOT_PATH} -ClearBuild="N" -while getopts t:s:f:ch flag -do - case "${flag}" in - t) TestPath="${OPTARG}";; - s) SysrootPath="${OPTARG}";; - f) FireboltPath="${OPTARG}";; - c) ClearBuild="Y";; - h) usage && exit 1;; - esac -done - -if [ "${ClearBuild}" == "Y" ]; -then - rm -rf ${TestPath}/build -fi - -echo "TestPath" -echo "${TestPath}" -echo "FireboltPath" -echo ${FireboltPath} -cmake -B${TestPath}/build -S${TestPath} -DSYSROOT_PATH=${SysrootPath} -DFIREBOLT_PATH=${FireboltPath} -cmake --build ${TestPath}/build diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/accountTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/accountTest.cpp deleted file mode 100644 index d92e1aa29..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/accountTest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "unit.h" - -class AccountTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(AccountTest, session) -{ - std::string token = "expiresIn"; - int32_t expiresIn = 84000; - Firebolt::IFireboltAccessor::Instance().AccountInterface().session(token, expiresIn, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AccountInterface.session() method"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/acknowledgeChallengeTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/acknowledgeChallengeTest.cpp deleted file mode 100644 index db36c5971..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/acknowledgeChallengeTest.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "unit.h" - -using namespace Firebolt::AcknowledgeChallenge; - -struct AcknowledgeChallengeProvider : public IAcknowledgeChallengeProvider -{ - AcknowledgeChallengeProvider(); - ~AcknowledgeChallengeProvider() override = default; - void SendMessage(bool response); - void challenge(const Challenge ¶meters, std::unique_ptr session) override; - -private: - void startAcknowledgeChallengeSession(const Challenge ¶meters, std::unique_ptr session); - -private: - std::unique_ptr _session; - Challenge _parameters; - bool _challengeInput; -}; - -class AcknowledgeChallengeTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - AcknowledgeChallengeProvider _acknowledgeChallengeProvider; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -AcknowledgeChallengeProvider::AcknowledgeChallengeProvider() - : _session(nullptr), _parameters(), _challengeInput(false) -{ -} - -void AcknowledgeChallengeProvider::SendMessage(bool response) -{ -} - -void AcknowledgeChallengeProvider::startAcknowledgeChallengeSession(const Firebolt::AcknowledgeChallenge::Challenge ¶meters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _challengeInput = true; -} - -void AcknowledgeChallengeProvider::challenge(const Challenge ¶meters, std::unique_ptr session) -{ - std::cout << "AcknowledgeChallengeProvider challenge is invoked" << std::endl; - startAcknowledgeChallengeSession(parameters, std::move(session)); -} - -TEST_F(AcknowledgeChallengeTest, registerAcknowledgeChallengeProvider) -{ - Firebolt::IFireboltAccessor::Instance().AcknowledgeChallengeInterface().provide(_acknowledgeChallengeProvider); -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp deleted file mode 100644 index e49abc504..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/advertisingTest.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "unit.h" - -class AdvertisingTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(AdvertisingTest, resetIdentifier) -{ - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().resetIdentifier(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AdvertisingInterface.resetIdentifier() method"; -} - -TEST_F(AdvertisingTest, skipRestriction) -{ - std::string expectedValues = jsonEngine->get_value("Advertising.skipRestriction"); - Firebolt::Advertising::SkipRestriction restriction = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().skipRestriction(&error); - - std::string actual_skip_restriction; - switch (restriction) - { - case Firebolt::Advertising::SkipRestriction::NONE: - actual_skip_restriction = "none"; - break; - case Firebolt::Advertising::SkipRestriction::ADS_UNWATCHED: - actual_skip_restriction = "ads_unwatched"; - break; - case Firebolt::Advertising::SkipRestriction::ADS_ALL: - actual_skip_restriction = "ads_all"; - break; - case Firebolt::Advertising::SkipRestriction::ALL: - actual_skip_restriction = "all"; - break; - default: - actual_skip_restriction = "unknown"; - } - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AdvertisingInterface.skipRestriction() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_skip_restriction) << "Error: wrong skipRestriction returned by AdvertisingInterface.skipRestriction()"; -} - -TEST_F(AdvertisingTest, setSkipRestriction) -{ - Firebolt::Advertising::SkipRestriction expected_value = Firebolt::Advertising::SkipRestriction::ADS_ALL; // Replace with the appropriate enum value - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().setSkipRestriction(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AdvertisingInterface.setSkipRestriction() method"; -} - -// Events Tests -struct SkipRestrictionChanged : public Firebolt::Advertising::IAdvertising::IOnSkipRestrictionChangedNotification -{ - void onSkipRestrictionChanged(const Firebolt::Advertising::SkipRestriction &) override; -}; - -Firebolt::Advertising::SkipRestriction newSkipRestriction; -void SkipRestrictionChanged::onSkipRestrictionChanged(const Firebolt::Advertising::SkipRestriction &skipRestriction) -{ - std::cout << "onSkipRestrictionChanged event fired"; -} - -TEST_F(AdvertisingTest, subscribeOnSkipRestrictionChanged) -{ - SkipRestrictionChanged skipRestrictionChanged; - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().subscribe(skipRestrictionChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SkipRestrictionChanged"; -} - -TEST_F(AdvertisingTest, unsubscribeOnSkipRestrictionChanged) -{ - SkipRestrictionChanged skipRestrictionChanged; - Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().unsubscribe(skipRestrictionChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SkipRestrictionChanged"; -} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp deleted file mode 100644 index a3744386e..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/audioDescriptionsTest.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "unit.h" - -class AudioDescriptionsTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(AudioDescriptionsTest, enabled) -{ - auto expectedValues = jsonEngine->get_value("AudioDescriptions.enabled"); - bool enable = Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().enabled(&error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AudioDescriptions.enabled() method"; - EXPECT_EQ(expectedValues == "true", enable) << "Error: AudioDescriptions.enabled() dose not returns enabled"; -} - -TEST_F(AudioDescriptionsTest, setEnabled) -{ - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().setEnabled(true, &error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling AudioDescriptions.setEnabled() method"; -} - -struct EnabledChanged : public Firebolt::AudioDescriptions::IAudioDescriptions::IOnEnabledChangedNotification -{ - void onEnabledChanged(const bool) override; -}; - -void EnabledChanged::onEnabledChanged(const bool) -{ - std::cout << "onAudioDescriptionEnabledChanged event fired"; -} - -TEST_F(AudioDescriptionsTest, subscribeonEnabledChanged) -{ - EnabledChanged enabledChanged; - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().subscribe(enabledChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledChanged"; -} - -TEST_F(AudioDescriptionsTest, unsubscribeonEnabledChanged) -{ - EnabledChanged enabledChanged; - Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().unsubscribe(enabledChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledChanged"; -} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp deleted file mode 100644 index 20a8dbcef..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/closedCaptionsTest.cpp +++ /dev/null @@ -1,626 +0,0 @@ -#include "unit.h" - -class ClosedCaptionsTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(ClosedCaptionsTest, backgroundColor) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.backgroundColor"); - std::string color = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().backgroundColor(&error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.backgroundColor() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), color) << "Error: wrong color returned by ClosedCaptionsInterface.backgroundColor()"; -} - -TEST_F(ClosedCaptionsTest, setBackgroundColor) -{ - std::string expected_background_color = "#00002"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setBackgroundColor(expected_background_color, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setBackgroundColor() method"; -} - -TEST_F(ClosedCaptionsTest, backgroundOpacity) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.backgroundOpacity"); - float opacity = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().backgroundOpacity(&error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.backgroundOpacity() method"; - EXPECT_EQ(stof(expectedValues), opacity) << "Error: wrong backgroundOpacity returned by ClosedCaptionsInterface.backgroundOpacity()"; -} - -TEST_F(ClosedCaptionsTest, setBackgroundOpacity) -{ - float expected_background_opacity = 70; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setBackgroundOpacity(expected_background_opacity, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setBackgroundOpacity() method"; -} - -TEST_F(ClosedCaptionsTest, setEnabled) -{ - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setEnabled(true, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setEnabled() method"; -} - -TEST_F(ClosedCaptionsTest, setFontColor) -{ - std::string expected_font_color = "#FFFFFF"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontColor(expected_font_color, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontColor() method"; -} - -TEST_F(ClosedCaptionsTest, fontColor) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontColor"); - std::string color = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontColor(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontColor() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), color) << "Error: wrong fontColor returned by ClosedCaptionsInterface.fontColor()"; -} - -TEST_F(ClosedCaptionsTest, setFontEdge) -{ - Firebolt::Accessibility::FontEdge expected_edge = Firebolt::Accessibility::FontEdge::UNIFORM; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontEdge(expected_edge, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontEdge() method"; -} - -TEST_F(ClosedCaptionsTest, fontEdge) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontEdge"); - Firebolt::Accessibility::FontEdge edge = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontEdge(&error); - - std::string actual_font_edge = "unknown"; - switch (edge) - { - case Firebolt::Accessibility::FontEdge::NONE: - actual_font_edge = "none"; - break; - case Firebolt::Accessibility::FontEdge::RAISED: - actual_font_edge = "raised"; - break; - case Firebolt::Accessibility::FontEdge::DEPRESSED: - actual_font_edge = "depressed"; - break; - case Firebolt::Accessibility::FontEdge::UNIFORM: - actual_font_edge = "uniform"; - break; - case Firebolt::Accessibility::FontEdge::DROP_SHADOW_LEFT: - actual_font_edge = "drop_shadow_left"; - break; - case Firebolt::Accessibility::FontEdge::DROP_SHADOW_RIGHT: - actual_font_edge = "drop_shadow_right"; - break; - default: - actual_font_edge = "unknown"; - } - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontEdge() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_font_edge) << "Error: wrong fontEdge returned by ClosedCaptionsInterface.fontEdge()"; -} - -TEST_F(ClosedCaptionsTest, setFontEdgeColor) -{ - std::string expected_color = "#FF5733"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontEdgeColor(expected_color, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontEdgeColor() method"; -} - -TEST_F(ClosedCaptionsTest, fontEdgeColor) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontEdgeColor"); - std::string color = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontEdgeColor(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontEdgeColor() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), color) << "Error: wrong fontEdgeColor returned by ClosedCaptionsInterface.fontEdgeColor()"; -} - -TEST_F(ClosedCaptionsTest, setFontFamily) -{ - Firebolt::Accessibility::FontFamily expected_family = Firebolt::Accessibility::FontFamily::MONOSPACED_SANSERIF; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontFamily(expected_family, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontFamily() method"; -} - -TEST_F(ClosedCaptionsTest, fontFamily) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontFamily"); - Firebolt::Accessibility::FontFamily family = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontFamily(&error); - std::string actual_family = "unknown"; - switch (family) - { - case Firebolt::Accessibility::FontFamily::MONOSPACED_SERIF: - actual_family = "monospaced_serif"; - break; - case Firebolt::Accessibility::FontFamily::PROPORTIONAL_SERIF: - actual_family = "proportional_serif"; - break; - case Firebolt::Accessibility::FontFamily::MONOSPACED_SANSERIF: - actual_family = "monospaced_sanserif"; - break; - case Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF: - actual_family = "proportional_sanserif"; - break; - case Firebolt::Accessibility::FontFamily::SMALLCAPS: - actual_family = "smallcaps"; - break; - case Firebolt::Accessibility::FontFamily::CURSIVE: - actual_family = "cursive"; - break; - case Firebolt::Accessibility::FontFamily::CASUAL: - actual_family = "casual"; - break; - default: - actual_family = "unknown"; - } - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontFamily() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_family) << "Error: wrong fontFamily returned by ClosedCaptionsInterface.fontFamily()"; -} - -TEST_F(ClosedCaptionsTest, setFontOpacity) -{ - float expected_opacity = 0.75f; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontOpacity(expected_opacity, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontOpacity() method"; -} - -TEST_F(ClosedCaptionsTest, fontOpacity) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontOpacity"); - float opacity = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontOpacity(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontOpacity() method"; - EXPECT_EQ(stof(expectedValues), opacity) << "Error: wrong fontOpacity returned by ClosedCaptionsInterface.fontOpacity()"; -} - -TEST_F(ClosedCaptionsTest, setFontSize) -{ - float expected_size = 12.5f; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontSize(expected_size, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setFontSize() method"; -} - -TEST_F(ClosedCaptionsTest, fontSize) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.fontSize"); - float size = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontSize(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.fontSize() method"; - EXPECT_EQ(stof(expectedValues), size) << "Error: wrong fontSize returned by ClosedCaptionsInterface.fontSize()"; -} - -TEST_F(ClosedCaptionsTest, setPreferredLanguages) -{ - std::vector expected_languages = {"spa", "eng"}; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setPreferredLanguages(expected_languages, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setPreferredLanguages() method"; -} - -TEST_F(ClosedCaptionsTest, preferredLanguages) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.preferredLanguages"); - std::vector languages = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().preferredLanguages(&error); - - // Convert vector to a string for comparison - std::string actual_languages; - for (const auto &lang : languages) - { - actual_languages += "\"" + lang + "\","; - } - actual_languages = actual_languages.substr(0, actual_languages.size() - 1); // Remove trailing comma - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.preferredLanguages() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_languages) << "Error: wrong preferredLanguages returned by ClosedCaptionsInterface.preferredLanguages()"; -} - -TEST_F(ClosedCaptionsTest, setTextAlign) -{ - std::string expected_alignment = "center"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setTextAlign(expected_alignment, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setTextAlign() method"; -} - -TEST_F(ClosedCaptionsTest, textAlign) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.textAlign"); - std::string alignment = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().textAlign(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.textAlign() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), alignment) << "Error: wrong textAlign returned by ClosedCaptionsInterface.textAlign()"; -} - -TEST_F(ClosedCaptionsTest, setTextAlignVertical) -{ - std::string expected_alignment = "middle"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setTextAlignVertical(expected_alignment, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setTextAlignVertical() method"; -} - -TEST_F(ClosedCaptionsTest, textAlignVertical) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.textAlignVertical"); - std::string alignment = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().textAlignVertical(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.textAlignVertical() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), alignment) << "Error: wrong textAlignVertical returned by ClosedCaptionsInterface.textAlignVertical()"; -} - -TEST_F(ClosedCaptionsTest, setWindowColor) -{ - std::string expected_color = "#000000"; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setWindowColor(expected_color, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setWindowColor() method"; -} - -TEST_F(ClosedCaptionsTest, windowColor) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.windowColor"); - std::string color = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().windowColor(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.windowColor() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), color) << "Error: wrong windowColor returned by ClosedCaptionsInterface.windowColor()"; -} - -TEST_F(ClosedCaptionsTest, setWindowOpacity) -{ - float expected_opacity = 0.85f; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setWindowOpacity(expected_opacity, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.setWindowOpacity() method"; -} - -TEST_F(ClosedCaptionsTest, windowOpacity) -{ - std::string expectedValues = jsonEngine->get_value("ClosedCaptions.windowOpacity"); - float opacity = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().windowOpacity(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling ClosedCaptionsInterface.windowOpacity() method"; - EXPECT_EQ(stof(expectedValues), opacity) << "Error: wrong windowOpacity returned by ClosedCaptionsInterface.windowOpacity()"; -} - -// Events related tests -struct BackgroundColorChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundColorChangedNotification -{ - void onBackgroundColorChanged(const std::string &) override; -}; - -void BackgroundColorChanged::onBackgroundColorChanged(const std::string &) -{ - std::cout << "onBackgroundColorChanged event fired"; -} - -TEST_F(ClosedCaptionsTest, subscribeOnBackgroundColorChanged) -{ - BackgroundColorChanged backgroundColorChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(backgroundColorChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to BackgroundColorChanged"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnBackgroundColorChanged) -{ - BackgroundColorChanged backgroundColorChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(backgroundColorChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to BackgroundColorChanged"; -} - -struct BackgroundOpacityChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundOpacityChangedNotification -{ - void onBackgroundOpacityChanged(const float) override; -}; - -void BackgroundOpacityChanged::onBackgroundOpacityChanged(const float) -{ - std::cout << "onBackgroundOpacityChanged event fired"; -} - -TEST_F(ClosedCaptionsTest, subscribeOnBackgroundOpacityChanged) -{ - BackgroundOpacityChanged backgroundOpacityChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(backgroundOpacityChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to BackgroundOpacityChanged"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnBackgroundOpacityChanged) -{ - BackgroundOpacityChanged backgroundOpacityChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(backgroundOpacityChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to BackgroundOpacityChanged"; -} - -struct ClosedCaptionEnabledChanged : public Firebolt::ClosedCaptions::IClosedCaptions::IOnEnabledChangedNotification -{ - void onEnabledChanged(const bool) override; -}; - -void ClosedCaptionEnabledChanged::onEnabledChanged(const bool) -{ - std::cout << "onEnabledChanged event fired"; -} - -TEST_F(ClosedCaptionsTest, subscribeOnEnabledChanged) -{ - ClosedCaptionEnabledChanged ccEnabledChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(ccEnabledChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledChanged"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnEnabledChanged) -{ - ClosedCaptionEnabledChanged ccEnabledChanged; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(ccEnabledChanged, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledChanged"; -} - -struct FontColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontColorChangedNotification -{ - void onFontColorChanged(const std::string &) override; -}; - -void FontColorSettings::onFontColorChanged(const std::string &color) -{ - std::cout << "onFontColorChanged event fired with color: " << color; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontColorChanged) -{ - FontColorSettings fontColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontColorSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontColorChanged) -{ - FontColorSettings fontColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontColorSettings"; -} - -struct FontEdgeSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontEdgeChangedNotification -{ - void onFontEdgeChanged(const Firebolt::Accessibility::FontEdge &) override; -}; - -void FontEdgeSettings::onFontEdgeChanged(const Firebolt::Accessibility::FontEdge &edge) -{ - std::cout << "onFontEdgeChanged event fired"; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontEdgeChanged) -{ - FontEdgeSettings fontEdgeSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontEdgeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontEdgeSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontEdgeChanged) -{ - FontEdgeSettings fontEdgeSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontEdgeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontEdgeSettings"; -} - -struct FontEdgeColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontEdgeColorChangedNotification -{ - void onFontEdgeColorChanged(const std::string &) override; -}; - -void FontEdgeColorSettings::onFontEdgeColorChanged(const std::string &color) -{ - std::cout << "onFontEdgeColorChanged event fired with color: " << color; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontEdgeColorChanged) -{ - FontEdgeColorSettings fontEdgeColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontEdgeColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontEdgeColorSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontEdgeColorChanged) -{ - FontEdgeColorSettings fontEdgeColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontEdgeColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontEdgeColorSettings"; -} - -struct FontFamilySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontFamilyChangedNotification -{ - void onFontFamilyChanged(const Firebolt::Accessibility::FontFamily &) override; -}; - -void FontFamilySettings::onFontFamilyChanged(const Firebolt::Accessibility::FontFamily &family) -{ - std::cout << "onFontFamilyChanged event fired"; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontFamilyChanged) -{ - FontFamilySettings fontFamilySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontFamilySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontFamilySettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontFamilyChanged) -{ - FontFamilySettings fontFamilySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontFamilySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontFamilySettings"; -} - -struct FontOpacitySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontOpacityChangedNotification -{ - void onFontOpacityChanged(const float) override; -}; - -void FontOpacitySettings::onFontOpacityChanged(const float opacity) -{ - std::cout << "onFontOpacityChanged event fired with opacity: " << opacity; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontOpacityChanged) -{ - FontOpacitySettings fontOpacitySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontOpacitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontOpacitySettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontOpacityChanged) -{ - FontOpacitySettings fontOpacitySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontOpacitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontOpacitySettings"; -} - -struct FontSizeSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontSizeChangedNotification -{ - void onFontSizeChanged(const float) override; -}; - -void FontSizeSettings::onFontSizeChanged(const float size) -{ - std::cout << "onFontSizeChanged event fired with size: " << size; -} - -TEST_F(ClosedCaptionsTest, subscribeOnFontSizeChanged) -{ - FontSizeSettings fontSizeSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(fontSizeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to FontSizeSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnFontSizeChanged) -{ - FontSizeSettings fontSizeSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(fontSizeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to FontSizeSettings"; -} - -struct PreferredLanguagesSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnPreferredLanguagesChangedNotification -{ - void onPreferredLanguagesChanged(const std::vector &) override; -}; - -void PreferredLanguagesSettings::onPreferredLanguagesChanged(const std::vector &languages) -{ - std::cout << "onPreferredLanguagesChanged event fired with languages: "; - for (const auto &lang : languages) - { - std::cout << lang << " "; - } - std::cout << std::endl; -} - -TEST_F(ClosedCaptionsTest, subscribeOnPreferredLanguagesChanged) -{ - PreferredLanguagesSettings preferredLanguagesSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(preferredLanguagesSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PreferredLanguagesSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnPreferredLanguagesChanged) -{ - PreferredLanguagesSettings preferredLanguagesSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(preferredLanguagesSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PreferredLanguagesSettings"; -} - -struct TextAlignSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnTextAlignChangedNotification -{ - void onTextAlignChanged(const std::string &) override; -}; - -void TextAlignSettings::onTextAlignChanged(const std::string &alignment) -{ - std::cout << "onTextAlignChanged event fired with alignment: " << alignment; -} - -TEST_F(ClosedCaptionsTest, subscribeOnTextAlignChanged) -{ - TextAlignSettings textAlignSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(textAlignSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TextAlignSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnTextAlignChanged) -{ - TextAlignSettings textAlignSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(textAlignSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TextAlignSettings"; -} - -struct TextAlignVerticalSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnTextAlignVerticalChangedNotification -{ - void onTextAlignVerticalChanged(const std::string &) override; -}; - -void TextAlignVerticalSettings::onTextAlignVerticalChanged(const std::string &alignment) -{ - std::cout << "onTextAlignVerticalChanged event fired with alignment: " << alignment; -} - -TEST_F(ClosedCaptionsTest, subscribeOnTextAlignVerticalChanged) -{ - TextAlignVerticalSettings textAlignVerticalSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(textAlignVerticalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TextAlignVerticalSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnTextAlignVerticalChanged) -{ - TextAlignVerticalSettings textAlignVerticalSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(textAlignVerticalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TextAlignVerticalSettings"; -} - -struct WindowColorSettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnWindowColorChangedNotification -{ - void onWindowColorChanged(const std::string &) override; -}; - -void WindowColorSettings::onWindowColorChanged(const std::string &color) -{ - std::cout << "onWindowColorChanged event fired with color: " << color; -} - -TEST_F(ClosedCaptionsTest, subscribeOnWindowColorChanged) -{ - WindowColorSettings windowColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(windowColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to WindowColorSettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnWindowColorChanged) -{ - WindowColorSettings windowColorSettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(windowColorSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to WindowColorSettings"; -} - -struct WindowOpacitySettings : public Firebolt::ClosedCaptions::IClosedCaptions::IOnWindowOpacityChangedNotification -{ - void onWindowOpacityChanged(const float) override; -}; - -void WindowOpacitySettings::onWindowOpacityChanged(const float opacity) -{ - std::cout << "onWindowOpacityChanged event fired with opacity: " << opacity; -} - -TEST_F(ClosedCaptionsTest, subscribeOnWindowOpacityChanged) -{ - WindowOpacitySettings windowOpacitySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(windowOpacitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to WindowOpacitySettings"; -} - -TEST_F(ClosedCaptionsTest, unsubscribeOnWindowOpacityChanged) -{ - WindowOpacitySettings windowOpacitySettings; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(windowOpacitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to WindowOpacitySettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp deleted file mode 100644 index 068be753b..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/deviceTest.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "unit.h" - -class DeviceTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - - -TEST_F(DeviceTest, setName) { - std::string expected_name = "MyDevice"; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().setName(expected_name, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling DeviceInterface.setName() method"; -} - -TEST_F(DeviceTest, name) { - std::string expectedValues = jsonEngine->get_value("Device.name"); - std::string name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().name(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling DeviceInterface.name() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), name) << "Error: wrong name returned by DeviceInterface.name()"; -} - -TEST_F(DeviceTest, provision) { - std::string accountId = "12345"; - std::string deviceId = "67890"; - std::optional distributorId = "distributor1"; - - Firebolt::IFireboltAccessor::Instance().DeviceInterface().provision(accountId, deviceId, distributorId, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling DeviceInterface.provision() method"; -} - - -// Events related tests -struct DeviceNameSettings : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification -{ - void onDeviceNameChanged(const std::string &) override; -}; - -void DeviceNameSettings::onDeviceNameChanged(const std::string &name) -{ - std::cout << "onDeviceNameChanged event fired"; -} - -TEST_F(DeviceTest, subscribeOnDeviceNameChanged) -{ - DeviceNameSettings deviceNameSettings; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(deviceNameSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to DeviceNameSettings"; -} - -TEST_F(DeviceTest, unsubscribeOnDeviceNameChanged) -{ - DeviceNameSettings deviceNameSettings; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(deviceNameSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to DeviceNameSettings"; -} - -struct NameSettings : public Firebolt::Device::IDevice::IOnNameChangedNotification -{ - void onNameChanged(const std::string &) override; -}; - -void NameSettings::onNameChanged(const std::string &name) -{ - std::cout << "onNameChanged event fired"; -} - -TEST_F(DeviceTest, subscribeOnNameChanged) -{ - NameSettings nameSettings; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(nameSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to NameSettings"; -} - -TEST_F(DeviceTest, unsubscribeOnNameChanged) -{ - NameSettings nameSettings; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(nameSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to NameSettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp deleted file mode 100644 index b466bd48b..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/discoveryTest.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "unit.h" - -class DiscoveryTest : public ::testing::Test -{ -protected: - Firebolt::Error error = Firebolt::Error::None; -}; - -struct SignInSettings : public Firebolt::Discovery::IDiscovery::IOnSignInNotification -{ - void onSignIn(const Firebolt::Discovery::Event &) override; -}; - -void SignInSettings::onSignIn(const Firebolt::Discovery::Event &event) -{ - std::cout << "onSignIn event fired"; -} - -TEST_F(DiscoveryTest, subscribeOnSignIn) -{ - SignInSettings signInSettings; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(signInSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignInSettings"; -} - -TEST_F(DiscoveryTest, unsubscribeOnSignIn) -{ - SignInSettings signInSettings; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(signInSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignInSettings"; -} - -struct SignOutSettings : public Firebolt::Discovery::IDiscovery::IOnSignOutNotification -{ - void onSignOut(const Firebolt::Discovery::Event &) override; -}; - -void SignOutSettings::onSignOut(const Firebolt::Discovery::Event &event) -{ - std::cout << "onSignOut event fired"; -} - -TEST_F(DiscoveryTest, subscribeOnSignOut) -{ - SignOutSettings signOutSettings; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(signOutSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignOutSettings"; -} - -TEST_F(DiscoveryTest, unsubscribeOnSignOut) -{ - SignOutSettings signOutSettings; - Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(signOutSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignOutSettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp deleted file mode 100644 index 9869c5ad0..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/hdmiInputTest.cpp +++ /dev/null @@ -1,351 +0,0 @@ -#include "unit.h" - -class HDMIInputTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(HDMIInputTest, setAutoLowLatencyModeCapable) -{ - std::string port = "HDMI1"; - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setAutoLowLatencyModeCapable(port, expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.setAutoLowLatencyModeCapable() method"; -} - -TEST_F(HDMIInputTest, autoLowLatencyModeCapable) -{ - std::string port = "HDMI1"; - std::string expectedValues = jsonEngine->get_value("HDMIInput.autoLowLatencyModeCapable"); - bool enabled = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().autoLowLatencyModeCapable(port, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.autoLowLatencyModeCapable() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues) == "true", enabled) << "Error: wrong autoLowLatencyModeCapable returned by HDMIInputInterface.autoLowLatencyModeCapable()"; -} - -TEST_F(HDMIInputTest, close) -{ - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().close(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.close() method"; -} - -TEST_F(HDMIInputTest, edidVersion) -{ - std::string port = "HDMI1"; - std::string expectedValues = jsonEngine->get_value("HDMIInput.edidVersion"); - Firebolt::HDMIInput::EDIDVersion edidVersion = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().edidVersion(port, &error); - - std::string actual_version; - switch (edidVersion) - { - case Firebolt::HDMIInput::EDIDVersion::V1_4: - actual_version = "1.4"; - break; - case Firebolt::HDMIInput::EDIDVersion::V2_0: - actual_version = "2.0"; - break; - case Firebolt::HDMIInput::EDIDVersion::UNKNOWN: - actual_version = "unknown"; - break; - default: - actual_version = "invalid_version"; - } - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.edidVersion() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_version) << "Error: wrong edidVersion returned by HDMIInputInterface.edidVersion()"; -} - -TEST_F(HDMIInputTest, setEdidVersion) -{ - std::string port = "HDMI1"; - Firebolt::HDMIInput::EDIDVersion expected_version = Firebolt::HDMIInput::EDIDVersion::V1_4; // Replace with appropriate enum value - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setEdidVersion(port, expected_version, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.setEdidVersion() method"; -} - -TEST_F(HDMIInputTest, lowLatencyMode) -{ - std::string expectedValues = jsonEngine->get_value("HDMIInput.lowLatencyMode"); - bool enabled = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().lowLatencyMode(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.lowLatencyMode() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues) == "true", enabled) << "Error: wrong lowLatencyMode returned by HDMIInputInterface.lowLatencyMode()"; -} - -TEST_F(HDMIInputTest, setLowLatencyMode) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setLowLatencyMode(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.setLowLatencyMode() method"; -} - -TEST_F(HDMIInputTest, open) -{ - std::string portId = "HDMI1"; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().open(portId, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.open() method"; -} - -TEST_F(HDMIInputTest, port) -{ - std::string portId = "HDMI1"; - std::string expectedValues = jsonEngine->get_value("HDMIInput.port"); - Firebolt::HDMIInput::HDMIInputPort port = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().port(portId, &error); - - std::string actual_settings; - actual_settings += "\"arcCapable\":" + std::string(port.arcCapable ? "true" : "false") + ","; - actual_settings += "\"arcConnected\":" + std::string(port.arcConnected ? "true" : "false") + ","; - actual_settings += "\"autoLowLatencyModeCapable\":" + std::string(port.autoLowLatencyModeCapable ? "true" : "false") + ","; - actual_settings += "\"autoLowLatencyModeSignalled\":" + std::string(port.autoLowLatencyModeSignalled ? "true" : "false") + ","; - actual_settings += "\"connected\":" + std::string(port.connected ? "true" : "false") + ","; - - switch (port.edidVersion) - { - case Firebolt::HDMIInput::EDIDVersion::V1_4: - actual_settings += "\"edidVersion\":\"1.4\","; - break; - case Firebolt::HDMIInput::EDIDVersion::V2_0: - actual_settings += "\"edidVersion\":\"2.0\","; - break; - case Firebolt::HDMIInput::EDIDVersion::UNKNOWN: - actual_settings += "\"edidVersion\":unknown,"; - break; - default: - actual_settings += "\"edidVersion\":invalid,"; - } - actual_settings += "\"port\":\"" + std::string(port.port) + "\","; - - switch (port.signal) - { - case Firebolt::HDMIInput::HDMISignalStatus::NONE: - actual_settings += "\"signal\":\"none\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::STABLE: - actual_settings += "\"signal\":\"stable\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNSTABLE: - actual_settings += "\"signal\":\"unstable\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNSUPPORTED: - actual_settings += "\"signal\":\"unsupported\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNKNOWN: - actual_settings += "\"signal\":\"unknown\""; - break; - default: - actual_settings += "\"signal\":\"invalid\""; - } - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.port() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_settings) << "Error: wrong port returned by HDMIInputInterface.port()"; -} - -TEST_F(HDMIInputTest, ports) -{ - std::string expectedValues = jsonEngine->get_value("HDMIInput.ports"); - std::vector ports = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().ports(&error); - - Firebolt::HDMIInput::HDMIInputPort port = ports[0]; - std::string actual_settings = "{"; - actual_settings += "\"arcCapable\":" + std::string(port.arcCapable ? "true" : "false") + ","; - actual_settings += "\"arcConnected\":" + std::string(port.arcConnected ? "true" : "false") + ","; - actual_settings += "\"autoLowLatencyModeCapable\":" + std::string(port.autoLowLatencyModeCapable ? "true" : "false") + ","; - actual_settings += "\"autoLowLatencyModeSignalled\":" + std::string(port.autoLowLatencyModeSignalled ? "true" : "false") + ","; - actual_settings += "\"connected\":" + std::string(port.connected ? "true" : "false") + ","; - - switch (port.edidVersion) - { - case Firebolt::HDMIInput::EDIDVersion::V1_4: - actual_settings += "\"edidVersion\":\"1.4\","; - break; - case Firebolt::HDMIInput::EDIDVersion::V2_0: - actual_settings += "\"edidVersion\":\"2.0\","; - break; - case Firebolt::HDMIInput::EDIDVersion::UNKNOWN: - actual_settings += "\"edidVersion\":unknown,"; - break; - default: - actual_settings += "\"edidVersion\":invalid,"; - } - actual_settings += "\"port\":\"" + std::string(port.port) + "\","; - - switch (port.signal) - { - case Firebolt::HDMIInput::HDMISignalStatus::NONE: - actual_settings += "\"signal\":\"none\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::STABLE: - actual_settings += "\"signal\":\"stable\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNSTABLE: - actual_settings += "\"signal\":\"unstable\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNSUPPORTED: - actual_settings += "\"signal\":\"unsupported\""; - break; - case Firebolt::HDMIInput::HDMISignalStatus::UNKNOWN: - actual_settings += "\"signal\":\"unknown\""; - break; - default: - actual_settings += "\"signal\":\"invalid\""; - } - actual_settings += "}"; - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling HDMIInputInterface.ports() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_settings) << "Error: wrong ports returned by HDMIInputInterface.ports()"; -} - -// Events related tests -struct AutoLowLatencyModeCapableSettings : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeCapableChangedNotification -{ - void onAutoLowLatencyModeCapableChanged(const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo &) override; -}; - -void AutoLowLatencyModeCapableSettings::onAutoLowLatencyModeCapableChanged(const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo &info) -{ - std::cout << "onAutoLowLatencyModeCapableChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnAutoLowLatencyModeCapableChanged) -{ - AutoLowLatencyModeCapableSettings autoLowLatencySettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(autoLowLatencySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AutoLowLatencyModeCapableSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnAutoLowLatencyModeCapableChanged) -{ - AutoLowLatencyModeCapableSettings autoLowLatencySettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(autoLowLatencySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AutoLowLatencyModeCapableSettings"; -} - -struct AutoLowLatencyModeSignalSettings : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeSignalChangedNotification -{ - void onAutoLowLatencyModeSignalChanged(const Firebolt::HDMIInput::AutoLowLatencyModeSignalChangedInfo &) override; -}; - -void AutoLowLatencyModeSignalSettings::onAutoLowLatencyModeSignalChanged(const Firebolt::HDMIInput::AutoLowLatencyModeSignalChangedInfo &info) -{ - std::cout << "onAutoLowLatencyModeSignalChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnAutoLowLatencyModeSignalChanged) -{ - AutoLowLatencyModeSignalSettings autoLowLatencySignalSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(autoLowLatencySignalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AutoLowLatencyModeSignalSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnAutoLowLatencyModeSignalChanged) -{ - AutoLowLatencyModeSignalSettings autoLowLatencySignalSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(autoLowLatencySignalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AutoLowLatencyModeSignalSettings"; -} - -struct ConnectionSettings : public Firebolt::HDMIInput::IHDMIInput::IOnConnectionChangedNotification -{ - void onConnectionChanged(const Firebolt::HDMIInput::ConnectionChangedInfo &) override; -}; - -void ConnectionSettings::onConnectionChanged(const Firebolt::HDMIInput::ConnectionChangedInfo &info) -{ - std::cout << "onConnectionChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnConnectionChanged) -{ - ConnectionSettings connectionSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(connectionSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to ConnectionSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnConnectionChanged) -{ - ConnectionSettings connectionSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(connectionSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to ConnectionSettings"; -} - -struct EdidVersionSettings : public Firebolt::HDMIInput::IHDMIInput::IOnEdidVersionChangedNotification -{ - void onEdidVersionChanged(const Firebolt::HDMIInput::EDIDVersion &) override; -}; - -void EdidVersionSettings::onEdidVersionChanged(const Firebolt::HDMIInput::EDIDVersion &version) -{ - std::cout << "onEdidVersionChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnEdidVersionChanged) -{ - EdidVersionSettings edidVersionSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe("port_name", edidVersionSettings, &error); // Replace "port_name" with actual port name - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EdidVersionSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnEdidVersionChanged) -{ - EdidVersionSettings edidVersionSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(edidVersionSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EdidVersionSettings"; -} - -struct LowLatencyModeSettings : public Firebolt::HDMIInput::IHDMIInput::IOnLowLatencyModeChangedNotification -{ - void onLowLatencyModeChanged(const bool) override; -}; - -void LowLatencyModeSettings::onLowLatencyModeChanged(const bool mode) -{ - std::cout << "onLowLatencyModeChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnLowLatencyModeChanged) -{ - LowLatencyModeSettings lowLatencySettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(lowLatencySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LowLatencyModeSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnLowLatencyModeChanged) -{ - LowLatencyModeSettings lowLatencySettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(lowLatencySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LowLatencyModeSettings"; -} - -struct SignalSettings : public Firebolt::HDMIInput::IHDMIInput::IOnSignalChangedNotification -{ - void onSignalChanged(const Firebolt::HDMIInput::SignalChangedInfo &) override; -}; - -void SignalSettings::onSignalChanged(const Firebolt::HDMIInput::SignalChangedInfo &info) -{ - std::cout << "onSignalChanged event fired"; -} - -TEST_F(HDMIInputTest, subscribeOnSignalChanged) -{ - SignalSettings signalSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().subscribe(signalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SignalSettings"; -} - -TEST_F(HDMIInputTest, unsubscribeOnSignalChanged) -{ - SignalSettings signalSettings; - Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().unsubscribe(signalSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SignalSettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/keyboardTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/keyboardTest.cpp deleted file mode 100644 index 786af9db2..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/keyboardTest.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "unit.h" - -using namespace Firebolt::Keyboard; - -struct KeyboardProvider : public IKeyboardProvider -{ -public: - KeyboardProvider(); - ~KeyboardProvider() override = default; - void standard(const KeyboardParameters ¶meters, std::unique_ptr session) override; - void password(const KeyboardParameters ¶meters, std::unique_ptr session) override; - void email(const KeyboardParameters ¶meters, std::unique_ptr session) override; - void SendMessage(bool response); - -private: - void startKeyboardSession(const KeyboardParameters ¶meters, std::unique_ptr session); - -private: - std::unique_ptr _session; - KeyboardParameters _parameters; - bool _keyInput; -}; - -class KeyboardTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - KeyboardProvider _keyboardProvider; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -KeyboardProvider::KeyboardProvider() - : _session(nullptr), _parameters(), _keyInput(false) -{ -} - -void KeyboardProvider::standard(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - std::cout << "KeyboardProvider Standard is invoked" << std::endl; - startKeyboardSession(parameters, std::move(session)); -} - -void KeyboardProvider::password(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - std::cout << "KeyboardProvider Password is invoked" << std::endl; - startKeyboardSession(parameters, std::move(session)); -} - -void KeyboardProvider::email(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) -{ - std::cout << "KeyboardProvider Email is invoked" << std::endl; - startKeyboardSession(parameters, std::move(session)); -} - -void KeyboardProvider::SendMessage(bool response) -{ -} - -void KeyboardProvider::startKeyboardSession(const KeyboardParameters ¶meters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _keyInput = true; -} - -TEST_F(KeyboardTest, registerKeyboardProvider) -{ - Firebolt::IFireboltAccessor::Instance().KeyboardInterface().provide(_keyboardProvider); -} - diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp deleted file mode 100644 index fe813d3f1..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/localizationTest.cpp +++ /dev/null @@ -1,337 +0,0 @@ -#include "unit.h" - -class LocalizationTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(LocalizationTest, addAdditionalInfo) -{ - std::string key = "sampleKey"; - float value = 1.23f; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().addAdditionalInfo(key, value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.addAdditionalInfo() method"; -} - -TEST_F(LocalizationTest, additionalInfo) -{ - std::string expectedValues = jsonEngine->get_value("Localization.additionalInfo"); - Firebolt::Localization::Info info = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().additionalInfo(&error); - - std::string actual_info; - for (const auto &item : info) - { - actual_info += item.first + "=" + std::to_string(item.second) + ","; - } - actual_info = actual_info.substr(0, actual_info.size() - 1); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.additionalInfo() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), actual_info) << "Error: wrong additionalInfo returned by LocalizationInterface.additionalInfo()"; -} - -TEST_F(LocalizationTest, setCountryCode) -{ - std::string expected_value = "US"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setCountryCode(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setCountryCode() method"; -} - -TEST_F(LocalizationTest, countryCode) -{ - std::string expectedValues = jsonEngine->get_value("Localization.countryCode"); - std::string code = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().countryCode(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.countryCode() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), code) << "Error: wrong countryCode returned by LocalizationInterface.countryCode()"; -} - -TEST_F(LocalizationTest, setLanguage) -{ - std::string expected_value = "en"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setLanguage(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setLanguage() method"; -} - -TEST_F(LocalizationTest, language) -{ - std::string expectedValues = jsonEngine->get_value("Localization.language"); - std::string lang = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().language(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.language() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), lang) << "Error: wrong language returned by LocalizationInterface.language()"; -} - -TEST_F(LocalizationTest, setLocale) -{ - std::string expected_value = "en-US"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setLocale(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setLocale() method"; -} - -TEST_F(LocalizationTest, locale) -{ - std::string expectedValues = jsonEngine->get_value("Localization.locale"); - std::string locale = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().locale(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.locale() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), locale) << "Error: wrong locale returned by LocalizationInterface.locale()"; -} - -TEST_F(LocalizationTest, setLocality) -{ - std::string expected_value = "Rockville"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setLocality(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setLocality() method"; -} - -TEST_F(LocalizationTest, locality) -{ - std::string expectedValues = jsonEngine->get_value("Localization.locality"); - std::string locality = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().locality(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.locality() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), locality) << "Error: wrong locality returned by LocalizationInterface.locality()"; -} - -TEST_F(LocalizationTest, setPostalCode) -{ - std::string expected_value = "20850"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setPostalCode(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setPostalCode() method"; -} - -TEST_F(LocalizationTest, postalCode) -{ - std::string expectedValues = jsonEngine->get_value("Localization.postalCode"); - std::string postalCode = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().postalCode(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.postalCode() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), postalCode) << "Error: wrong postalCode returned by LocalizationInterface.postalCode()"; -} - -TEST_F(LocalizationTest, setPreferredAudioLanguages) -{ - std::vector expected_languages = {"eng", "spa"}; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setPreferredAudioLanguages(expected_languages, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setPreferredAudioLanguages() method"; -} - -TEST_F(LocalizationTest, preferredAudioLanguages) -{ - std::string expectedValues = jsonEngine->get_value("Localization.preferredAudioLanguages"); - std::vector languages = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().preferredAudioLanguages(&error); - - std::string actual_languages = "["; - for (const auto &lang : languages) - { - actual_languages += "\"" + lang + "\","; - } - actual_languages = actual_languages.substr(0, actual_languages.size() - 1); // Remove trailing comma - actual_languages += "]"; - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.preferredAudioLanguages() method"; - EXPECT_EQ(expectedValues, actual_languages) << "Error: wrong preferredAudioLanguages returned by LocalizationInterface.preferredAudioLanguages()"; -} - -TEST_F(LocalizationTest, removeAdditionalInfo) -{ - std::string key = "sampleKey"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().removeAdditionalInfo(key, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.removeAdditionalInfo() method"; -} - -TEST_F(LocalizationTest, setTimeZone) -{ - std::string expected_value = "America/Los_Angeles"; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setTimeZone(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.setTimeZone() method"; -} - -TEST_F(LocalizationTest, timeZone) -{ - std::string expectedValues = jsonEngine->get_value("Localization.timeZone"); - std::string timeZone = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().timeZone(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling LocalizationInterface.timeZone() method"; - EXPECT_EQ(REMOVE_QUOTES(expectedValues), timeZone) << "Error: wrong timeZone returned by LocalizationInterface.timeZone()"; -} - -// Events tests -struct CountryCodeSettings : public Firebolt::Localization::ILocalization::IOnCountryCodeChangedNotification -{ - void onCountryCodeChanged(const std::string &) override; -}; - -void CountryCodeSettings::onCountryCodeChanged(const std::string &code) -{ - std::cout << "onCountryCodeChanged event fired"; -} - -TEST_F(LocalizationTest, subscribeOnCountryCodeChanged) -{ - CountryCodeSettings countryCodeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(countryCodeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to CountryCodeSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnCountryCodeChanged) -{ - CountryCodeSettings countryCodeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(countryCodeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to CountryCodeSettings"; -} - -struct LanguageSettings : public Firebolt::Localization::ILocalization::IOnLanguageChangedNotification -{ - void onLanguageChanged(const std::string &) override; -}; - -void LanguageSettings::onLanguageChanged(const std::string &language) -{ - std::cout << "onLanguageChanged event fired with language: " << language; -} - -TEST_F(LocalizationTest, subscribeOnLanguageChanged) -{ - LanguageSettings languageSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(languageSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LanguageSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnLanguageChanged) -{ - LanguageSettings languageSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(languageSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LanguageSettings"; -} - -struct LocaleSettings : public Firebolt::Localization::ILocalization::IOnLocaleChangedNotification -{ - void onLocaleChanged(const std::string &) override; -}; - -void LocaleSettings::onLocaleChanged(const std::string &locale) -{ - std::cout << "onLocaleChanged event fired with locale: " << locale; -} - -TEST_F(LocalizationTest, subscribeOnLocaleChanged) -{ - LocaleSettings localeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(localeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LocaleSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnLocaleChanged) -{ - LocaleSettings localeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(localeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LocaleSettings"; -} - -struct LocalitySettings : public Firebolt::Localization::ILocalization::IOnLocalityChangedNotification -{ - void onLocalityChanged(const std::string &) override; -}; - -void LocalitySettings::onLocalityChanged(const std::string &locality) -{ - std::cout << "onLocalityChanged event fired with locality: " << locality; -} - -TEST_F(LocalizationTest, subscribeOnLocalityChanged) -{ - LocalitySettings localitySettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(localitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to LocalitySettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnLocalityChanged) -{ - LocalitySettings localitySettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(localitySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to LocalitySettings"; -} - -struct PostalCodeSettings : public Firebolt::Localization::ILocalization::IOnPostalCodeChangedNotification -{ - void onPostalCodeChanged(const std::string &) override; -}; - -void PostalCodeSettings::onPostalCodeChanged(const std::string &postalCode) -{ - std::cout << "onPostalCodeChanged event fired with postal code: " << postalCode; -} - -TEST_F(LocalizationTest, subscribeOnPostalCodeChanged) -{ - PostalCodeSettings postalCodeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(postalCodeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PostalCodeSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnPostalCodeChanged) -{ - PostalCodeSettings postalCodeSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(postalCodeSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PostalCodeSettings"; -} - -struct PreferredAudioLanguagesSettings : public Firebolt::Localization::ILocalization::IOnPreferredAudioLanguagesChangedNotification -{ - void onPreferredAudioLanguagesChanged(const std::vector &) override; -}; - -void PreferredAudioLanguagesSettings::onPreferredAudioLanguagesChanged(const std::vector &languages) -{ - std::cout << "onPreferredAudioLanguagesChanged event fired with languages: "; - for (const auto &lang : languages) - { - std::cout << lang << " "; - } - std::cout << std::endl; -} - -TEST_F(LocalizationTest, subscribeOnPreferredAudioLanguagesChanged) -{ - PreferredAudioLanguagesSettings preferredAudioLanguagesSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(preferredAudioLanguagesSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to PreferredAudioLanguagesSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnPreferredAudioLanguagesChanged) -{ - PreferredAudioLanguagesSettings preferredAudioLanguagesSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(preferredAudioLanguagesSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to PreferredAudioLanguagesSettings"; -} - -struct TimeZoneSettings : public Firebolt::Localization::ILocalization::IOnTimeZoneChangedNotification -{ - void onTimeZoneChanged(const std::string &) override; -}; - -void TimeZoneSettings::onTimeZoneChanged(const std::string &timeZone) -{ - std::cout << "onTimeZoneChanged event fired with time zone: " << timeZone; -} - -TEST_F(LocalizationTest, subscribeOnTimeZoneChanged) -{ - TimeZoneSettings timeZoneSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(timeZoneSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to TimeZoneSettings"; -} - -TEST_F(LocalizationTest, unsubscribeOnTimeZoneChanged) -{ - TimeZoneSettings timeZoneSettings; - Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(timeZoneSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to TimeZoneSettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/metricsTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/metricsTest.cpp deleted file mode 100644 index 1db1c8065..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/metricsTest.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "unit.h" - -class MetricsTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(MetricsTest, event) -{ - std::string schema = "http://example.com/schema"; - Firebolt::Metrics::EventObject data; - Firebolt::Error error = Firebolt::Error::None; - - Firebolt::IFireboltAccessor::Instance().MetricsInterface().event(schema, data, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling MetricsInterface.event() method"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/pinChallengeTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/pinChallengeTest.cpp deleted file mode 100644 index c28a93ee0..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/pinChallengeTest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "unit.h" - -using namespace Firebolt::PinChallenge; - -struct PinChallengeProvider : public IPinChallengeProvider -{ -public: - PinChallengeProvider(); - ~PinChallengeProvider() override = default; - void challenge(const PinChallenge ¶meters, std::unique_ptr session) override; - void SendMessage(bool response); - -private: - void startPinChallengeSession(const PinChallenge ¶meters, std::unique_ptr session); - -private: - std::unique_ptr _session; - PinChallenge _parameters; - bool _challengeInput; -}; - -class PinChallengeTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - PinChallengeProvider _pinChallengeProvider; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -PinChallengeProvider::PinChallengeProvider() - : _session(nullptr), _parameters(), _challengeInput(false) -{ -} - -void PinChallengeProvider::SendMessage(bool response) -{ -} - -void PinChallengeProvider::challenge(const PinChallenge ¶meters, std::unique_ptr session) -{ - std::cout << "PinChallengeProvider challenge is invoked" << std::endl; - startPinChallengeSession(parameters, std::move(session)); -} - -void PinChallengeProvider::startPinChallengeSession(const PinChallenge ¶meters, std::unique_ptr session) -{ - _session = std::move(session); - _parameters = parameters; - _challengeInput = true; -} - -TEST_F(PinChallengeTest, registerPinChallengeProvider) -{ - Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().provide(_pinChallengeProvider); -} \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp deleted file mode 100644 index d6717873c..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/privacyTest.cpp +++ /dev/null @@ -1,504 +0,0 @@ -#include "unit.h" - -class PrivacyTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(PrivacyTest, setAllowACRCollection) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowACRCollection(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowACRCollection() method"; -} - -TEST_F(PrivacyTest, allowACRCollection) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowACRCollection"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowACRCollection(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowACRCollection() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowACRCollection returned by PrivacyInterface.allowACRCollection()"; -} - -TEST_F(PrivacyTest, setAllowAppContentAdTargeting) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowAppContentAdTargeting(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowAppContentAdTargeting() method"; -} - -TEST_F(PrivacyTest, allowAppContentAdTargeting) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowAppContentAdTargeting"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowAppContentAdTargeting(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowAppContentAdTargeting() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowAppContentAdTargeting returned by PrivacyInterface.allowAppContentAdTargeting()"; -} - -TEST_F(PrivacyTest, setAllowCameraAnalytics) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowCameraAnalytics(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowCameraAnalytics() method"; -} - -TEST_F(PrivacyTest, allowCameraAnalytics) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowCameraAnalytics"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowCameraAnalytics(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowCameraAnalytics() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowCameraAnalytics returned by PrivacyInterface.allowCameraAnalytics()"; -} - -TEST_F(PrivacyTest, setAllowPersonalization) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowPersonalization(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowPersonalization() method"; -} - -TEST_F(PrivacyTest, allowPersonalization) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowPersonalization"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowPersonalization(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowPersonalization() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowPersonalization returned by PrivacyInterface.allowPersonalization()"; -} - -TEST_F(PrivacyTest, setAllowPrimaryBrowseAdTargeting) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowPrimaryBrowseAdTargeting(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowPrimaryBrowseAdTargeting() method"; -} - -TEST_F(PrivacyTest, allowPrimaryBrowseAdTargeting) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowPrimaryBrowseAdTargeting"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowPrimaryBrowseAdTargeting(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowPrimaryBrowseAdTargeting() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowPrimaryBrowseAdTargeting returned by PrivacyInterface.allowPrimaryBrowseAdTargeting()"; -} - -TEST_F(PrivacyTest, setAllowPrimaryContentAdTargeting) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowPrimaryContentAdTargeting(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowPrimaryContentAdTargeting() method"; -} - -TEST_F(PrivacyTest, allowPrimaryContentAdTargeting) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowPrimaryContentAdTargeting"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowPrimaryContentAdTargeting(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowPrimaryContentAdTargeting() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowPrimaryContentAdTargeting returned by PrivacyInterface.allowPrimaryContentAdTargeting()"; -} - -TEST_F(PrivacyTest, setAllowProductAnalytics) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowProductAnalytics(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowProductAnalytics() method"; -} - -TEST_F(PrivacyTest, allowProductAnalytics) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowProductAnalytics"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowProductAnalytics(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowProductAnalytics() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowProductAnalytics returned by PrivacyInterface.allowProductAnalytics()"; -} - -TEST_F(PrivacyTest, setAllowRemoteDiagnostics) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowRemoteDiagnostics(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowRemoteDiagnostics() method"; -} - -TEST_F(PrivacyTest, allowResumePoints) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowResumePoints"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowResumePoints(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowResumePoints() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowResumePoints returned by PrivacyInterface.allowResumePoints()"; -} - -TEST_F(PrivacyTest, setAllowResumePoints) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowResumePoints(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowResumePoints() method"; -} - -TEST_F(PrivacyTest, allowUnentitledPersonalization) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowUnentitledPersonalization"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowUnentitledPersonalization(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowUnentitledPersonalization() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowUnentitledPersonalization returned by PrivacyInterface.allowUnentitledPersonalization()"; -} - -TEST_F(PrivacyTest, setAllowUnentitledPersonalization) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowUnentitledPersonalization(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowUnentitledPersonalization() method"; -} - -TEST_F(PrivacyTest, allowUnentitledResumePoints) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowUnentitledResumePoints"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowUnentitledResumePoints(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowUnentitledResumePoints() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowUnentitledResumePoints returned by PrivacyInterface.allowUnentitledResumePoints()"; -} - -TEST_F(PrivacyTest, setAllowUnentitledResumePoints) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowUnentitledResumePoints(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowUnentitledResumePoints() method"; -} - -TEST_F(PrivacyTest, allowWatchHistory) -{ - std::string expectedValues = jsonEngine->get_value("Privacy.allowWatchHistory"); - bool allow = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowWatchHistory(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.allowWatchHistory() method"; - EXPECT_EQ(expectedValues == "true", allow) << "Error: wrong allowWatchHistory returned by PrivacyInterface.allowWatchHistory()"; -} - -TEST_F(PrivacyTest, setAllowWatchHistory) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowWatchHistory(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.setAllowWatchHistory() method"; -} - -TEST_F(PrivacyTest, settings) -{ - - std::string expectedValues = jsonEngine->get_value("Privacy.settings"); - - Firebolt::Privacy::PrivacySettings settings = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().settings(&error); - - std::string actual_settings = "{"; - actual_settings += "\"allowACRCollection\":" + std::string(settings.allowACRCollection ? "true" : "false") + ","; - actual_settings += "\"allowAppContentAdTargeting\":" + std::string(settings.allowAppContentAdTargeting ? "true" : "false") + ","; - actual_settings += "\"allowCameraAnalytics\":" + std::string(settings.allowCameraAnalytics ? "true" : "false") + ","; - actual_settings += "\"allowPersonalization\":" + std::string(settings.allowPersonalization ? "true" : "false") + ","; - actual_settings += "\"allowPrimaryBrowseAdTargeting\":" + std::string(settings.allowPrimaryBrowseAdTargeting ? "true" : "false") + ","; - actual_settings += "\"allowPrimaryContentAdTargeting\":" + std::string(settings.allowPrimaryContentAdTargeting ? "true" : "false") + ","; - actual_settings += "\"allowProductAnalytics\":" + std::string(settings.allowProductAnalytics ? "true" : "false") + ","; - actual_settings += "\"allowRemoteDiagnostics\":" + std::string(settings.allowRemoteDiagnostics ? "true" : "false") + ","; - actual_settings += "\"allowResumePoints\":" + std::string(settings.allowResumePoints ? "true" : "false") + ","; - actual_settings += "\"allowUnentitledPersonalization\":" + std::string(settings.allowUnentitledPersonalization ? "true" : "false") + ","; - actual_settings += "\"allowUnentitledResumePoints\":" + std::string(settings.allowUnentitledResumePoints ? "true" : "false") + ","; - actual_settings += "\"allowWatchHistory\":" + std::string(settings.allowWatchHistory ? "true" : "false"); - actual_settings += "}"; - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling PrivacyInterface.settings() method"; - EXPECT_EQ(expectedValues, actual_settings) << "Error: wrong settings returned by PrivacyInterface.settings()"; -} - -// Events Tests -struct AllowACRCollectionSettings : public Firebolt::Privacy::IPrivacy::IOnAllowACRCollectionChangedNotification -{ - void onAllowACRCollectionChanged(const bool) override; -}; - -void AllowACRCollectionSettings::onAllowACRCollectionChanged(const bool isAllowed) -{ - std::cout << "onAllowACRCollectionChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowACRCollectionChanged) -{ - AllowACRCollectionSettings allowACRCollectionSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowACRCollectionSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowACRCollectionSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowACRCollectionChanged) -{ - AllowACRCollectionSettings allowACRCollectionSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowACRCollectionSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowACRCollectionSettings"; -} - -struct AllowAppContentAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowAppContentAdTargetingChangedNotification -{ - void onAllowAppContentAdTargetingChanged(const bool) override; -}; - -void AllowAppContentAdTargetingSettings::onAllowAppContentAdTargetingChanged(const bool isAllowed) -{ - std::cout << "onAllowAppContentAdTargetingChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowAppContentAdTargetingChanged) -{ - AllowAppContentAdTargetingSettings allowAppContentAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowAppContentAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowAppContentAdTargetingSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowAppContentAdTargetingChanged) -{ - AllowAppContentAdTargetingSettings allowAppContentAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowAppContentAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowAppContentAdTargetingSettings"; -} - -struct AllowCameraAnalyticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowCameraAnalyticsChangedNotification -{ - void onAllowCameraAnalyticsChanged(const bool) override; -}; - -void AllowCameraAnalyticsSettings::onAllowCameraAnalyticsChanged(const bool isAllowed) -{ - std::cout << "onAllowCameraAnalyticsChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowCameraAnalyticsChanged) -{ - AllowCameraAnalyticsSettings allowCameraAnalyticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowCameraAnalyticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowCameraAnalyticsSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowCameraAnalyticsChanged) -{ - AllowCameraAnalyticsSettings allowCameraAnalyticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowCameraAnalyticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowCameraAnalyticsSettings"; -} - -struct AllowPersonalizationSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPersonalizationChangedNotification -{ - void onAllowPersonalizationChanged(const bool) override; -}; - -void AllowPersonalizationSettings::onAllowPersonalizationChanged(const bool isAllowed) -{ - std::cout << "onAllowPersonalizationChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowPersonalizationChanged) -{ - AllowPersonalizationSettings allowPersonalizationSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPersonalizationSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPersonalizationSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowPersonalizationChanged) -{ - AllowPersonalizationSettings allowPersonalizationSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPersonalizationSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPersonalizationSettings"; -} - -struct AllowPrimaryBrowseAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPrimaryBrowseAdTargetingChangedNotification -{ - void onAllowPrimaryBrowseAdTargetingChanged(const bool) override; -}; - -void AllowPrimaryBrowseAdTargetingSettings::onAllowPrimaryBrowseAdTargetingChanged(const bool isAllowed) -{ - std::cout << "onAllowPrimaryBrowseAdTargetingChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowPrimaryBrowseAdTargetingChanged) -{ - AllowPrimaryBrowseAdTargetingSettings allowPrimaryBrowseAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPrimaryBrowseAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPrimaryBrowseAdTargetingSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowPrimaryBrowseAdTargetingChanged) -{ - AllowPrimaryBrowseAdTargetingSettings allowPrimaryBrowseAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPrimaryBrowseAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPrimaryBrowseAdTargetingSettings"; -} - -struct AllowPrimaryContentAdTargetingSettings : public Firebolt::Privacy::IPrivacy::IOnAllowPrimaryContentAdTargetingChangedNotification -{ - void onAllowPrimaryContentAdTargetingChanged(const bool) override; -}; - -void AllowPrimaryContentAdTargetingSettings::onAllowPrimaryContentAdTargetingChanged(const bool isAllowed) -{ - std::cout << "onAllowPrimaryContentAdTargetingChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowPrimaryContentAdTargetingChanged) -{ - AllowPrimaryContentAdTargetingSettings allowPrimaryContentAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowPrimaryContentAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowPrimaryContentAdTargetingSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowPrimaryContentAdTargetingChanged) -{ - AllowPrimaryContentAdTargetingSettings allowPrimaryContentAdTargetingSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowPrimaryContentAdTargetingSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowPrimaryContentAdTargetingSettings"; -} - -struct AllowProductAnalyticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowProductAnalyticsChangedNotification -{ - void onAllowProductAnalyticsChanged(const bool) override; -}; - -void AllowProductAnalyticsSettings::onAllowProductAnalyticsChanged(const bool isAllowed) -{ - std::cout << "onAllowProductAnalyticsChanged event fired"; -} - -TEST_F(PrivacyTest, subscribeOnAllowProductAnalyticsChanged) -{ - AllowProductAnalyticsSettings allowProductAnalyticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowProductAnalyticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowProductAnalyticsSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowProductAnalyticsChanged) -{ - AllowProductAnalyticsSettings allowProductAnalyticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowProductAnalyticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowProductAnalyticsSettings"; -} - -struct AllowRemoteDiagnosticsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowRemoteDiagnosticsChangedNotification -{ - void onAllowRemoteDiagnosticsChanged(const bool) override; -}; - -void AllowRemoteDiagnosticsSettings::onAllowRemoteDiagnosticsChanged(const bool isAllowed) -{ - std::cout << "onAllowRemoteDiagnosticsChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowRemoteDiagnosticsChanged) -{ - AllowRemoteDiagnosticsSettings allowRemoteDiagnosticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowRemoteDiagnosticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowRemoteDiagnosticsSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowRemoteDiagnosticsChanged) -{ - AllowRemoteDiagnosticsSettings allowRemoteDiagnosticsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowRemoteDiagnosticsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowRemoteDiagnosticsSettings"; -} - -struct AllowResumePointsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowResumePointsChangedNotification -{ - void onAllowResumePointsChanged(const bool) override; -}; - -void AllowResumePointsSettings::onAllowResumePointsChanged(const bool isAllowed) -{ - std::cout << "onAllowResumePointsChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowResumePointsChanged) -{ - AllowResumePointsSettings allowResumePointsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowResumePointsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowResumePointsSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowResumePointsChanged) -{ - AllowResumePointsSettings allowResumePointsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowResumePointsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowResumePointsSettings"; -} - -struct AllowUnentitledPersonalizationSettings : public Firebolt::Privacy::IPrivacy::IOnAllowUnentitledPersonalizationChangedNotification -{ - void onAllowUnentitledPersonalizationChanged(const bool) override; -}; - -void AllowUnentitledPersonalizationSettings::onAllowUnentitledPersonalizationChanged(const bool isAllowed) -{ - std::cout << "onAllowUnentitledPersonalizationChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowUnentitledPersonalizationChanged) -{ - AllowUnentitledPersonalizationSettings allowUnentitledPersonalizationSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowUnentitledPersonalizationSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowUnentitledPersonalizationSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowUnentitledPersonalizationChanged) -{ - AllowUnentitledPersonalizationSettings allowUnentitledPersonalizationSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowUnentitledPersonalizationSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowUnentitledPersonalizationSettings"; -} - -struct AllowUnentitledResumePointsSettings : public Firebolt::Privacy::IPrivacy::IOnAllowUnentitledResumePointsChangedNotification -{ - void onAllowUnentitledResumePointsChanged(const bool) override; -}; - -void AllowUnentitledResumePointsSettings::onAllowUnentitledResumePointsChanged(const bool isAllowed) -{ - std::cout << "onAllowUnentitledResumePointsChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowUnentitledResumePointsChanged) -{ - AllowUnentitledResumePointsSettings allowUnentitledResumePointsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowUnentitledResumePointsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowUnentitledResumePointsSettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowUnentitledResumePointsChanged) -{ - AllowUnentitledResumePointsSettings allowUnentitledResumePointsSettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowUnentitledResumePointsSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowUnentitledResumePointsSettings"; -} - -struct AllowWatchHistorySettings : public Firebolt::Privacy::IPrivacy::IOnAllowWatchHistoryChangedNotification -{ - void onAllowWatchHistoryChanged(const bool) override; -}; - -void AllowWatchHistorySettings::onAllowWatchHistoryChanged(const bool isAllowed) -{ - std::cout << "onAllowWatchHistoryChanged event fired with isAllowed: " << isAllowed; -} - -TEST_F(PrivacyTest, subscribeOnAllowWatchHistoryChanged) -{ - AllowWatchHistorySettings allowWatchHistorySettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(allowWatchHistorySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to AllowWatchHistorySettings"; -} - -TEST_F(PrivacyTest, unsubscribeOnAllowWatchHistoryChanged) -{ - AllowWatchHistorySettings allowWatchHistorySettings; - Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(allowWatchHistorySettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to AllowWatchHistorySettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/secureStorageTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/secureStorageTest.cpp deleted file mode 100644 index 51f648665..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/secureStorageTest.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "unit.h" - -class SecureStorageTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - Firebolt::SecureStorage::StorageScope scope; - std::string appId = "exampleAppId"; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(SecureStorageTest, clearForApp) -{ - Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().clearForApp(appId, scope, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling SecureStorageInterface.clearForApp() method"; -} - -TEST_F(SecureStorageTest, removeForApp) -{ - std::string key = "exampleKey"; - - Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().removeForApp(appId, scope, key, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling SecureStorageInterface.removeForApp() method"; -} - -TEST_F(SecureStorageTest, setForApp) -{ - std::string key = "exampleKey"; - std::string value = "exampleValue"; - std::optional options = std::nullopt; - - Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().setForApp(appId, scope, key, value, options, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling SecureStorageInterface.setForApp() method"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h b/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h deleted file mode 100644 index 7f47caa06..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/unit.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "gtest/gtest.h" -#include "../ManageSDKTest.h" -#include "json_engine.h" \ No newline at end of file diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/userGrantTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/userGrantTest.cpp deleted file mode 100644 index e1850be13..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/userGrantTest.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "unit.h" - -using namespace Firebolt::UserGrants; -using namespace Firebolt::Capabilities; - -class UserGrantsTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - std::string capability = "xrn:firebolt:capability:example-capability:sub-capability"; - Role role; - std::optional options = std::nullopt; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -std::string grantInfoLifespanToString(GrantInfoLifespan lifespan) -{ - switch (lifespan) - { - case GrantInfoLifespan::ONCE: - return "once"; - case GrantInfoLifespan::FOREVER: - return "forever"; - case GrantInfoLifespan::APP_ACTIVE: - return "appActive"; - case GrantInfoLifespan::POWER_ACTIVE: - return "powerActive"; - case GrantInfoLifespan::SECONDS: - return "seconds"; - default: - return "unknown"; - } -} - -std::string roleToString(Role role) -{ - switch (role) - { - case Role::USE: - return "use"; - case Role::MANAGE: - return "manage"; - case Role::PROVIDE: - return "provide"; - default: - return "unknown"; - } -} - -std::string grantStateToString(GrantState state) -{ - switch (state) - { - case GrantState::GRANTED: - return "granted"; - case GrantState::DENIED: - return "denied"; - default: - return "unknown"; - } -} - -std::string stringifyGrantInfo(const std::vector &grants) -{ - std::string result = "["; - for (const auto &grant : grants) - { - result += "{"; - if (grant.app.has_value()) - { - result += "\"app\":{\"id\":\"" + grant.app.value().id + "\","; - if (grant.app.value().title.has_value()) - { - result += "\"title\":\"" + grant.app.value().title.value() + "\""; - } - else - { - ADD_FAILURE() << "Expected grant.app.title to have a value"; - } - result += "},"; - } - else - { - ADD_FAILURE() << "Expected grant.app to have a value"; - } - result += "\"capability\":\"" + std::string(grant.capability) + "\","; - if (grant.expires.has_value()) - { - result += "\"expires\":\"" + grant.expires.value() + "\","; - } - else - { - ADD_FAILURE() << "Expected grant.expires to have a value"; - } - result += "\"lifespan\":\"" + grantInfoLifespanToString(grant.lifespan) + "\","; - result += "\"role\":\"" + roleToString(grant.role) + "\","; - result += "\"state\":\"" + grantStateToString(grant.state) + "\""; - result += "},"; - } - if (!grants.empty()) - { - result.pop_back(); // Remove the last comma - } - result += "]"; - return result; -} - -TEST_F(UserGrantsTest, app) -{ - std::string expectedValues = jsonEngine->get_value("UserGrants.app"); - std::string appId = "appId"; - std::vector info = Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().app(appId, &error); - - std::string info_string = stringifyGrantInfo(info); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.app() method"; - EXPECT_EQ(expectedValues, info_string) << "Error: wrong info returned by UserGrantsInterface.app()"; -} - -TEST_F(UserGrantsTest, capability) -{ - std::string expectedValues = jsonEngine->get_value("UserGrants.capability"); - std::vector info = Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().capability(capability, &error); - - std::string info_string = stringifyGrantInfo(info); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.capability() method"; - EXPECT_EQ(expectedValues, info_string) << "Error: wrong info returned by UserGrantsInterface.capability()"; -} - -TEST_F(UserGrantsTest, clear) -{ - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().clear(role, capability, options, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.clear() method"; -} - -TEST_F(UserGrantsTest, deny) -{ - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().deny(role, capability, options, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.deny() method"; -} - -TEST_F(UserGrantsTest, device) -{ - std::string expectedValues = jsonEngine->get_value("UserGrants.device"); - std::vector info = Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().device(&error); - - std::string info_string = stringifyGrantInfo(info); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.device() method"; - EXPECT_EQ(expectedValues, info_string) << "Error: wrong info returned by UserGrantsInterface.device()"; -} - -TEST_F(UserGrantsTest, grant) -{ - Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().grant(role, capability, options, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.grant() method"; -} - -TEST_F(UserGrantsTest, request) -{ - std::string expectedValues = jsonEngine->get_value("UserGrants.request"); - - std::string appId = "appId"; - std::vector permissions = { - {std::make_optional(Role::USE), "xrn:firebolt:capability:example-capability:sub-capability"}, - {std::nullopt, "xrn:firebolt:capability:example-capability:sub-capability"}, - {std::make_optional(Role::MANAGE), "xrn:firebolt:capability:example-capability:sub-capability"}}; - std::optional req_options = std::nullopt; - - std::vector info = Firebolt::IFireboltAccessor::Instance().UserGrantsInterface().request(appId, permissions, req_options, &error); - - std::string info_string = stringifyGrantInfo(info); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling UserGrantsInterface.request() method"; - EXPECT_EQ(expectedValues, info_string) << "Error: wrong info returned by UserGrantsInterface.request()"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp deleted file mode 100644 index d62ce8374..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "unit.h" - -class VoiceGuidanceTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -TEST_F(VoiceGuidanceTest, setEnabled) -{ - bool expected_value = true; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().setEnabled(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling VoiceGuidanceInterface.setEnabled() method"; -} - -TEST_F(VoiceGuidanceTest, enabled) -{ - std::string expectedValues = jsonEngine->get_value("VoiceGuidance.enabled"); - bool enabled = Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().enabled(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling VoiceGuidanceInterface.enabled() method"; - EXPECT_EQ(expectedValues == "true", enabled) << "Error: wrong enabled value returned by VoiceGuidanceInterface.enabled()"; -} - -TEST_F(VoiceGuidanceTest, setSpeed) -{ - float expected_value = 1.5f; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().setSpeed(expected_value, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling VoiceGuidanceInterface.setSpeed() method"; -} - -TEST_F(VoiceGuidanceTest, speed) -{ - std::string expectedValues = jsonEngine->get_value("VoiceGuidance.speed"); - float speed = Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().speed(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling VoiceGuidanceInterface.speed() method"; - EXPECT_EQ(stof(expectedValues), speed) << "Error: wrong speed value returned by VoiceGuidanceInterface.speed()"; -} - -// Events Tests -struct EnabledSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnEnabledChangedNotification -{ - void onEnabledChanged(const bool) override; -}; - -void EnabledSettings::onEnabledChanged(const bool isEnabled) -{ - std::cout << "onEnabledChanged event fired with isEnabled: " << isEnabled; -} - -TEST_F(VoiceGuidanceTest, subscribeOnEnabledChanged) -{ - EnabledSettings enabledSettings; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(enabledSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledSettings"; -} - -TEST_F(VoiceGuidanceTest, unsubscribeOnEnabledChanged) -{ - EnabledSettings enabledSettings; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(enabledSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledSettings"; -} - -struct SpeedSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnSpeedChangedNotification -{ - void onSpeedChanged(const float) override; -}; - -void SpeedSettings::onSpeedChanged(const float speed) -{ - std::cout << "onSpeedChanged event fired with speed: " << speed; -} - -TEST_F(VoiceGuidanceTest, subscribeOnSpeedChanged) -{ - SpeedSettings speedSettings; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(speedSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SpeedSettings"; -} - -TEST_F(VoiceGuidanceTest, unsubscribeOnSpeedChanged) -{ - SpeedSettings speedSettings; - Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(speedSettings, &error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SpeedSettings"; -} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/unit/wifiTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/unit/wifiTest.cpp deleted file mode 100644 index c63d3b79c..000000000 --- a/src/sdks/manage/src/cpp/sdk/cpptest/unit/wifiTest.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#include "unit.h" - -using namespace Firebolt::Wifi; - -class WifiTest : public ::testing::Test -{ -protected: - JsonEngine *jsonEngine; - Firebolt::Error error = Firebolt::Error::None; - - void SetUp() override - { - jsonEngine = new JsonEngine(); - } - - void TearDown() override - { - delete jsonEngine; - } -}; - -std::string wifiSecurityModeToString(WifiSecurityMode mode) -{ - switch (mode) - { - case WifiSecurityMode::NONE: - return "none"; - case WifiSecurityMode::WEP_64: - return "wep64"; - case WifiSecurityMode::WEP_128: - return "wep128"; - case WifiSecurityMode::WPA_PSK_TKIP: - return "wpaPskTkip"; - case WifiSecurityMode::WPA_PSK_AES: - return "wpaPskAes"; - case WifiSecurityMode::WPA_2PSK_TKIP: - return "wpa2PskTkip"; - case WifiSecurityMode::WPA_2PSK_AES: - return "wpa2PskAes"; - case WifiSecurityMode::WPA_ENTERPRISE_TKIP: - return "wpaEnterpriseTkip"; - case WifiSecurityMode::WPA_ENTERPRISE_AES: - return "wpaEnterpriseAes"; - case WifiSecurityMode::WPA_2ENTERPRISE_TKIP: - return "wpa2EnterpriseTkip"; - case WifiSecurityMode::WPA_2ENTERPRISE_AES: - return "wpa2EnterpriseAes"; - case WifiSecurityMode::WPA_2PSK: - return "wpa2Psk"; - case WifiSecurityMode::WPA_2ENTERPRISE: - return "wpa2Enterprise"; - case WifiSecurityMode::WPA_3PSK_AES: - return "wpa3PskAes"; - case WifiSecurityMode::WPA_3SAE: - return "wpa3Sae"; - default: - return "unknown"; - } -} - -std::string removeParentheses(const std::string &str) -{ - std::string result; - for (char ch : str) - { - if (ch != '(' && ch != ')') - { - result += ch; - } - } - return result; -} - -TEST_F(WifiTest, connect) -{ - json expectedValues = json::parse(jsonEngine->get_value("Wifi.connect")); - - std::optional ssid = "SSID"; - std::optional passphrase = "Passphrase"; - std::optional security = WifiSecurityMode::WPA_2PSK; - - AccessPoint connectedWifi = Firebolt::IFireboltAccessor::Instance().WifiInterface().connect(ssid, passphrase, security, &error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling WifiInterface.connect() method"; - EXPECT_EQ(connectedWifi.ssid, expectedValues["ssid"]) << "SSID mismatch"; - if (connectedWifi.securityMode.has_value()) - { - EXPECT_EQ(wifiSecurityModeToString(connectedWifi.securityMode.value()), expectedValues["security"]) << "Security mode mismatch"; - } - else - { - ADD_FAILURE() << "Expected connectedWifi.securityMode to have a value"; - } - EXPECT_EQ(connectedWifi.signalStrength, expectedValues["signalStrength"]) << "signalStrength mismatch"; - if (connectedWifi.frequency.has_value()) - { - EXPECT_EQ(connectedWifi.frequency, expectedValues["frequency"].get()) << "frequency mismatch"; - } - else - { - ADD_FAILURE() << "Expected connectedWifi.frequency to have a value"; - } -} - -TEST_F(WifiTest, disconnect) -{ - Firebolt::IFireboltAccessor::Instance().WifiInterface().disconnect(&error); - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling WifiInterface.disconnect() method"; -} - -TEST_F(WifiTest, scan) -{ - std::string expectedValues = jsonEngine->get_value("Wifi.scan"); - - std::optional timeout = 30; - - AccessPointList apl = Firebolt::IFireboltAccessor::Instance().WifiInterface().scan(timeout, &error); - - std::string apl_string = "{\"list\":["; - if (apl.list.has_value()) - { - for (const auto &ap : apl.list.value()) - { - apl_string += "{"; - - if (ap.frequency.has_value()) - { - std::string s = std::to_string(ap.frequency.value()); - auto pos = s.find('.'); - - apl_string += "\"frequency\":" + s.substr(0, pos + 2) + ","; - } - { - ADD_FAILURE() << "Expected ap.frequency to have a value"; - } - if (ap.securityMode.has_value()) - { - apl_string += "\"security\":\"" + wifiSecurityModeToString(ap.securityMode.value()) + "\","; - } - { - ADD_FAILURE() << "Expected ap.securityMode to have a value"; - } - if (ap.signalStrength.has_value()) - { - apl_string += "\"signalStrength\":" + std::to_string(ap.signalStrength.value()) + ","; - } - { - ADD_FAILURE() << "Expected ap.signalStrength to have a value"; - } - if (ap.ssid.has_value()) - { - apl_string += "\"ssid\":\"" + ap.ssid.value() + "\","; - } - { - ADD_FAILURE() << "Expected ap.ssid to have a value"; - } - - apl_string.pop_back(); // Remove the last comma - apl_string += "},"; - } - apl_string.pop_back(); // Remove the last comma - } - else - { - ADD_FAILURE() << "Expected apl.list to have a value"; - } - apl_string += "]}"; - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling WifiInterface.scan() method"; - EXPECT_EQ(expectedValues, apl_string) << "Scan should return at least one access point"; -} - -TEST_F(WifiTest, wps) -{ - json expectedValues = json::parse(jsonEngine->get_value("Wifi.wps")); - std::optional security = WPSSecurityPin::PIN; - - AccessPoint connectedWifi = Firebolt::IFireboltAccessor::Instance().WifiInterface().wps(security, &error); - - EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling WifiInterface.connect() method"; - EXPECT_EQ(connectedWifi.ssid, expectedValues["ssid"]) << "SSID mismatch"; - if (connectedWifi.securityMode.has_value()) - { - EXPECT_EQ(wifiSecurityModeToString(connectedWifi.securityMode.value()), expectedValues["security"]) << "Security mode mismatch"; - } - else - { - ADD_FAILURE() << "Expected connectedWifi.securityMode to have a value"; - } - EXPECT_EQ(connectedWifi.signalStrength, expectedValues["signalStrength"]) << "signalStrength mismatch"; - if (connectedWifi.frequency.has_value()) - { - EXPECT_EQ(connectedWifi.frequency, expectedValues["frequency"].get()) << "frequency mismatch"; - } - else - { - ADD_FAILURE() << "Expected connectedWifi.frequency to have a value"; - } -} diff --git a/src/sdks/manage/src/cpp/sdk/test/CMakeLists.txt b/src/sdks/manage/src/cpp/sdk/test/CMakeLists.txt deleted file mode 100644 index f92c73420..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2023 Comcast Cable Communications Management, LLC -# -# Licensed 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. -# -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.3) - -project(FireboltManageSDKTests) -project_version(1.0.0) - -set(TESTLIB ${PROJECT_NAME}) - -message("Setup ${TESTLIB} v${PROJECT_VERSION}") - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) -find_package(${NAMESPACE}Core CONFIG REQUIRED) - -file(GLOB CPP_SOURCES *.cpp) -list(REMOVE_ITEM CPP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Main.cpp) -message("After CPP_SOURCES " ${CPP_SOURCES}) -add_library(${TESTLIB} STATIC ${CPP_SOURCES}) - -target_link_libraries(${TESTLIB} - PRIVATE - ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK - ${NAMESPACE}Core::${NAMESPACE}Core -) - -target_include_directories(${TESTLIB} - PRIVATE - $ - $ - $ - $ -) - -set_target_properties(${TESTLIB} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - LINK_WHAT_YOU_USE TRUE - FRAMEWORK FALSE -) - -set(TESTAPP FireboltManageSDKTestApp) - -message("Setup ${TESTAPP} v${PROJECT_VERSION}") - -add_executable(${TESTAPP} Main.cpp) - -target_link_libraries(${TESTAPP} - PRIVATE - ${TESTLIB} -) - -target_include_directories(${TESTAPP} - PRIVATE - $ - $ - $ -) - -install( - TARGETS ${TESTLIB} EXPORT ${TESTLIB}Targets - ARCHIVE DESTINATION lib COMPONENT libs # static lib - LIBRARY DESTINATION lib COMPONENT libs # shared lib -) - -InstallCMakeConfig(TARGETS ${TESTLIB}) - -add_custom_command( - TARGET ${TESTAPP} - POST_BUILD - COMMENT "=================== Installing TestApp ======================" - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin -) diff --git a/src/sdks/manage/src/cpp/sdk/test/Main.cpp b/src/sdks/manage/src/cpp/sdk/test/Main.cpp deleted file mode 100644 index 28fc4595f..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/Main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include "ManageSDKTestGeneratedCode.h" - -int __cnt = 0; -int __pass = 0; - -int TotalTests = 0; -int TotalTestsPassed = 0; - -int main() -{ - printf("Calling CreateFireboltInstance ---\n"); - ManageSDKTestGeneratedCode::CreateFireboltInstance(); - - if (ManageSDKTestGeneratedCode::WaitOnConnectionReady() == true) { - printf("Calling GetDeviceName ---> \n"); - ManageSDKTestGeneratedCode::GetDeviceName(); - ManageSDKTestGeneratedCode::SetDeviceName(); - ManageSDKTestGeneratedCode::GetDeviceName(); - } - ManageSDKTestGeneratedCode::DestroyFireboltInstance(); - printf("TOTAL: %i tests; %i PASSED, %i FAILED\n", TotalTests, TotalTestsPassed, (TotalTests - TotalTestsPassed)); -} - diff --git a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.cpp b/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.cpp deleted file mode 100644 index c0d0123ab..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include "Module.h" -#include "firebolt.h" -#include "ManageSDKTestStaticCode.h" -#include "ManageSDKTestGeneratedCode.h" - -using namespace std; -bool ManageSDKTestGeneratedCode::_connected; - -void ManageSDKTestGeneratedCode::ConnectionChanged(const bool connected, const Firebolt::Error error) -{ - cout << "Change in connection: connected: " << connected << " error: " << static_cast(error) << endl; - _connected = connected; -} - -void ManageSDKTestGeneratedCode::CreateFireboltInstance() -{ - const std::string config = _T("{\ - \"waitTime\": 1000,\ - \"logLevel\": \"Info\",\ - \"workerPool\":{\ - \"queueSize\": 8,\ - \"threadCount\": 3\ - },\ - \"wsUrl\": \"ws://127.0.0.1:9998\"\ - }"); - - _connected = false; - Firebolt::IFireboltAccessor::Instance().Initialize(config); - Firebolt::IFireboltAccessor::Instance().Connect(ConnectionChanged); -} - -void ManageSDKTestGeneratedCode::DestroyFireboltInstance() -{ - Firebolt::IFireboltAccessor::Instance().Disconnect(); - Firebolt::IFireboltAccessor::Instance().Deinitialize(); - Firebolt::IFireboltAccessor::Instance().Dispose(); -} - -bool ManageSDKTestGeneratedCode::WaitOnConnectionReady() -{ - uint32_t waiting = 10000; - static constexpr uint32_t SLEEPSLOT_TIME = 100; - - // Right, a wait till connection is closed is requested.. - while ((waiting > 0) && (_connected == false)) { - - uint32_t sleepSlot = (waiting > SLEEPSLOT_TIME ? SLEEPSLOT_TIME : waiting); - // Right, lets sleep in slices of 100 ms - SleepMs(sleepSlot); - waiting -= sleepSlot; - } - return _connected; -} - -void ManageSDKTestGeneratedCode::TestManageStaticSDK() -{ - FireboltSDK::Tests::Main(); -} - -void ManageSDKTestGeneratedCode::GetDeviceName() -{ - Firebolt::Error error = Firebolt::Error::None; - const std::string name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().Name(&error); - - if (error == Firebolt::Error::None) { - cout << "Get DeviceName = " << name.c_str() << endl; - } else { - cout << "Get DeviceName status = " << static_cast(error) << endl; - } -} - -void ManageSDKTestGeneratedCode::SetDeviceName() -{ - Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().DeviceInterface().SetName("Hello", &error); - - if (error == Firebolt::Error::None) { - cout << "Set DeviceName is success" << endl; - } else { - cout << "Set DeviceName status = " << static_cast(error) << endl; - } -} - diff --git a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.h b/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.h deleted file mode 100644 index 063c22bc1..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestGeneratedCode.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "error.h" - -class ManageSDKTestGeneratedCode { - -public: - ManageSDKTestGeneratedCode() = default; - virtual ~ManageSDKTestGeneratedCode() = default; - - static void CreateFireboltInstance(); - static void DestroyFireboltInstance(); - static void TestManageStaticSDK(); - static void GetDeviceName(); - static void SetDeviceName(); - static bool WaitOnConnectionReady(); - -private: - static void ConnectionChanged(const bool, const Firebolt::Error); - static bool _connected; -}; - diff --git a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.cpp b/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.cpp deleted file mode 100644 index 683054b37..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "Module.h" -#include "ManageSDKTestStaticCode.h" - -namespace FireboltSDK { - ManageTestStaticCode::ManageTestStaticCode() - : Tests() - { - _functionMap.emplace(std::piecewise_construct, std::forward_as_tuple("Get Country Code"), - std::forward_as_tuple(&GetCountryCode)); - } - - /* static */ Firebolt::Error ManageTestStaticCode::GetCountryCode() - { - const string method = _T("localization.countryCode"); - WPEFramework::Core::ProxyType response; - Firebolt::Error status = FireboltSDK::Properties::Get(method, response); - - EXPECT_EQ(status, Firebolt::Error::None); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(Logger::Category::Manage, Logger::Module(), "CountryCode : %s", response->Value().c_str()); - } else { - FIREBOLT_LOG_ERROR(Logger::Category::Manage, Logger::Module(), "Get %s status = %d\n", method.c_str(), status); - } - - return status; - } -} - diff --git a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.h b/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.h deleted file mode 100644 index 68daa106b..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/ManageSDKTestStaticCode.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once -#include - -namespace FireboltSDK { - class Policy : public WPEFramework::Core::JSON::Container { - public: - Policy(const Policy& copy) = delete; - Policy() - : WPEFramework::Core::JSON::Container() - , EnableRecommendations(false) - , ShareWatchHistory(false) - , RememberWatchedPrograms(false) - { - Add(_T("enableRecommendations"), &EnableRecommendations); - Add(_T("shareWatchHistory"), &ShareWatchHistory); - Add(_T("rememberWatchedPrograms"), &RememberWatchedPrograms); - } - Policy& operator=(const Policy& RHS) - { - EnableRecommendations = RHS.EnableRecommendations; - ShareWatchHistory = RHS.ShareWatchHistory; - RememberWatchedPrograms = RHS.RememberWatchedPrograms; - - return (*this); - } - - ~Policy() override = default; - - public: - WPEFramework::Core::JSON::Boolean EnableRecommendations; - WPEFramework::Core::JSON::Boolean ShareWatchHistory; - WPEFramework::Core::JSON::Boolean RememberWatchedPrograms; - }; - - class ManageTestStaticCode : public Tests { - - public: - ManageTestStaticCode(); - ~ManageTestStaticCode() override = default; - - static Firebolt::Error GetCountryCode(); - }; -} diff --git a/src/sdks/manage/src/cpp/sdk/test/Module.cpp b/src/sdks/manage/src/cpp/sdk/test/Module.cpp deleted file mode 100644 index d63badc4b..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/Module.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "Module.h" - -MODULE_NAME_DECLARATION(BUILD_REFERENCE) diff --git a/src/sdks/manage/src/cpp/sdk/test/Module.h b/src/sdks/manage/src/cpp/sdk/test/Module.h deleted file mode 100644 index bc4aee5e1..000000000 --- a/src/sdks/manage/src/cpp/sdk/test/Module.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2023 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#ifndef MODULE_NAME -#define MODULE_NAME OpenRPCManageTestApp -#endif - -#include - -#undef EXTERNAL -#define EXTERNAL diff --git a/src/sdks/manage/src/js/sdk/index.mjs b/src/sdks/manage/src/js/sdk/index.mjs deleted file mode 100644 index a9f2f5ca6..000000000 --- a/src/sdks/manage/src/js/sdk/index.mjs +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { setMockResponses } from './Transport/MockTransport.mjs' - -/* ${MOCK_IMPORTS} */ - -setMockResponses({ - /* ${MOCK_OBJECTS} */ -}) - -/* ${EXPORTS} */ -export { default as Log } from './Log/index.mjs' -export { default as Events } from './Events/index.mjs' -export { default as Settings } from './Settings/index.mjs' diff --git a/src/sdks/manage/test/suite/account.test.ts b/src/sdks/manage/test/suite/account.test.ts deleted file mode 100644 index 344ea275a..000000000 --- a/src/sdks/manage/test/suite/account.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { Account } from "../../build/javascript/src/firebolt-manage"; - -test("Account.session()", () => { - const expTime: number = new Date().getTime() + 100; - return Account.session("Test_Token", expTime).then((res: void) => { - expect(res).toEqual(null); - }); -}); - - -// Events Test cases - -// test("Account.listen() for requestSession event", () => { -// return Account.listen("requestSession", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Account.once() for requestSession event", () => { -// return Account.once("requestSession", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Account.clear()", () => { -// const result = Account.clear(2); -// expect(result).toBeFalsy(); -// }); diff --git a/src/sdks/manage/test/suite/acknowledgeChallenge.test.ts b/src/sdks/manage/test/suite/acknowledgeChallenge.test.ts deleted file mode 100644 index 50b180d0d..000000000 --- a/src/sdks/manage/test/suite/acknowledgeChallenge.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { AcknowledgeChallenge } from "../../build/javascript/src/firebolt-manage"; - -class ACKPovider implements AcknowledgeChallenge.ChallengeProvider { - challenge( - parameters: object, - session: AcknowledgeChallenge.FocusableProviderSession - ): Promise { - return Promise.resolve(null); - } -} - -test("AcknowledgeChallenge.provide() declarations", () => { - AcknowledgeChallenge.provide( - "xrn:firebolt:capability:usergrant:acknowledgechallenge", - new ACKPovider() - ); - expect(1).toBe(1); -}); - -test("AcknowledgeChallenge.provide() with blank object", () => { - expect(() => { - AcknowledgeChallenge.provide( - "xrn:firebolt:capability:usergrant:acknowledgechallenge", - {} - ); - }).toThrow(); -}); - -// Events Test cases - -// test("AcknowledgeChallenge.listen() for requestChallenge event", () => { -// return AcknowledgeChallenge.listen("requestChallenge", () => {}).then( -// (res: number) => { -// expect(res > 0).toBe(true); -// } -// ); -// }); - -// test("AcknowledgeChallenge.once() for requestChallenge event", () => { -// return AcknowledgeChallenge.once("requestChallenge", () => {}).then( -// (res: number) => { -// expect(res > 0).toBe(true); -// } -// ); -// }); - -// test("AcknowledgeChallenge.clear()", () => { -// const result = AcknowledgeChallenge.clear(2); -// expect(result).toBeFalsy(); -// }); diff --git a/src/sdks/manage/test/suite/closedCaptions.test.ts b/src/sdks/manage/test/suite/closedCaptions.test.ts deleted file mode 100644 index 90c15417f..000000000 --- a/src/sdks/manage/test/suite/closedCaptions.test.ts +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { ClosedCaptions } from "../../build/javascript/src/firebolt-manage"; - -test("ClosedCaptions.enabled()", () => { - return ClosedCaptions.enabled().then((res: boolean) => { - expect(res).toBe(true); - }); -}); - -test("ClosedCaptions.fontFamily()", () => { - return ClosedCaptions.fontFamily().then((res: string) => { - expect(res).toEqual("monospaced_sanserif"); - }); -}); - -test("ClosedCaptions.fontSize()", () => { - return ClosedCaptions.fontSize().then((res: number) => { - expect(res).toBe(1); - }); -}); - -test("ClosedCaptions.fontColor()", () => { - return ClosedCaptions.fontColor().then((res: string) => { - expect(res).toEqual("#ffffff"); - }); -}); - -test("ClosedCaptions.fontEdge()", () => { - return ClosedCaptions.fontEdge().then((res: string) => { - expect(res).toEqual("none"); - }); -}); - -test("ClosedCaptions.fontEdgeColor()", () => { - return ClosedCaptions.fontEdgeColor().then((res: string) => { - expect(res).toEqual("#000000"); - }); -}); - -test("ClosedCaptions.fontOpacity()", () => { - return ClosedCaptions.fontOpacity().then((res: number) => { - expect(res).toBe(99); - }); -}); - -test("ClosedCaptions.backgroundColor()", () => { - return ClosedCaptions.backgroundColor().then((res: string) => { - expect(res).toEqual("#000000"); - }); -}); - -test("ClosedCaptions.backgroundOpacity()", () => { - return ClosedCaptions.backgroundOpacity().then((res: number) => { - expect(res).toBe(99); - }); -}); - -test("ClosedCaptions.textAlign()", () => { - return ClosedCaptions.textAlign().then((res: string) => { - expect(res).toEqual("center"); - }); -}); - -test("ClosedCaptions.textAlignVertical()", () => { - return ClosedCaptions.textAlignVertical().then((res: string) => { - expect(res).toEqual("middle"); - }); -}); - -test("ClosedCaptions.listen()", () => { - return ClosedCaptions.listen("fontColorChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("ClosedCaptions.once()", () => { - return ClosedCaptions.once("fontColorChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("clear", () => { - const result = ClosedCaptions.clear(-1000); - expect(result).toBeFalsy(); -}); - -test("ClosedCaptions.setFontColor() with null", async () => { - const oldValue = await ClosedCaptions.fontColor() - return ClosedCaptions.fontColor(null).then(async (res: null) => { - expect(res).toBe(null); - const newValue = await ClosedCaptions.fontColor() - expect(newValue).toBe(null) - }); -}); - -test("ClosedCaptions.setFontColor() with ffffff", () => { - return ClosedCaptions.fontColor("#ffffff").then((res: null) => { - expect(res).toBe(null); - }); -}); diff --git a/src/sdks/manage/test/suite/device.test.ts b/src/sdks/manage/test/suite/device.test.ts deleted file mode 100644 index a3793547e..000000000 --- a/src/sdks/manage/test/suite/device.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { Device } from "../../build/javascript/src/firebolt-manage"; - -test("Device.name()", () => { - return Device.name(() => {}).then((res: number) => { - expect(res > 0).toBe(true); - }); -}); - -test("Device.provision()", () => { - return Device.provision("Test_Account_Id", "Test_Device_Id").then((res) => { - expect(res).toEqual(null); - }); -}); diff --git a/src/sdks/manage/test/suite/hdmi-input.test.ts b/src/sdks/manage/test/suite/hdmi-input.test.ts deleted file mode 100644 index dbf5f875a..000000000 --- a/src/sdks/manage/test/suite/hdmi-input.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { HDMIInput } from "../../build/javascript/src/firebolt-manage"; - -test("HDMIInput.ports()", () => { - return HDMIInput.ports().then((ports: HDMIInput.HDMIInputPort[]) => { - expect(ports[0].edidVersion).toBe(HDMIInput.EDIDVersion.V2_0) - }); -}); - -test("HDMIInput.port('HDMI1)", () => { - return HDMIInput.port('HDMI1').then((port: HDMIInput.HDMIInputPort) => { - expect(port.edidVersion).toBe(HDMIInput.EDIDVersion.V2_0) - }); -}); - -test("HDMIInput.edidVersion()", () => { - return HDMIInput.edidVersion('HDMI1').then((version: HDMIInput.EDIDVersion) => { - expect(version).toBe(HDMIInput.EDIDVersion.V2_0) - }) -}) - -test("HDMIInput.onConnectionChanged()", () => { - return HDMIInput.listen('connectionChanged', (info: HDMIInput.ConnectionChangedInfo) => { - }).then( (id: number) => { - expect(typeof id).toBe('number') - }) -}) - -test("HDMIInput.onSignalChanged()", () => { - return HDMIInput.listen('signalChanged', (info: HDMIInput.SignalChangedInfo) => { - }).then( (id: number) => { - expect(typeof id).toBe('number') - }) -}) - -test("HDMIInput.autoLowLatencyModeCapable('HDMI1)", () => { - return HDMIInput.autoLowLatencyModeCapable('HDMI1').then((capable: boolean) => { - expect(capable).toBe(true) - }) -}) - -test("HDMIInput.autoLowLatencyModeCapable() subscriber", () => { - return HDMIInput.autoLowLatencyModeCapable((info: HDMIInput.AutoLowLatencyModeCapableChangedInfo) => { - }).then((id: number) => { - expect(typeof id).toBe('number') - }) -}) diff --git a/src/sdks/manage/test/suite/keyboard.test.ts b/src/sdks/manage/test/suite/keyboard.test.ts deleted file mode 100644 index 6ee3a5aed..000000000 --- a/src/sdks/manage/test/suite/keyboard.test.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect, beforeAll } from "@jest/globals"; -import { Keyboard, Settings } from "../../build/javascript/src/firebolt-manage"; - -const state = { - cb: null, - eventId: null, - pending: [] -} - -class MockProviderBroker { - - constructor() { - } - - send(msg) { - let parsed = JSON.parse(msg) - if (parsed.method === 'keyboard.onRequestStandard') { - state.eventId = parsed.id - } - if ((parsed.method === 'keyboard.standardResponse') || (parsed.method === 'keyboard.standardError')) { - let pending = state.pending.find(p => p.correlationId === parsed.params.correlationId) - state.pending = state.pending.filter(p => p.correlationId === parsed.params.correlationId) - if (pending) { - pending.callback(parsed) - } - } - } - - receive(callback) { - state.cb = callback - } - - async triggerProvider(msg, providerCallback) { - let fullMsg = { - jsonrpc: '2.0', - id: state.eventId, - result: { - correlationId: '' + Math.round((Math.random() * 1000000)), - parameters: msg - } - } - state.pending.push({ - correlationId: fullMsg.result.correlationId, - callback: providerCallback - }) - state.cb(JSON.stringify(fullMsg)) - } -} -const broker = new MockProviderBroker() -let provider = null - -beforeAll(async () => { - Settings.setLogLevel('DEBUG') - window['__firebolt'].setTransportLayer(new MockProviderBroker()) - provider = new DelegatingKBProvider(new KBProvider()) - await Keyboard.provide("xrn:firebolt:capability:input:keyboard", provider); -}) - -class DelegatingKBProvider implements Keyboard.KeyboardInputProvider { - delegate: Keyboard.KeyboardInputProvider; - constructor(delegate: Keyboard.KeyboardInputProvider) { - this.delegate = delegate; - } - standard( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return this.delegate.standard(parameters, session) - } - password( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return this.delegate.password(parameters, session) - } - email( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return this.delegate.email(parameters, session) - } -} - -class KBProvider implements Keyboard.KeyboardInputProvider { - standard( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return Promise.resolve('foo'); - } - password( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return Promise.resolve(null); - } - email( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - return Promise.resolve(null); - } -} - -class KBProviderWithError implements Keyboard.KeyboardInputProvider { - async standard( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - throw new Error('failed') - } - async password( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - throw new Error('failed') - } - async email( - parameters: Keyboard.KeyboardParameters, - session: Keyboard.FocusableProviderSession - ): Promise { - throw new Error('failed') - } -} - -test("Keyboard.provide() declarations", async () => { - let callback = null; - let promise: Promise = new Promise((resolve, reject) => { - callback = resolve - }) - provider.delegate = new KBProvider() - await broker.triggerProvider({ - message: 'Enter name', - type: 'standard' - }, callback) - let result = await promise - console.log(result) - expect(result.method).toStrictEqual('keyboard.standardResponse') - expect(result.params.result).toStrictEqual('foo') -}); - -test("Keyboard.provide() with blank object", () => { - expect(() => { - Keyboard.provide("xrn:firebolt:capability:input:keyboard", {}); - }).toThrow(); -}); - -test("Keyboard.provide() with error response", async () => { - let callback = null; - let promise: Promise = new Promise((resolve, reject) => { - callback = resolve - }) - provider.delegate = new KBProviderWithError() - await broker.triggerProvider({ - message: 'Enter name', - type: 'standard' - }, callback) - let result = await promise - console.log(result) - expect(result.method).toStrictEqual('keyboard.standardError') - expect(result.params.error.message).toStrictEqual('failed') - expect(result.params.error.code).toStrictEqual(1000) -}); - -// Events Test cases - -// test("Keyboard.listen() for requestEmail event", () => { -// return Keyboard.listen("requestEmail", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.once() for requestEmail event", () => { -// return Keyboard.once("requestEmail", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.listen() for requestPassword event", () => { -// return Keyboard.listen("requestPassword", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.once() for requestPassword event", () => { -// return Keyboard.once("requestPassword", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.listen() for requestStandard event", () => { -// return Keyboard.listen("requestStandard", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.once() for requestStandard event", () => { -// return Keyboard.once("requestStandard", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("Keyboard.clear()", () => { -// const result = Keyboard.clear(2); -// expect(result).toBeFalsy(); -// }); diff --git a/src/sdks/manage/test/suite/localization.test.ts b/src/sdks/manage/test/suite/localization.test.ts deleted file mode 100644 index ad6fa091e..000000000 --- a/src/sdks/manage/test/suite/localization.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { Localization } from "../../build/javascript/src/firebolt-manage"; - -test("Localization.locality()", () => { - return Localization.locality().then((res: string) => { - expect(res).toBe("Philadelphia"); - }); -}); - -test("Localization.countryCode()", () => { - return Localization.countryCode().then((res: string) => { - expect(res).toBe("US"); - }); -}); - -test("Localization.language()", () => { - return Localization.language().then((res: string) => { - expect(res).toBe("en"); - }); -}); - -test("Localization.locale()", () => { - return Localization.locale().then((res: string) => { - expect(res).toBe("en-US"); - }); -}); - -test("Localization.locale()", () => { - return Localization.locale().then((res: string) => { - expect(res).toBe("en-US"); - }); -}); - -test("Localization.listen()", () => { - return Localization.listen("localityChanged", () => {}).then( - (res: Number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("Localization.once()", () => { - return Localization.once("localityChanged", () => {}).then((res: Number) => { - expect(res > 0).toBe(true); - }); -}); - -test("Localization.clear()", () => { - const result = Localization.clear(-1000); - expect(result).toBeFalsy(); -}); - -test("Device.postalCode()", () => { - return Localization.postalCode().then((res: string) => { - expect(res).toEqual("19103"); - }); -}); diff --git a/src/sdks/manage/test/suite/pinChallenge.test.ts b/src/sdks/manage/test/suite/pinChallenge.test.ts deleted file mode 100644 index 2612cfa5d..000000000 --- a/src/sdks/manage/test/suite/pinChallenge.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { PinChallenge } from "../../build/javascript/src/firebolt-manage"; - -class PCProvider implements PinChallenge.ChallengeProvider { - challenge( - parameters: object, - session: PinChallenge.FocusableProviderSession - ): Promise { - return Promise.resolve(null); - } -} - -test("PinChallenge.provide() declarations", () => { - PinChallenge.provide( - "xrn:firebolt:capability:usergrant:pinchallenge", - new PCProvider() - ); - expect(1).toBe(1); -}); - -test("PinChallenge.provide() with blank object", () => { - expect(() => { - PinChallenge.provide("xrn:firebolt:capability:usergrant:pinchallenge", {}); - }).toThrow(); -}); - -// Events Test cases - -// test("PinChallenge.listen() for requestChallenge event", () => { -// return PinChallenge.listen("requestChallenge", () => {}).then( -// (res: number) => { -// expect(res > 0).toBe(true); -// } -// ); -// }); - -// test("PinChallenge.once() for requestChallenge event", () => { -// return PinChallenge.once("requestChallenge", () => {}).then((res: number) => { -// expect(res > 0).toBe(true); -// }); -// }); - -// test("PinChallenge.clear()", () => { -// const result = PinChallenge.clear(2); -// expect(result).toBeFalsy(); -// }); diff --git a/src/sdks/manage/test/suite/privacy.test.ts b/src/sdks/manage/test/suite/privacy.test.ts deleted file mode 100644 index 7e9b86fa4..000000000 --- a/src/sdks/manage/test/suite/privacy.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { test, expect } from "@jest/globals"; -import { Privacy } from "../../build/javascript/src/firebolt-manage"; - -let listenerId: number; - -test("privacy.allowResumePoints()", () => { - return Privacy.allowResumePoints().then((res: boolean) => { - // TODO: fix - expect(true).toBe(true); - }); -}); - -test("privacy.listen() for allowPersonalizationChanged event", () => { - Privacy.once; - return Privacy.listen("allowPersonalizationChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.once() for allowPersonalizationChanged event", () => { - Privacy.once; - return Privacy.once("allowPersonalizationChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.listen() for allowWatchHistoryChanged event", () => { - Privacy.once; - return Privacy.listen("allowWatchHistoryChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.once() for allowWatchHistoryChanged event", () => { - Privacy.once; - return Privacy.once("allowWatchHistoryChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.listen() for allowAppContentAdTargetingChanged event", () => { - Privacy.once; - return Privacy.listen("allowAppContentAdTargetingChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.once() for allowAppContentAdTargetingChanged event", () => { - Privacy.once; - return Privacy.once("allowAppContentAdTargetingChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("privacy.clear()", () => { - const result = Privacy.clear(-1000); - expect(result).toBeFalsy(); -}); diff --git a/src/sdks/manage/test/suite/voiceGuidance.test.ts b/src/sdks/manage/test/suite/voiceGuidance.test.ts deleted file mode 100644 index 7c3b9a5c5..000000000 --- a/src/sdks/manage/test/suite/voiceGuidance.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { VoiceGuidance } from "../../build/javascript/src/firebolt-manage"; - -test("VoiceGuidance.enabled()", () => { - return VoiceGuidance.enabled().then((res) => { - expect(res).toEqual(true); - }); -}); - -test("VoiceGuidance.speed()", () => { - return VoiceGuidance.speed().then((res: number) => { - expect(res > 0).toBe(true); - }); -}); - -test("VoiceGuidance.listen() for enabledChanged event", () => { - return VoiceGuidance.listen("enabledChanged", () => {}).then( - (res: number) => { - expect(res > 0).toBe(true); - } - ); -}); - -test("VoiceGuidance.once() for enabledChanged event", () => { - return VoiceGuidance.once("enabledChanged", () => {}).then((res: number) => { - expect(res > 0).toBe(true); - }); -}); - -test("VoiceGuidance.listen() for speedChanged event", () => { - return VoiceGuidance.listen("speedChanged", () => {}).then((res: number) => { - expect(res > 0).toBe(true); - }); -}); - -test("VoiceGuidance.once() for speedChanged event", () => { - return VoiceGuidance.once("speedChanged", () => {}).then((res: number) => { - expect(res > 0).toBe(true); - }); -}); - -test("VoiceGuidance.clear()", () => { - const result = VoiceGuidance.clear(-1000); - expect(result).toBeFalsy(); -}); diff --git a/src/sdks/manage/test/suite/wifi.test.ts b/src/sdks/manage/test/suite/wifi.test.ts deleted file mode 100644 index fbb1d967b..000000000 --- a/src/sdks/manage/test/suite/wifi.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2021 Comcast Cable Communications Management, LLC - * - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -import { test, expect } from "@jest/globals"; -import { Wifi } from "../../build/javascript/src/firebolt-manage"; - -test("wifi.scan()", () => { - return Wifi.scan().then((res: Wifi.AccessPointList) => { - expect(res).toEqual({ - list: [ - { - frequency: 2.4, - security: "wpa2Psk", - signalStrength: -70, - ssid: "DND", - }, - { - frequency: 5, - security: "WPA2_ENTERPRISE_AES", - signalStrength: -70, - ssid: "Fortnite", - }, - { - frequency: 2.4, - security: "none", - signalStrength: -70, - ssid: "Guardian", - }, - ], - }); - }); -}); - -test("Wifi.connect()", () => { - return Wifi.connect().then((res: Wifi.AccessPoint) => { - expect(res).toEqual({ - frequency: 2.4, - security: "wpa2Psk", - signalStrength: -70, - ssid: "DND", - }); - }); -}); - -test("Wifi.disconnect()", () => { - return Wifi.disconnect().then((res) => { - expect(res).toEqual(null); - }); -}); - -test("Wifi.wps()", () => { - return Wifi.wps().then((res: Wifi.AccessPoint) => { - expect(res).toEqual({ - frequency: 2.4, - security: "wpa2Psk", - signalStrength: -70, - ssid: "DND", - }); - }); -}); diff --git a/src/sdks/manage/tsconfig.json b/src/sdks/manage/tsconfig.json deleted file mode 100644 index 56ff58bc8..000000000 --- a/src/sdks/manage/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "include": [ - "test/suite/*" - ] -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 014e7a98a..e703c4918 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,5 @@ { "include": [ - "src/sdks/core/test/suite/*", - "src/sdks/manage/test/suite/*", - "src/sdks/discovery/test/suite/*" + "src/sdks/core/test/suite/*" ] } \ No newline at end of file