From 284b207495fade0a505e7e1d8271df930b8cdfd6 Mon Sep 17 00:00:00 2001 From: parag-pv Date: Wed, 16 Oct 2024 11:36:06 -0400 Subject: [PATCH 1/3] Fix: Native SDK Core Unit Tests (Part I, II, Events) (#333) * test(core): Unit test setup * test(core): Accessibility module unit tests * test(core): Account module unit tests * test(core): Advertising module unit tests * test(core): Authentication module unit tests * test(core): Capabilities module unit tests * test(core): Device module unit tests * test(core): Lifecycle module unit tests * test(core): Metrics module unit tests * test(core): Parameters module unit tests * test(core): Profile module unit tests * Correct unit tests that were not compiling correctly * test(core): Localization unit tests * Native SDK events unit tests initial commit * Adding event tests for voiceGuidance and audioDescriptions * test(core): Keyboard unit tests * test(core): Discovery unit tests * test(core): Update parameters.initialization * test(core): Additional Lifecycle unit test * Comment changes * test(core): SecureStorage unit tests * test(core): SecondScreen unit tests --------- Co-authored-by: AdityaKasar Co-authored-by: Keaton Sentak --- .../core/src/cpp/sdk/cpptest/CMakeLists.txt | 39 ++- src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp | 10 + .../sdk/cpptest/unit/accessibilityTest.cpp | 314 ++++++++++++++++++ .../src/cpp/sdk/cpptest/unit/accountTest.cpp | 38 +++ .../cpp/sdk/cpptest/unit/advertisingTest.cpp | 107 ++++++ .../sdk/cpptest/unit/authenticationTest.cpp | 61 ++++ .../cpp/sdk/cpptest/unit/capabilitiesTest.cpp | 149 +++++++++ .../src/cpp/sdk/cpptest/unit/deviceTest.cpp | 268 +++++++++++++++ .../cpp/sdk/cpptest/unit/discoveryTest.cpp | 204 ++++++++++++ .../src/cpp/sdk/cpptest/unit/keyboardTest.cpp | 62 ++++ .../cpp/sdk/cpptest/unit/lifecycleTest.cpp | 39 +++ .../cpp/sdk/cpptest/unit/localizationTest.cpp | 133 ++++++++ .../src/cpp/sdk/cpptest/unit/metricsTest.cpp | 204 ++++++++++++ .../cpp/sdk/cpptest/unit/parametersTest.cpp | 41 +++ .../src/cpp/sdk/cpptest/unit/profileTest.cpp | 52 +++ .../cpp/sdk/cpptest/unit/secondscreenTest.cpp | 58 ++++ .../sdk/cpptest/unit/securestorageTest.cpp | 61 ++++ src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h | 5 + 18 files changed, 1840 insertions(+), 5 deletions(-) create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/accessibilityTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/accountTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/advertisingTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/authenticationTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/capabilitiesTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/deviceTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/discoveryTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/keyboardTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/lifecycleTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/localizationTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/metricsTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/parametersTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/profileTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/secondscreenTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/securestorageTest.cpp create mode 100644 src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt index c542cf6cc..4b1b6a8f6 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt +++ b/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt @@ -39,8 +39,6 @@ endif () find_package(WPEFramework CONFIG REQUIRED) find_package(${NAMESPACE}Core CONFIG REQUIRED) -find_package(Firebolt CONFIG REQUIRED) -find_package(${FIREBOLT_NAMESPACE}SDK CONFIG REQUIRED) set(TESTAPP TestFireboltCore) @@ -52,13 +50,13 @@ 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) @@ -79,3 +77,34 @@ add_custom_command( 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 FireboltCoreUnitTests) + + message("Setup ${UNIT_TESTS_APP}") + + file(GLOB UNIT_TESTS "unit/*") + + add_executable(${UNIT_TESTS_APP} + CoreSDKTest.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 + $ + ) + + include(GoogleTest) + gtest_discover_tests(${UNIT_TESTS_APP}) +endif() diff --git a/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp b/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp new file mode 100644 index 000000000..acf72128c --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp @@ -0,0 +1,10 @@ +#include "gtest/gtest.h" +#include "CoreSDKTest.h" + +int main(int argc, char **argv) +{ + std::string url = "ws://localhost:9998"; + CoreSDKTest::CreateFireboltInstance(url); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/accessibilityTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/accessibilityTest.cpp new file mode 100644 index 000000000..09a6efc58 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/accessibilityTest.cpp @@ -0,0 +1,314 @@ +#include "unit.h" + +class AccessibilityTest : 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 fontFamilyToString(Firebolt::Accessibility::FontFamily fontFamily) + { + std::string str = ""; + switch (fontFamily) + { + case Firebolt::Accessibility::FontFamily::MONOSPACED_SERIF: + str = "monospaced_serif"; + break; + case Firebolt::Accessibility::FontFamily::PROPORTIONAL_SERIF: + str = "proportional_serif"; + break; + case Firebolt::Accessibility::FontFamily::MONOSPACED_SANSERIF: + str = "monospaced_sanserif"; + break; + case Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF: + str = "proportional_sanserif"; + break; + case Firebolt::Accessibility::FontFamily::SMALLCAPS: + str = "smallcaps"; + break; + case Firebolt::Accessibility::FontFamily::CURSIVE: + str = "cursive"; + break; + case Firebolt::Accessibility::FontFamily::CASUAL: + str = "casual"; + break; + default: + str = "unknown"; + } + return str; + } + + std::string fontEdgeToString(Firebolt::Accessibility::FontEdge fontEdge) + { + std::string str = ""; + switch (fontEdge) + { + case Firebolt::Accessibility::FontEdge::NONE: + str = "none"; + break; + case Firebolt::Accessibility::FontEdge::RAISED: + str = "raised"; + break; + case Firebolt::Accessibility::FontEdge::DEPRESSED: + str = "depressed"; + break; + case Firebolt::Accessibility::FontEdge::UNIFORM: + str = "uniform"; + break; + case Firebolt::Accessibility::FontEdge::DROP_SHADOW_LEFT: + str = "drop_shadow_left"; + break; + case Firebolt::Accessibility::FontEdge::DROP_SHADOW_RIGHT: + str = "drop_shadow_right"; + break; + default: + str = "unknown"; + } + return str; + } +}; + +TEST_F(AccessibilityTest, ClosedCaptions) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Accessibility.closedCaptions")); + + Firebolt::Accessibility::ClosedCaptionsSettings closedCaptions = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().closedCaptions(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve closedCaptions from Accessibility.closedCaptions() method"; + EXPECT_EQ(closedCaptions.enabled, expectedValues["enabled"]); + + if (closedCaptions.styles.has_value()) { + const auto& styles = closedCaptions.styles.value(); + + if (styles.backgroundColor.has_value()) + EXPECT_EQ(styles.backgroundColor.value(), expectedValues["styles"]["backgroundColor"]); + + if (styles.backgroundOpacity.has_value()) + EXPECT_EQ(styles.backgroundOpacity.value(), expectedValues["styles"]["backgroundOpacity"]); + + if (styles.fontColor.has_value()) + EXPECT_EQ(styles.fontColor.value(), expectedValues["styles"]["fontColor"]); + + if (styles.fontEdge.has_value()) + EXPECT_EQ(fontEdgeToString(styles.fontEdge.value()), expectedValues["styles"]["fontEdge"]); + + if (styles.fontEdgeColor.has_value()) + EXPECT_EQ(styles.fontEdgeColor.value(), expectedValues["styles"]["fontEdgeColor"]); + + if (styles.fontFamily.has_value()) + EXPECT_EQ(fontFamilyToString(styles.fontFamily.value()), expectedValues["styles"]["fontFamily"]); + + if (styles.fontOpacity.has_value()) + EXPECT_EQ(styles.fontOpacity.value(), expectedValues["styles"]["fontOpacity"]); + + if (styles.fontSize.has_value()) + EXPECT_EQ(styles.fontSize.value(), expectedValues["styles"]["fontSize"]); + + if (styles.textAlign.has_value()) + EXPECT_EQ(styles.textAlign.value(), expectedValues["styles"]["textAlign"]); + + if (styles.textAlignVertical.has_value()) + EXPECT_EQ(styles.textAlignVertical.value(), expectedValues["styles"]["textAlignVertical"]); + + if (styles.windowColor.has_value()) + EXPECT_EQ(styles.windowColor.value(), expectedValues["styles"]["windowColor"]); + + if (styles.windowOpacity.has_value()) + EXPECT_EQ(styles.windowOpacity.value(), expectedValues["styles"]["windowOpacity"]); + } + + EXPECT_EQ(closedCaptions.preferredLanguages.value()[0], expectedValues["preferredLanguages"][0]); + EXPECT_EQ(closedCaptions.preferredLanguages.value()[1], expectedValues["preferredLanguages"][1]); +} + +TEST_F(AccessibilityTest, ClosedCaptionsSettings) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Accessibility.closedCaptionsSettings")); + + Firebolt::Accessibility::ClosedCaptionsSettings closedCaptionSettings = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().closedCaptionsSettings(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve closedCaptionSettings from Accessibility.closedCaptionSettings() method"; + EXPECT_EQ(closedCaptionSettings.enabled, expectedValues["enabled"]); + + if (closedCaptionSettings.styles.has_value()) { + const auto& styles = closedCaptionSettings.styles.value(); + + if (styles.backgroundColor.has_value()) + EXPECT_EQ(styles.backgroundColor.value(), expectedValues["styles"]["backgroundColor"]); + + if (styles.backgroundOpacity.has_value()) + EXPECT_EQ(styles.backgroundOpacity.value(), expectedValues["styles"]["backgroundOpacity"]); + + if (styles.fontColor.has_value()) + EXPECT_EQ(styles.fontColor.value(), expectedValues["styles"]["fontColor"]); + + if (styles.fontEdge.has_value()) + EXPECT_EQ(fontEdgeToString(styles.fontEdge.value()), expectedValues["styles"]["fontEdge"]); + + if (styles.fontEdgeColor.has_value()) + EXPECT_EQ(styles.fontEdgeColor.value(), expectedValues["styles"]["fontEdgeColor"]); + + if (styles.fontFamily.has_value()) + EXPECT_EQ(fontFamilyToString(styles.fontFamily.value()), expectedValues["styles"]["fontFamily"]); + + if (styles.fontOpacity.has_value()) + EXPECT_EQ(styles.fontOpacity.value(), expectedValues["styles"]["fontOpacity"]); + + if (styles.fontSize.has_value()) + EXPECT_EQ(styles.fontSize.value(), expectedValues["styles"]["fontSize"]); + + if (styles.textAlign.has_value()) + EXPECT_EQ(styles.textAlign.value(), expectedValues["styles"]["textAlign"]); + + if (styles.textAlignVertical.has_value()) + EXPECT_EQ(styles.textAlignVertical.value(), expectedValues["styles"]["textAlignVertical"]); + + if (styles.windowColor.has_value()) + EXPECT_EQ(styles.windowColor.value(), expectedValues["styles"]["windowColor"]); + + if (styles.windowOpacity.has_value()) + EXPECT_EQ(styles.windowOpacity.value(), expectedValues["styles"]["windowOpacity"]); + } + + EXPECT_EQ(closedCaptionSettings.preferredLanguages.value()[0], expectedValues["preferredLanguages"][0]); + EXPECT_EQ(closedCaptionSettings.preferredLanguages.value()[1], expectedValues["preferredLanguages"][1]); +} + +TEST_F(AccessibilityTest, VoiceGuidance) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Accessibility.voiceGuidance")); + + auto voiceGuidance = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().voiceGuidance(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve voiceGuidance from Accessibility.voiceGuidance() method"; + + EXPECT_EQ(voiceGuidance.enabled, expectedValues["enabled"]); + EXPECT_EQ(voiceGuidance.speed, expectedValues["speed"]); +} + +TEST_F(AccessibilityTest, VoiceGuidanceSettings) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Accessibility.voiceGuidanceSettings")); + + auto voiceGuidanceSettings = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().voiceGuidanceSettings(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve voiceGuidanceSettings from Accessibility.voiceGuidanceSettings() method"; + + EXPECT_EQ(voiceGuidanceSettings.enabled, expectedValues["enabled"]); + EXPECT_EQ(voiceGuidanceSettings.speed, expectedValues["speed"]); +} + +TEST_F(AccessibilityTest, AudioDescriptionSettings) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Accessibility.audioDescriptionSettings")); + + auto audioDescriptionSettings = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().audioDescriptionSettings(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve audioDescriptionSettings from Accessibility.audioDescriptionSettings() method"; + + EXPECT_EQ(audioDescriptionSettings.enabled, expectedValues["enabled"]); +} + +struct ClosedCaptionsChange : public Firebolt::Accessibility::IAccessibility::IOnClosedCaptionsSettingsChangedNotification { + void onClosedCaptionsSettingsChanged(const Firebolt::Accessibility::ClosedCaptionsSettings&) override; +}; + +// Below function is for when the event trigger via setter is done +Firebolt::Accessibility::ClosedCaptionsSettings newSettings; +void ClosedCaptionsChange::onClosedCaptionsSettingsChanged(const Firebolt::Accessibility::ClosedCaptionsSettings& closedCaptionsSettings) +{ + std::cout << "ClosedCaptionsSettingsChanged event fired" << std::endl; + newSettings = closedCaptionsSettings; +} + +TEST_F(AccessibilityTest, subscribeOnClosedCaptionsSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + ClosedCaptionsChange closedCaptionsChange; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().subscribe(closedCaptionsChange, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); + /* Since there is no return value for event subscription, error would be the only validation for now. + Returning a mock event response from open rpc and validating it against expected values from open rpc might not be of value. + This comment is applicable to all event unit tests. + */ +} + +TEST_F(AccessibilityTest, unsubscribeOnClosedCaptionsSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + ClosedCaptionsChange closedCaptionsChange; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().unsubscribe(closedCaptionsChange, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); +} + +struct VoiceGuidanceSettings : public Firebolt::Accessibility::IAccessibility::IOnVoiceGuidanceSettingsChangedNotification { + void onVoiceGuidanceSettingsChanged(const Firebolt::Accessibility::VoiceGuidanceSettings&) override; +}; + +// Below function is for when the event trigger via setter is done +Firebolt::Accessibility::VoiceGuidanceSettings newVoiceGuidanceSettings; +void VoiceGuidanceSettings::onVoiceGuidanceSettingsChanged(const Firebolt::Accessibility::VoiceGuidanceSettings& voiceGuidanceSettings) +{ + std::cout << "VoiceGuidanceSettingsChanged event fired" << std::endl; + newVoiceGuidanceSettings = voiceGuidanceSettings; +} + +TEST_F(AccessibilityTest, subscribeOnVoiceGuidanceSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + VoiceGuidanceSettings voiceGuidanceSettings; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().subscribe(voiceGuidanceSettings, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); +} + +TEST_F(AccessibilityTest, unsubscribeOnVoiceGuidanceSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + VoiceGuidanceSettings voiceGuidanceSettings; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().unsubscribe(voiceGuidanceSettings, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); +} + +struct AudioDescriptionSettings : public Firebolt::Accessibility::IAccessibility::IOnAudioDescriptionSettingsChangedNotification { + void onAudioDescriptionSettingsChanged(const Firebolt::Accessibility::AudioDescriptionSettings&) override; +}; + +// Below function is for when the event trigger via setter is done +Firebolt::Accessibility::AudioDescriptionSettings newAudioDescriptionSettings; +void AudioDescriptionSettings::onAudioDescriptionSettingsChanged(const Firebolt::Accessibility::AudioDescriptionSettings& audioDescriptionSettings) +{ + std::cout << "AudioDescriptionSettingsChanged event fired" << std::endl; + newAudioDescriptionSettings = audioDescriptionSettings; +} + +TEST_F(AccessibilityTest, subscribeOnAudioDescriptionSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + AudioDescriptionSettings audioDescriptionSettings; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().subscribe(audioDescriptionSettings, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); +} + +TEST_F(AccessibilityTest, unsubscribeOnAudioDescriptionSettingsChanged) +{ + Firebolt::Error error = Firebolt::Error::None; + AudioDescriptionSettings audioDescriptionSettings; + Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().unsubscribe(audioDescriptionSettings, &error); + std::cout << " error: " << static_cast(error) << std::endl; + EXPECT_EQ(error, Firebolt::Error::None); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/accountTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/accountTest.cpp new file mode 100644 index 000000000..000c80bfa --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/accountTest.cpp @@ -0,0 +1,38 @@ +#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, Id) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Account.id")); + + std::string account_id = Firebolt::IFireboltAccessor::Instance().AccountInterface().id(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve account_id from Account.id() method"; + EXPECT_EQ(account_id, expectedValues); +} + +TEST_F(AccountTest, Uid) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Account.uid")); + + std::string account_uid = Firebolt::IFireboltAccessor::Instance().AccountInterface().uid(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve account_uid from Account.uid() method"; + EXPECT_EQ(account_uid, expectedValues); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/advertisingTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/advertisingTest.cpp new file mode 100644 index 000000000..4b4ab631b --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/advertisingTest.cpp @@ -0,0 +1,107 @@ +#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; + } + + std::string skipRestrictionToString(Firebolt::Advertising::SkipRestriction skipRestriction) + { + std::string str = ""; + switch (skipRestriction) + { + case Firebolt::Advertising::SkipRestriction::NONE: + str = "none"; + break; + case Firebolt::Advertising::SkipRestriction::ADS_UNWATCHED: + str = "adsUnwatched"; + break; + case Firebolt::Advertising::SkipRestriction::ADS_ALL: + str = "adsAll"; + break; + case Firebolt::Advertising::SkipRestriction::ALL: + str = "all"; + break; + default: + str = "unknown"; + } + return str; + } +}; + +TEST_F(AdvertisingTest, Config) +{ + std::string expectedValues = jsonEngine->get_value("Advertising.config"); + + Firebolt::Advertising::AdConfigurationOptions options; + std::string adFrameworkConfig = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().config(options, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve adFrameworkConfig from Advertising.config() method"; + EXPECT_EQ((nlohmann::json::parse(adFrameworkConfig)).dump(), expectedValues); +} + +TEST_F(AdvertisingTest, Policy) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Advertising.policy")); + + Firebolt::Advertising::AdPolicy adPolicy = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().policy(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve adPolicy from Advertising.policy() method"; + + if (adPolicy.limitAdTracking.has_value()) + EXPECT_EQ(adPolicy.limitAdTracking, expectedValues["limitAdTracking"]); + + if (adPolicy.skipRestriction.has_value()) + EXPECT_EQ(skipRestrictionToString(adPolicy.skipRestriction.value()), expectedValues["skipRestriction"]); +} + +// Helper function to convert JSON value to AdvertisingIdResultLmt enum +std::string lmtToString(Firebolt::Advertising::AdvertisingIdResultLmt lmt) { + return std::to_string(static_cast(lmt)); +} + +TEST_F(AdvertisingTest, Id) +{ + nlohmann::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Advertising.advertisingId")); + + std::optional options = std::nullopt; // Assuming options are not provided + + Firebolt::Advertising::AdvertisingIdResult actualValues = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().advertisingId(options, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve AdvertisingId from Advertising.advertisingId() method"; + + EXPECT_EQ(actualValues.ifa, expectedValues["ifa"]); + EXPECT_EQ(actualValues.ifa_type, expectedValues["ifa_type"]); + EXPECT_EQ(lmtToString(actualValues.lmt), expectedValues["lmt"]); +} + +TEST_F(AdvertisingTest, DeviceAttributes) +{ + std::string expectedValues = jsonEngine->get_value("Advertising.deviceAttributes"); + + std::string deviceAttributes = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().deviceAttributes(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve deviceAttributes from Advertising.deviceAttributes() method"; + EXPECT_EQ(deviceAttributes, expectedValues); +} + +TEST_F(AdvertisingTest, AppBundleId) +{ + auto actual_value = jsonEngine->get_value("Advertising.appBundleId"); + + auto appBundleId = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().appBundleId(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve appBundleId from Advertising.appBundleId() method"; + EXPECT_EQ(appBundleId, REMOVE_QUOTES(actual_value)); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/authenticationTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/authenticationTest.cpp new file mode 100644 index 000000000..cc16a5163 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/authenticationTest.cpp @@ -0,0 +1,61 @@ +#include "unit.h" + +class AuthenticationTest : 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(AuthenticationTest, Token) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Authentication.token")); + + Firebolt::Authentication::TokenType type = Firebolt::Authentication::TokenType::DEVICE; + std::optional options; + + auto token = Firebolt::IFireboltAccessor::Instance().AuthenticationInterface().token(type, options, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve token from Authentication.token() method"; + EXPECT_EQ(token.value, expectedValues["value"]); +} + +TEST_F(AuthenticationTest, Device) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Authentication.device")); + + std::string device = Firebolt::IFireboltAccessor::Instance().AuthenticationInterface().device(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve device from Authentication.device() method"; + EXPECT_EQ(device, expectedValues); +} + +TEST_F(AuthenticationTest, Session) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Authentication.session")); + + std::string session = Firebolt::IFireboltAccessor::Instance().AuthenticationInterface().session(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve session from Authentication.session() method"; + EXPECT_EQ(session, expectedValues); +} + +TEST_F(AuthenticationTest, Root) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Authentication.root")); + + std::string root = Firebolt::IFireboltAccessor::Instance().AuthenticationInterface().root(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve root from Authentication.root() method"; + EXPECT_EQ(root, expectedValues); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/capabilitiesTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/capabilitiesTest.cpp new file mode 100644 index 000000000..f29179771 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/capabilitiesTest.cpp @@ -0,0 +1,149 @@ +#include "unit.h" + +class CapabilitiesTest : 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(CapabilitiesTest, Supported) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Capabilities.supported")); + + std::string capability = "xrn:firebolt:capability:wifi:scan"; + + bool supported = Firebolt::IFireboltAccessor::Instance().CapabilitiesInterface().supported(capability, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve supported from Capabilities.supported() method"; + EXPECT_EQ(supported, expectedValues); +} + +TEST_F(CapabilitiesTest, Available) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Capabilities.available")); + + std::string capability = "xrn:firebolt:capability:token:device"; + + bool available = Firebolt::IFireboltAccessor::Instance().CapabilitiesInterface().available(capability, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve available from Capabilities.available() method"; + EXPECT_EQ(available, expectedValues); +} + +TEST_F(CapabilitiesTest, Permitted) +{ + nlohmann::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Capabilities.permitted")); + + std::string capability = "xrn:firebolt:capability:input:keyboard"; + + // Initialize options with a role + std::optional options; + options.emplace(); // Initialize the optional + options->role = Firebolt::Capabilities::Role::MANAGE; + + // Call the permitted function + bool permitted = Firebolt::IFireboltAccessor::Instance().CapabilitiesInterface().permitted(capability, options, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve permitted from Capabilities.permitted() method"; + EXPECT_EQ(permitted, expectedValues); +} + +TEST_F(CapabilitiesTest, Granted) +{ + nlohmann::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Capabilities.granted")); + std::string capability = "xrn:firebolt:capability:localization:postal-code"; + + std::optional options; + bool granted = Firebolt::IFireboltAccessor::Instance().CapabilitiesInterface().granted(capability, options, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve granted from Capabilities.granted() method"; + EXPECT_EQ(granted, expectedValues); +} + +TEST_F(CapabilitiesTest, Info) +{ + // Parse the expected values from the JSON + nlohmann::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Capabilities.info")); + + // Extract the expected result for the specific capability + nlohmann::json expectedValue; + for (const auto &item : expectedValues) + { + if (item["capability"] == "xrn:firebolt:capability:device:model") + { + expectedValue = item; + break; + } + } + // Define the capabilities to query + std::vector capabilities = { + "xrn:firebolt:capability:device:model"}; + + std::vector info = Firebolt::IFireboltAccessor::Instance().CapabilitiesInterface().info(capabilities, &error); + + // Ensure there's at least one result + ASSERT_FALSE(info.empty()); + + // Compare the first actual value with the expected value + Firebolt::Capabilities::CapabilityInfo actualValue = info[0]; + + // Compare each field + EXPECT_EQ(actualValue.capability, expectedValue["capability"].get()); + EXPECT_EQ(actualValue.supported, expectedValue["supported"].get()); + EXPECT_EQ(actualValue.available, expectedValue["available"].get()); + + if (expectedValue.contains("use")) + { + if (expectedValue["use"].contains("permitted")) + { + auto expectedPermitted = expectedValue["use"]["permitted"].is_null() ? std::optional{} : std::make_optional(expectedValue["use"]["permitted"].get()); + EXPECT_EQ(actualValue.use.permitted, expectedPermitted); + } + if (expectedValue["use"].contains("granted")) + { + auto expectedGranted = expectedValue["use"]["granted"].is_null() ? std::optional{} : std::make_optional(expectedValue["use"]["granted"].get()); + EXPECT_EQ(actualValue.use.granted, expectedGranted); + } + } + + if (expectedValue.contains("manage")) + { + if (expectedValue["manage"].contains("permitted")) + { + auto expectedPermitted = expectedValue["manage"]["permitted"].is_null() ? std::optional{} : std::make_optional(expectedValue["manage"]["permitted"].get()); + EXPECT_EQ(actualValue.manage.permitted, expectedPermitted); + } + if (expectedValue["manage"].contains("granted")) + { + auto expectedGranted = expectedValue["manage"]["granted"].is_null() ? std::optional{} : std::make_optional(expectedValue["manage"]["granted"].get()); + EXPECT_EQ(actualValue.manage.granted, expectedGranted); + } + } + + if (expectedValue.contains("provide")) + { + if (expectedValue["provide"].contains("permitted")) + { + auto expectedPermitted = expectedValue["provide"]["permitted"].is_null() ? std::optional{} : std::make_optional(expectedValue["provide"]["permitted"].get()); + EXPECT_EQ(actualValue.provide.permitted, expectedPermitted); + } + if (expectedValue["provide"].contains("granted")) + { + auto expectedGranted = expectedValue["provide"]["granted"].is_null() ? std::optional{} : std::make_optional(expectedValue["provide"]["granted"].get()); + EXPECT_EQ(actualValue.provide.granted, expectedGranted); + } + } + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve info from Capabilities.info() method"; +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/deviceTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/deviceTest.cpp new file mode 100644 index 000000000..85107fd33 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/deviceTest.cpp @@ -0,0 +1,268 @@ +#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, Id) +{ + + auto actual_value = jsonEngine->get_value("Device.id"); + + auto id = Firebolt::IFireboltAccessor::Instance().DeviceInterface().id(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve id from Device.id() method"; + EXPECT_EQ(id, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Distributor) +{ + + auto actual_value = jsonEngine->get_value("Device.distributor"); + + auto distributor = Firebolt::IFireboltAccessor::Instance().DeviceInterface().distributor(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve distributor from Device.distributor() method"; + EXPECT_EQ(distributor, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Platform) +{ + + auto actual_value = jsonEngine->get_value("Device.platform"); + + auto platform = Firebolt::IFireboltAccessor::Instance().DeviceInterface().platform(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve platform from Device.platform() method"; + EXPECT_EQ(platform, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Uid) +{ + + auto actual_value = jsonEngine->get_value("Device.uid"); + + auto uid = Firebolt::IFireboltAccessor::Instance().DeviceInterface().uid(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve uid from Device.uid() method"; + EXPECT_EQ(uid, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Type) +{ + + auto actual_value = jsonEngine->get_value("Device.type"); + + auto type = Firebolt::IFireboltAccessor::Instance().DeviceInterface().type(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve type from Device.type() method"; + EXPECT_EQ(type, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Model) +{ + + auto actual_value = jsonEngine->get_value("Device.model"); + + auto model = Firebolt::IFireboltAccessor::Instance().DeviceInterface().model(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve model from Device.model() method"; + EXPECT_EQ(model, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Sku) +{ + + auto actual_value = jsonEngine->get_value("Device.sku"); + + auto sku = Firebolt::IFireboltAccessor::Instance().DeviceInterface().sku(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve sku from Device.sku() method"; + EXPECT_EQ(sku, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, TestDeviceMake) +{ + + auto actual_value = jsonEngine->get_value("Device.make"); + + auto make = Firebolt::IFireboltAccessor::Instance().DeviceInterface().make(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve make from Device.make() method"; + EXPECT_EQ(make, REMOVE_QUOTES(actual_value)); +} + +TEST_F(DeviceTest, Hdcp) +{ + Firebolt::Error error = Firebolt::Error::None; + + // Parsing expected JSON values into a BooleanMap + nlohmann::json expectedJson = nlohmann::json::parse(jsonEngine->get_value("Device.hdcp")); + Firebolt::Types::BooleanMap expectedValues; + + for (auto it = expectedJson.begin(); it != expectedJson.end(); ++it) + { + expectedValues[it.key()] = it.value().get(); + } + + // Getting the actual value from the DeviceInterface + Firebolt::Device::HDCPVersionMap hdcpMap = Firebolt::IFireboltAccessor::Instance().DeviceInterface().hdcp(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve hdcp from Device.hdcp() method"; + + // Convert HDCPVersionMap to BooleanMap for comparison + Firebolt::Types::BooleanMap actualValues; + actualValues["hdcp1.4"] = hdcpMap.hdcp1_4; + actualValues["hdcp2.2"] = hdcpMap.hdcp2_2; + + EXPECT_EQ(actualValues, expectedValues); +} + +TEST_F(DeviceTest, Hdr) +{ + Firebolt::Error error = Firebolt::Error::None; + + // Parsing expected JSON values into a BooleanMap + nlohmann::json expectedJson = nlohmann::json::parse(jsonEngine->get_value("Device.hdr")); + Firebolt::Types::BooleanMap expectedValues; + + for (auto it = expectedJson.begin(); it != expectedJson.end(); ++it) + { + expectedValues[it.key()] = it.value().get(); + } + + // Getting the actual value from the DeviceInterface + Firebolt::Device::HDRFormatMap hdrMap = Firebolt::IFireboltAccessor::Instance().DeviceInterface().hdr(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve hdr from Device.hdr() method"; + + // Convert HDRFormatMap to BooleanMap for comparison + Firebolt::Types::BooleanMap actualValues; + actualValues["hdr10"] = hdrMap.hdr10; + actualValues["hdr10Plus"] = hdrMap.hdr10Plus; + actualValues["dolbyVision"] = hdrMap.dolbyVision; + actualValues["hlg"] = hdrMap.hlg; + + EXPECT_EQ(actualValues, expectedValues); +} + +TEST_F(DeviceTest, Audio) +{ + // Hardcoded expected values + Firebolt::Device::AudioProfiles expectedValues; + expectedValues.stereo = true; + expectedValues.dolbyDigital5_1 = true; + expectedValues.dolbyDigital5_1_plus = true; + expectedValues.dolbyAtmos = true; + + // Getting the actual value from the DeviceInterface + const Firebolt::Device::AudioProfiles audio = Firebolt::IFireboltAccessor::Instance().DeviceInterface().audio(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve audio from Device.audio() method"; + EXPECT_EQ(audio.stereo, expectedValues.stereo); + EXPECT_EQ(audio.dolbyDigital5_1, expectedValues.dolbyDigital5_1); + EXPECT_EQ(audio.dolbyDigital5_1_plus, expectedValues.dolbyDigital5_1_plus); + EXPECT_EQ(audio.dolbyAtmos, expectedValues.dolbyAtmos); +} + +TEST_F(DeviceTest, Network) +{ + + // Hardcoded expected values + Firebolt::Device::NetworkInfoResult expectedValues; + expectedValues.state = Firebolt::Device::NetworkState::CONNECTED; + expectedValues.type = Firebolt::Device::NetworkType::WIFI; + + // Getting the actual value from the DeviceInterface + Firebolt::Device::NetworkInfoResult network = Firebolt::IFireboltAccessor::Instance().DeviceInterface().network(&error); + + // Perform the assertions + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve network from Device.network() method"; + EXPECT_EQ(network.state, expectedValues.state); + EXPECT_EQ(network.type, expectedValues.type); +} + +TEST_F(DeviceTest, ScreenResolution) +{ + + // Parse expected JSON values + nlohmann::json expectedJson; + try + { + std::string jsonString = jsonEngine->get_value("Device.screenResolution"); + expectedJson = nlohmann::json::parse(jsonString); + } + catch (const nlohmann::json::exception &e) + { + FAIL() << "Failed to parse JSON: " << e.what(); + } + + // Validate that expectedJson is an array and has the required number of elements + if (!expectedJson.is_array()) + { + FAIL() << "Expected JSON is not an array: " << expectedJson.dump(4); + } + + // Getting the actual value from the DeviceInterface + Firebolt::Error error = Firebolt::Error::None; + std::string screenResolution = Firebolt::IFireboltAccessor::Instance().DeviceInterface().screenResolution(&error); + + // Perform the assertions + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve screenResolution from Device.screenResolution() method"; + EXPECT_EQ(screenResolution, expectedJson.get()); +} + +TEST_F(DeviceTest, VideoResolution) +{ + + // Parse expected JSON values + nlohmann::json expectedJson; + try + { + std::string jsonString = jsonEngine->get_value("Device.videoResolution"); + expectedJson = nlohmann::json::parse(jsonString); + } + catch (const nlohmann::json::exception &e) + { + FAIL() << "Failed to parse JSON: " << e.what(); + } + + // Validate that expectedJson is an array and has the required number of elements + if (!expectedJson.is_array()) + { + FAIL() << "Expected JSON is not an array: " << expectedJson.dump(4); + } + + + // Getting the actual value from the DeviceInterface + Firebolt::Error error = Firebolt::Error::None; + std::string videoResolution = Firebolt::IFireboltAccessor::Instance().DeviceInterface().videoResolution(&error); + + // Perform the assertions + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve videoResolution from Device.videoResolution() method"; + EXPECT_EQ(videoResolution, expectedJson.get()); +} + +TEST_F(DeviceTest, Name) +{ + + auto actual_value = jsonEngine->get_value("Device.name"); + + auto name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().name(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve name from Device.name() method"; + EXPECT_EQ(name, REMOVE_QUOTES(actual_value)); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/discoveryTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/discoveryTest.cpp new file mode 100644 index 000000000..6a1a55a94 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/discoveryTest.cpp @@ -0,0 +1,204 @@ +#include "unit.h" + +class DiscoveryTest : public ::testing::Test +{ +protected: + JsonEngine* jsonEngine; + Firebolt::Error error = Firebolt::Error::None; + + void SetUp() override + { + jsonEngine = new JsonEngine(); + } + + void TearDown() override + { + delete jsonEngine; + } + + // Helper function to mock EntityInfo + Firebolt::Entertainment::EntityInfo mockEntityInfo() + { + Firebolt::Entertainment::EntityInfo entityInfo; + entityInfo.identifiers.entityId = "345"; + entityInfo.title = "Cool Runnings"; + entityInfo.entityType = Firebolt::Entertainment::EntityInfoEntityType::PROGRAM; + entityInfo.programType = Firebolt::Entertainment::ProgramType::MOVIE; + entityInfo.synopsis = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar sapien et ligula ullamcorper malesuada proin libero nunc."; + entityInfo.releaseDate = "1993-01-01T00:00:00.000Z"; + + // Mock content ratings + Firebolt::Entertainment::ContentRating usRating; + usRating.scheme = Firebolt::Entertainment::ContentRatingScheme::US_MOVIE; + usRating.rating = "PG"; + + Firebolt::Entertainment::ContentRating caRating; + caRating.scheme = Firebolt::Entertainment::ContentRatingScheme::CA_MOVIE; + caRating.rating = "G"; + + entityInfo.contentRatings = std::vector{usRating, caRating}; + + // Mock ways to watch + Firebolt::Entertainment::WayToWatch wayToWatch; + wayToWatch.identifiers.assetId = "123"; + wayToWatch.expires = "2025-01-01T00:00:00.000Z"; + wayToWatch.entitled = true; + wayToWatch.entitledExpires = "2025-01-01T00:00:00.000Z"; + wayToWatch.offeringType = Firebolt::Entertainment::OfferingType::BUY; + wayToWatch.price = 2.99f; + + wayToWatch.videoQuality = std::vector{Firebolt::Entertainment::WayToWatchVideoQuality::UHD}; + wayToWatch.audioProfile = std::vector{Firebolt::Types::AudioProfile::DOLBY_ATMOS}; + wayToWatch.audioLanguages = std::vector{"en"}; + wayToWatch.closedCaptions = std::vector{"en"}; + wayToWatch.subtitles = std::vector{"es"}; + wayToWatch.audioDescriptions = std::vector{"en"}; + + entityInfo.waysToWatch = std::vector{wayToWatch}; + + return entityInfo; + } +}; + + +TEST_F(DiscoveryTest, Policy) +{ + Firebolt::Error error = Firebolt::Error::None; + + // Parsing expected JSON values into a BooleanMap + nlohmann::json_abi_v3_11_3::json expectedJson = nlohmann::json::parse(jsonEngine->get_value("Discovery.policy")); + Firebolt::Types::BooleanMap expectedValues; + + for (auto it = expectedJson.begin(); it != expectedJson.end(); ++it) + { + expectedValues[it.key()] = it.value().get(); + } + + // Getting the actual value + Firebolt::Discovery::DiscoveryPolicy policy = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().policy(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve policy from Discovery.policy() method"; + + // Convert DiscoveryPolicy to BooleanMap for comparison + Firebolt::Types::BooleanMap actualValues; + actualValues["enableRecommendations"] = policy.enableRecommendations; + actualValues["shareWatchHistory"] = policy.shareWatchHistory; + actualValues["rememberWatchedPrograms"] = policy.rememberWatchedPrograms; + + EXPECT_EQ(actualValues, expectedValues); +} + +TEST_F(DiscoveryTest, EntityInfo) +{ + Firebolt::Error error = Firebolt::Error::None; + nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("Discovery.entityInfo")); + + // Mock EntityInfoResult + Firebolt::Discovery::EntityInfoResult entityInfoResult; + entityInfoResult.expires = "2025-01-01T00:00:00.000Z"; + entityInfoResult.entity = mockEntityInfo(); + entityInfoResult.related = std::nullopt; + + bool actualValue = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().entityInfo(entityInfoResult, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Discovery.entityInfo() method"; + EXPECT_EQ(actualValue, expectedValue); +} + +TEST_F(DiscoveryTest, PurchasedContent) +{ + Firebolt::Error error = Firebolt::Error::None; + nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("Discovery.purchasedContent")); + + // Mock purchasedContentResult + Firebolt::Discovery::PurchasedContentResult purchasedContentResult; + purchasedContentResult.expires = "2025-01-01T00:00:00.000Z"; + purchasedContentResult.totalCount = 10; + purchasedContentResult.entries.push_back(mockEntityInfo()); + + bool actualValue = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().purchasedContent(purchasedContentResult, &error); + + EXPECT_EQ(actualValue, expectedValue); +} + +TEST_F(DiscoveryTest, WatchNext) +{ + Firebolt::Error error = Firebolt::Error::None; + nlohmann::json_abi_v3_11_3::json expectedJson = nlohmann::json::parse(jsonEngine->get_value("Discovery.watchNext")); + + std::string title = "A Fantastic Show"; + Firebolt::Entertainment::ContentIdentifiers contentIdentifiers; + contentIdentifiers.entityId = "partner.com/entity/456"; + + bool result = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().watchNext(title, contentIdentifiers, std::nullopt, std::nullopt, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve policy from Discovery.watchNext() method"; + EXPECT_EQ(result, expectedJson); +} + + +TEST_F(DiscoveryTest, Entitlements) +{ + Firebolt::Error error = Firebolt::Error::None; + nlohmann::json_abi_v3_11_3::json expectedJson = nlohmann::json::parse(jsonEngine->get_value("Discovery.entitlements")); + + std::vector mockEntitlements = { + {"entitlement1", "2023-01-01T00:00:00Z", "2023-12-31T23:59:59Z"}, + {"entitlement2", std::nullopt, "2023-12-31T23:59:59Z"}, + {"entitlement3", "2023-01-01T00:00:00Z", std::nullopt} + }; + bool success = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().entitlements(mockEntitlements, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve policy from Discovery.entitlements() method"; + EXPECT_EQ(success, expectedJson); +} + + +TEST_F(DiscoveryTest, ContentAccess) +{ + auto expectedValue = jsonEngine->get_value("Discovery.contentAccess"); + + std::vector mockAvailabilities = { + {Firebolt::Discovery::AvailabilityType::CHANNEL_LINEUP, "availability1", "catalog1", "2023-01-01T00:00:00Z", "2023-12-31T23:59:59Z"}, + {Firebolt::Discovery::AvailabilityType::PROGRAM_LINEUP, "availability2", std::nullopt, "2023-01-01T00:00:00Z", std::nullopt} + }; + + std::vector mockEntitlements = { + {"entitlement1", "2023-01-01T00:00:00Z", "2023-12-31T23:59:59Z"}, + {"entitlement2", std::nullopt, "2023-12-31T23:59:59Z"}, + {"entitlement3", "2023-01-01T00:00:00Z", std::nullopt} + }; + + Firebolt::Discovery::ContentAccessIdentifiers mockContentAccessIdentifiers = { + mockAvailabilities, + mockEntitlements + }; + + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().contentAccess(mockContentAccessIdentifiers, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call Discovery.contentAccess() method"; +} + +TEST_F(DiscoveryTest, ClearContentAccess) +{ + auto expectedValue = jsonEngine->get_value("Discovery.clearContentAccess"); + + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().clearContentAccess(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call Discovery.clearContentAccess() method"; +} + +TEST_F(DiscoveryTest, Launch) +{ + nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("Discovery.launch")); + + std::string appId = "123"; + Firebolt::Intents::LaunchIntent launchIntent; + launchIntent.action = "launch"; + launchIntent.context.source = "source"; + + bool actualValue = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().launch("appId", launchIntent, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call Discovery.launch() method"; + EXPECT_EQ(actualValue, expectedValue); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/keyboardTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/keyboardTest.cpp new file mode 100644 index 000000000..fad495cae --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/keyboardTest.cpp @@ -0,0 +1,62 @@ +#include "unit.h" + +class KeyboardTest : public ::testing::Test +{ +protected: + JsonEngine *jsonEngine; + Firebolt::Error error = Firebolt::Error::None; + + void SetUp() override + { + jsonEngine = new JsonEngine(); + } + + void TearDown() override + { + delete jsonEngine; + } + + struct KeyboardAsyncResponse : public Firebolt::Keyboard::IKeyboardAsyncResponse { + void response(const std::string& result, Firebolt::Error *err) override { + // Handle the response here + std::cout << "Response received: " << result << std::endl; + } + }; +}; + +TEST_F(KeyboardTest, Email) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Keyboard.email")); + + Firebolt::Keyboard::EmailUsage type = Firebolt::Keyboard::EmailUsage::SIGN_IN; + std::string message = "abc@123.com"; + KeyboardAsyncResponse responseHandler; + + Firebolt::IFireboltAccessor::Instance().KeyboardInterface().requestEmail(type, message, responseHandler, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call keyboard.email() method"; +} + +TEST_F(KeyboardTest, Password) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Keyboard.password")); + + std::string message = "abc123"; + KeyboardAsyncResponse responseHandler; + + Firebolt::IFireboltAccessor::Instance().KeyboardInterface().requestPassword(message, responseHandler, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call keyboard.password() method"; +} + +TEST_F(KeyboardTest, Standard) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Keyboard.standard")); + + std::string message = "hello world"; + KeyboardAsyncResponse responseHandler; + + Firebolt::IFireboltAccessor::Instance().KeyboardInterface().requestStandard(message, responseHandler, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to call keyboard.standard() method"; +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/lifecycleTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/lifecycleTest.cpp new file mode 100644 index 000000000..7eb35c6d6 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/lifecycleTest.cpp @@ -0,0 +1,39 @@ +#include "unit.h" + +class LifecycleTest : 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(LifecycleTest, Close) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Lifecycle.close")); + + Firebolt::IFireboltAccessor::Instance().LifecycleInterface().close(Firebolt::Lifecycle::CloseReason::USER_EXIT, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling Lifecycle.close() method"; +} + +// Lifecycle.ready method needs events to be supported in mock transport to work + +TEST_F(LifecycleTest, Finished) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Lifecycle.finished")); + + Firebolt::IFireboltAccessor::Instance().LifecycleInterface().finished(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Error on calling Lifecycle.background() method"; +} + diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/localizationTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/localizationTest.cpp new file mode 100644 index 000000000..523d070b4 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/localizationTest.cpp @@ -0,0 +1,133 @@ +#include "unit.h" +#include + +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, Locality) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.locality")); + + std::string locality = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().locality(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve locality from Localization.locality() method"; + EXPECT_EQ(locality, expectedValues); +} + +TEST_F(LocalizationTest, PostalCode) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.postalCode")); + + std::string postalCode = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().postalCode(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve postal_code from Localization.postalCode() method"; + EXPECT_EQ(postalCode, expectedValues); +} + +TEST_F(LocalizationTest, CountryCode) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.countryCode")); + + std::string countryCode = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().countryCode(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve country_code from Localization.countryCode() method"; + EXPECT_EQ(countryCode, expectedValues); +} + +TEST_F(LocalizationTest, Language) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.language")); + + std::string language = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().language(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve language from Localization.language() method"; + EXPECT_EQ(language, expectedValues); +} + +TEST_F(LocalizationTest, Locale) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.locale")); + + std::string locale = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().locale(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve locale from Localization.language() method"; + EXPECT_EQ(locale, expectedValues); +} + +TEST_F(LocalizationTest, PreferredAudioLanguages) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.preferredAudioLanguages")); + + std::vector preferredAudioLanguages = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().preferredAudioLanguages(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve preferred_audio_languages from Localization.preferredAudioLanguages() method"; + EXPECT_EQ(preferredAudioLanguages, expectedValues); +} + +TEST_F(LocalizationTest, AdditionalInfo) +{ + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Localization.additionalInfo")); + + Firebolt::Localization::Info additionalInfo = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().additionalInfo(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve additional_info from Localization.additionalInfo() method"; + EXPECT_EQ(additionalInfo, expectedValues); +} + +// Helper function to round a double to 4 decimal places +double roundTo4Decimals(double value) { + return std::round(value * 10000.0) / 10000.0; +} + +TEST_F(LocalizationTest, LatLon) +{ + nlohmann::json expectedJson; + try + { + std::string jsonString = jsonEngine->get_value("Localization.latlon"); + expectedJson = nlohmann::json::parse(jsonString); + } + catch (const nlohmann::json::exception &e) + { + FAIL() << "Failed to parse JSON: " << e.what(); + } + + // Validate that expectedJson is an array and has the required number of elements + if (!expectedJson.is_array()) + { + FAIL() << "Expected JSON is not an array: " << expectedJson.dump(4); + } + + if (expectedJson.size() != 2) + { + FAIL() << "Expected JSON array does not have 2 elements: " << expectedJson.dump(4); + } + + // Getting the actual value from the LocalizationInterface + Firebolt::Localization::LatLon latlon = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().latlon(&error); + + // Round the actual values to 4 decimal places + double roundedLat = roundTo4Decimals(latlon.first); + double roundedLon = roundTo4Decimals(latlon.second); + + // Convert actual value to JSON + nlohmann::json actualJson = {roundedLat, roundedLon}; + + // Perform the assertions + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve latlon from Localization.latlon() method"; + EXPECT_EQ(actualJson, expectedJson); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/metricsTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/metricsTest.cpp new file mode 100644 index 000000000..0f588a44c --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/metricsTest.cpp @@ -0,0 +1,204 @@ +#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, StartContent) +{ + + auto actual_value = jsonEngine->get_value("Metrics.startContent"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().startContent("example", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.startContent() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, StopContent) +{ + + auto actual_value = jsonEngine->get_value("Metrics.stopContent"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().stopContent("example", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.stopContent() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, Page) +{ + // Parse the expected values from the JSON + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Metrics.page")); + + std::string pageId = "xyz"; + + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().page(pageId, &error); + + // Compare the expected and actual results + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.page() method"; + EXPECT_EQ(status, expectedValues); +} + +TEST_F(MetricsTest, Action) +{ + // Parse the expected values from the JSON + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Metrics.action")); + std::cout << "Expected value for capability " << expectedValues << std::endl; + + Firebolt::Metrics::Category category = Firebolt::Metrics::Category::USER; + auto type = "The user did foo"; + std::optional parameters = std::nullopt; + + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().action(category, type, parameters, &error); + std::cout << "Status value for capability " << status << std::endl; + + // Compare the expected and actual results + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.action() method"; + EXPECT_EQ(status, expectedValues); +} + +TEST_F(MetricsTest, Error) +{ + // Parse the expected values from the JSON + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Metrics.error")); + std::cout << "Expected value for capability " << expectedValues << std::endl; + + Firebolt::Metrics::ErrorType type = Firebolt::Metrics::ErrorType::MEDIA; + std::string code = "MEDIA-STALLED"; + std::string description = "playback stalled"; + std::optional parameters = std::nullopt; + bool visible = true; + + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().error(type, code, description, visible, parameters, &error); + std::cout << "Status value for capability " << status << std::endl; + + // Compare the expected and actual results + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.error() method"; + EXPECT_EQ(status, expectedValues); +} + +TEST_F(MetricsTest, MediaLoadStart) +{ + auto actual_value = jsonEngine->get_value("Metrics.mediaLoadStart"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaLoadStart("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaLoadStart() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaPlay) +{ + auto actual_value = jsonEngine->get_value("Metrics.mediaPlay"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaPlay("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaPlay() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaPlaying) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaPlaying"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaPlaying("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaPlaying() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaPause) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaPause"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaPause("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaPause() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaWaiting) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaWaiting"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaWaiting("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaWaiting() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaProgress) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaProgress"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaProgress("345", "0.75", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaProgress() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaSeeking) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaSeeking"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaSeeking("345", "0.25", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaSeeking() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaSeeked) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaSeeked"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaSeeked("345", "0.51", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaSeeked() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaRateChange) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaRateChange"); + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaRateChange("345", 2, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaRateChange() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaRenditionChange) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaRenditionChange"); + std::optional profile = std::nullopt; + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaRenditionChange("345", 1080, 950, 1020, profile, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Metrics.mediaRenditionChange() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} + +TEST_F(MetricsTest, MediaEnded) +{ + std::string actual_value = jsonEngine->get_value("Metrics.mediaEnded"); + std::optional profile = std::nullopt; + + auto status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().mediaEnded("345", &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve account_uid from Metrics.mediaEnded() method"; + EXPECT_EQ(status, STRING_TO_BOOL(actual_value)); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/parametersTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/parametersTest.cpp new file mode 100644 index 000000000..2a29e5d91 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/parametersTest.cpp @@ -0,0 +1,41 @@ +#include "unit.h" + +class ParametersTest : 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(ParametersTest, Initialization) +{ + nlohmann::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Parameters.initialization")); + + Firebolt::Parameters::AppInitialization appInitialization = Firebolt::IFireboltAccessor::Instance().ParametersInterface().initialization(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve appInitialization from Parameters.initialization() method"; + EXPECT_EQ(appInitialization.us_privacy, expectedValues["us_privacy"]); + EXPECT_EQ(appInitialization.lmt, expectedValues["lmt"]); + + ASSERT_TRUE(appInitialization.discovery.has_value()); + ASSERT_TRUE(appInitialization.discovery.value().navigateTo.has_value()); + + // Deserialize the actual navigateTo value (double-deserialization to handle extra escaping) + std::string actualNavigateToStr = appInitialization.discovery.value().navigateTo.value(); + nlohmann::json actualNavigateToJson = nlohmann::json::parse(nlohmann::json::parse(actualNavigateToStr).get()); + + // Convert expectedValues["discovery"]["navigateTo"] to a serialized JSON string + nlohmann::json expectedNavigateTo = expectedValues["discovery"]["navigateTo"]; + + EXPECT_EQ(actualNavigateToJson, expectedNavigateTo); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/profileTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/profileTest.cpp new file mode 100644 index 000000000..7e5815612 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/profileTest.cpp @@ -0,0 +1,52 @@ +#include "unit.h" +#include "common/types.h" + +class ProfileTest : 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(ProfileTest, ApproveContentRating) +{ + + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approveContentRating")); + + bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approveContentRating(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approveContentRating() method"; + EXPECT_EQ(status, expectedValues); +} + +TEST_F(ProfileTest, ApprovePurchase) +{ + + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.approvePurchase")); + + bool status = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approvePurchase(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve status from Profile.approvePurchase() method"; + EXPECT_EQ(status, expectedValues); +} + +TEST_F(ProfileTest, Flags) +{ + + nlohmann::json_abi_v3_11_3::json expectedValues = nlohmann::json::parse(jsonEngine->get_value("Profile.flags")); + + Firebolt::Types::FlatMap flag = Firebolt::IFireboltAccessor::Instance().ProfileInterface().flags(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve flag from Profile.flags() method"; + EXPECT_EQ(flag["userExperience"], expectedValues["userExperience"]); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/secondscreenTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/secondscreenTest.cpp new file mode 100644 index 000000000..43c9377f2 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/secondscreenTest.cpp @@ -0,0 +1,58 @@ +#include "unit.h" + +class SecondScreenTest : 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(SecondScreenTest, FriendlyName) +{ + nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("SecondScreen.friendlyName")); + + auto actualValue = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().friendlyName(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve friendlyName from Secondscreen.friendlyName() method"; + EXPECT_EQ(actualValue, expectedValue); +} + +TEST_F(SecondScreenTest, Device) +{ + nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("SecondScreen.device")); + + auto actualValue = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().device(std::nullopt, &error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve device from Secondscreen.device() method"; + EXPECT_EQ(actualValue, expectedValue); +} + +TEST_F(SecondScreenTest, Protocols) +{ + std::string jsonString = jsonEngine->get_value("SecondScreen.protocols"); + + // Check if the JSON string is empty + ASSERT_FALSE(jsonString.empty()) << "JSON string for Secondscreen.protocols is empty"; + + nlohmann::json expectedValues; + try { + expectedValues = nlohmann::json::parse(jsonString); + } catch (const nlohmann::json::parse_error& e) { + FAIL() << "Failed to parse JSON string: " << e.what(); + } + + Firebolt::Types::BooleanMap actualValues = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().protocols(&error); + + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve protocols from Secondscreen.protocols() method"; + EXPECT_EQ(actualValues, expectedValues); +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/securestorageTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/unit/securestorageTest.cpp new file mode 100644 index 000000000..8fdc05518 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/securestorageTest.cpp @@ -0,0 +1,61 @@ +#include "unit.h" + +class SecureStorageTest : public ::testing::Test +{ +protected: + JsonEngine *jsonEngine; + Firebolt::Error error = Firebolt::Error::None; + + void SetUp() override + { + jsonEngine = new JsonEngine(); + } + + void TearDown() override + { + delete jsonEngine; + } +}; + +// Check enum issue with test app verse actual transport +TEST_F(SecureStorageTest, Get) +{ + auto expectedValue = jsonEngine->get_value("SecureStorage.get"); + + Firebolt::SecureStorage::StorageScope scope = Firebolt::SecureStorage::StorageScope::DEVICE; + + std::string actualValue = Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().get(scope, "authRefreshToken", &error); + + EXPECT_EQ(expectedValue, actualValue); +} + +TEST_F(SecureStorageTest, Set) +{ + // Call setter to set the value + Firebolt::SecureStorage::StorageScope scope = Firebolt::SecureStorage::StorageScope::DEVICE; + std::string expectedValue = "123456"; + Firebolt::SecureStorage::StorageOptions options; + options.ttl = 6.0; + Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().set(scope, "authRefreshToken", expectedValue, options, &error); + + // Check if there was an error during the set operation + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to set value in SecureStorage.set() method"; +} + +TEST_F(SecureStorageTest, Remove) +{ + Firebolt::SecureStorage::StorageScope scope = Firebolt::SecureStorage::StorageScope::DEVICE; + Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().remove(scope, "authRefreshToken", &error); + + // Check if there was an error during the remove operation + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to remove value in SecureStorage.remove() method"; +} + +TEST_F(SecureStorageTest, Clear) +{ + Firebolt::SecureStorage::StorageScope scope = Firebolt::SecureStorage::StorageScope::DEVICE; + Firebolt::IFireboltAccessor::Instance().SecureStorageInterface().clear(scope, &error); + + // Check if there was an error during the clear operation + EXPECT_EQ(error, Firebolt::Error::None) << "Failed to clear value in SecureStorage.clear() method"; +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h b/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h new file mode 100644 index 000000000..281096f15 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h @@ -0,0 +1,5 @@ +#pragma once + +#include "gtest/gtest.h" +#include "../CoreSDKTest.h" +#include "json_engine.h" \ No newline at end of file From d73286b97c1e3e6ff6cf5e52daf50ea929f04af3 Mon Sep 17 00:00:00 2001 From: Aditya Kasar Date: Thu, 17 Oct 2024 00:12:14 +0530 Subject: [PATCH 2/3] fix: Compile C++ SDK on PRs (#334) * refactor: CI pipeline to build CPP SDKs * fix: Trigger c++ build on PR synchronize --------- Co-authored-by: kschrief --- .github/workflows/cxx-build.yml | 208 ++++++++++++++++++++++++++++++++ .github/workflows/utils.sh | 129 +++++++++++++++++--- 2 files changed, 322 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/cxx-build.yml diff --git a/.github/workflows/cxx-build.yml b/.github/workflows/cxx-build.yml new file mode 100644 index 000000000..1233cd8fa --- /dev/null +++ b/.github/workflows/cxx-build.yml @@ -0,0 +1,208 @@ +name: CXX build +on: + workflow_dispatch: + pull_request: + branches: + - 'main' + - 'next' + types: + - opened + - synchronize + +env: + HUSKY: 0 +jobs: + thunder: + name: Build Thunder Libraries + runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Clone and Install Thunder + id: install_thunder + run: | + .github/workflows/utils.sh cloneAndInstallThunder + + - name: Upload the library artifact + uses: actions/upload-artifact@v3 + with: + name: thunder + path: /__w/firebolt-apis/install/ + + openrpc: + name: Build Openrpc Artifacts + runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + repo-token: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 'lts/*' + - name: Set up NPM token + env: + NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} + run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc' + + - name: Cache npm dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: deps-node-modules-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + run: npm ci + + - name: Set file permissions + run: | + chmod -R 755 ./ + chown -R $(id -u):$(id -g) ./ + + - name: Build Artifacts + run: | + npm run dist + + - name: Upload Core SDK + uses: actions/upload-artifact@v3 + with: + name: core + path: src/sdks/core + + - name: Upload Manage SDK + uses: actions/upload-artifact@v3 + with: + name: manage + path: src/sdks/manage + + - name: Upload Discovery SDK + uses: actions/upload-artifact@v3 + with: + name: discovery + path: src/sdks/discovery + + core_sdk: + name: Build Core SDK + needs: [thunder, openrpc] + runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download Core SDK + uses: actions/download-artifact@v3 + with: + name: core + path: /__w/firebolt-apis/firebolt-apis/src/sdks/core + + + - name: Download Thunder + uses: actions/download-artifact@v3 + 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: npm ci + + - name: Generate core SDK source code + run: | + .github/workflows/utils.sh generate_cpp_core_sdk_source_code + + - name: Build CXX Core SDK + run: | + .github/workflows/utils.sh build_core_cpp_sdk + + manage_sdk: + name: Build Manage SDK + needs: [thunder, openrpc] + runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download Manage SDK + uses: actions/download-artifact@v3 + with: + name: manage + path: /__w/firebolt-apis/firebolt-apis/src/sdks/manage + + - name: Download Thunder + uses: actions/download-artifact@v3 + 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: npm ci + + - name: Generate manage SDK source code + run: | + .github/workflows/utils.sh generate_cpp_manage_sdk_source_code + + - name: Build CXX manage SDK + run: | + .github/workflows/utils.sh build_manage_cpp_sdk + + dicovery_sdk: + name: Build Discovery SDK + needs: [thunder, openrpc] + runs-on: ubuntu-latest + container: + image: kevinshahfws/node-c:3.0 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download Discovery SDK + uses: actions/download-artifact@v3 + with: + name: discovery + path: /__w/firebolt-apis/firebolt-apis/src/sdks/discovery + + - name: Download Thunder + uses: actions/download-artifact@v3 + 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: npm ci + + - name: Generate discovery SDK source code + run: | + .github/workflows/utils.sh generate_cpp_discovery_sdk_source_code + + - name: Build CXX Discovery SDK + run: | + .github/workflows/utils.sh build_discovery_cpp_sdk diff --git a/.github/workflows/utils.sh b/.github/workflows/utils.sh index 772b35866..6633ddcac 100755 --- a/.github/workflows/utils.sh +++ b/.github/workflows/utils.sh @@ -1,6 +1,13 @@ #!/bin/bash set -o pipefail +FIREBOLT_VERSION=1.0.0-next.0 +current_apis_dir=$(pwd) + +cd .. +current_dir=$(pwd) +cd $current_apis_dir + function runTests(){ echo "Clone firebolt-apis repo with pr branch" PR_BRANCH=$(echo "$EVENT_NAME" | tr '[:upper:]' '[:lower:]') @@ -36,12 +43,7 @@ function runTests(){ echo "clone fca repo and start it in the background" git clone --branch main https://github.com/rdkcentral/firebolt-certification-app.git cd firebolt-certification-app - echo "Updating Core SDK dependency" jq '.dependencies["@firebolt-js/sdk"] = "file:../firebolt-apis/src/sdks/core"' package.json > package.json.tmp && mv package.json.tmp package.json - echo "Updating Manage SDK dependency" - jq '.dependencies["@firebolt-js/manage-sdk"] = "file:../firebolt-apis/src/sdks/manage"' package.json > package.json.tmp && mv package.json.tmp package.json - echo "Updating Discovery SDK dependency" - jq '.dependencies["@firebolt-js/discovery-sdk"] = "file:../firebolt-apis/src/sdks/discovery"' package.json > package.json.tmp && mv package.json.tmp package.json npm install npm start & sleep 5s @@ -152,16 +154,113 @@ function unzipArtifact(){ echo "Failures=$failures" >> "$GITHUB_ENV" } +function cloneAndInstallThunder() { + cd .. + + git clone https://github.com/rdkcentral/Thunder.git + + cd Thunder + + git checkout 283b3d54334010403d85a4e69b3835de23e42331 + + cd .. + + git clone https://github.com/rdkcentral/ThunderTools.git + + cd ThunderTools + + git checkout 64b72b5ed491436b0e6bc2327d8a7b0e75ee2870 + + cd .. + + echo "current_dir is $current_dir" + + mkdir -p $current_dir/data + + if [ ! -d "$(pwd)/Thunder" ] + then + echo "Directory Thunder DOES NOT exist." + exit 9999 + fi + + if [ ! -d "$(pwd)/ThunderTools" ] + then + echo "Directory ThunderTools DOES NOT exist." + exit 9999 + fi + + if [ ! -d "$current_dir/firebolt-apis" ] + then + echo "Directory $current_dir/firebolt-apis DOES NOT exist." + exit 9999 + fi + + cd $current_dir + + [ -d "$current_dir/build" ] && rm -rf $current_dir/build + + echo "Building Thunder"; + + cmake -G Ninja -S ThunderTools -B build/ThunderTools -DCMAKE_INSTALL_PREFIX="install/usr" && echo "Tools Setup" || exit 9999 + + cmake --build build/ThunderTools --target install && echo "Thunder Tools Build succeeded" || exit 9999 + + #-G Ninja is the "Build system generator" + #-S is the source path + #-B is the output directory + cmake -G Ninja -S Thunder -B build/Thunder \ + -DBUILD_SHARED_LIBS=ON \ + -DBINDING="127.0.0.1" \ + -DCMAKE_BUILD_TYPE="Debug" \ + -DCMAKE_INSTALL_PREFIX="install/usr" \ + -DCMAKE_MODULE_PATH="${PWD}/install/usr/include/WPEFramework/Modules" \ + -DDATA_PATH="${PWD}/install/usr/share/WPEFramework" \ + -DPERSISTENT_PATH="${PWD}/install/var/wpeframework" \ + -DPORT="55555" \ + -DPROXYSTUB_PATH="${PWD}/install/usr/lib/wpeframework/proxystubs" \ + -DSYSTEM_PATH="${PWD}/install/usr/lib/wpeframework/plugins" \ + -DVOLATILE_PATH="tmp" && echo "Thunder configure succeeded" || exit 9999 + + cmake --build build/Thunder --target install && echo "Thunder Build succeeded" || exit 9999 +} + + +function generate_cpp_sdk_source_code(){ + local sdk_name=$1 + + echo " ************ Genrate Source Code for ${sdk_name^} CPP SDK ************" + + FIREBOLT_VERSION=1.3.0-next.1 + cd src/sdks/${sdk_name} + npm run cpp +} + +function build_cpp_sdk() { + FIREBOLT_VERSION=1.3.0-next.1 + local sdk_name=$1 + + echo " ************ Build ${sdk_name^} CPP SDK ************" + + cd /__w/firebolt-apis/firebolt-apis/src/sdks/${sdk_name}/build/cpp/src/firebolt-${sdk_name}-native-sdk-${FIREBOLT_VERSION}/ + chmod +x ./build.sh + + ./build.sh -s "/__w/thunder/install/" || exit 9999 +} + # Check argument and call corresponding function -if [ "$1" == "runTests" ]; then - runTests -elif [ "$1" == "getResults" ]; then - getResults -elif [ "$1" == "getArtifactData" ]; then - getArtifactData -elif [ "$1" == "unzipArtifact" ]; then - unzipArtifact -else +case "$1" in + runTests) runTests ;; + getResults) getResults ;; + getArtifactData) getArtifactData ;; + 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" ;; + *) echo "Invalid function specified." exit 1 -fi \ No newline at end of file + ;; +esac \ No newline at end of file From 0dba2bdd0a9fc8d60b6f9932e2a5512a39de1be9 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 16 Oct 2024 18:46:19 +0000 Subject: [PATCH 3/3] chore(release): 1.5.0-next.2 [skip ci] # [1.5.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v1.5.0-next.1...v1.5.0-next.2) (2024-10-16) ### Bug Fixes * Compile C++ SDK on PRs ([#334](https://github.com/rdkcentral/firebolt-apis/issues/334)) ([d73286b](https://github.com/rdkcentral/firebolt-apis/commit/d73286b97c1e3e6ff6cf5e52daf50ea929f04af3)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- src/sdks/core/package.json | 2 +- src/sdks/discovery/package.json | 2 +- src/sdks/manage/package.json | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f40f9880..d195983e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.5.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v1.5.0-next.1...v1.5.0-next.2) (2024-10-16) + + +### Bug Fixes + +* Compile C++ SDK on PRs ([#334](https://github.com/rdkcentral/firebolt-apis/issues/334)) ([d73286b](https://github.com/rdkcentral/firebolt-apis/commit/d73286b97c1e3e6ff6cf5e52daf50ea929f04af3)) + # [1.5.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.4.1-next.1...v1.5.0-next.1) (2024-09-25) diff --git a/package-lock.json b/package-lock.json index e2c496250..7b2e05116 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@firebolt-js/sdks", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@firebolt-js/sdks", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "license": "Apache-2.0", "workspaces": [ "src/sdks/core", diff --git a/package.json b/package.json index adc3c1187..5097b1a82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdks", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "description": "The Firebolt JS SDK", "type": "module", "bin": { diff --git a/src/sdks/core/package.json b/src/sdks/core/package.json index 2b1a2fc78..071923ffd 100644 --- a/src/sdks/core/package.json +++ b/src/sdks/core/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdk", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "description": "The Firebolt JS SDK", "main": "./dist/lib/firebolt.mjs", "types": "./dist/lib/firebolt.d.ts", diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json index c9df78f10..a18245019 100644 --- a/src/sdks/discovery/package.json +++ b/src/sdks/discovery/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/discovery-sdk", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "description": "The Firebolt Discovery JS SDK", "main": "./dist/lib/firebolt-discovery.mjs", "types": "./dist/lib/firebolt-discovery.d.ts", diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json index 0aa9b8f4c..84fe7f1b8 100644 --- a/src/sdks/manage/package.json +++ b/src/sdks/manage/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/manage-sdk", - "version": "1.5.0-next.1", + "version": "1.5.0-next.2", "description": "The Firebolt Manage JS SDK", "main": "./dist/lib/firebolt-manage.mjs", "types": "./dist/lib/firebolt-manage.d.ts",