diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01baa9a..0c7d124 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,9 @@ on: - rpc_v2 - legacy push: - branches: [ main, next ] + branches: [ main, develop, next ] pull_request: - branches: [ main, next ] + branches: [ main, develop, next ] defaults: run: diff --git a/include/firebolt/actions.h b/include/firebolt/actions.h index f76efbd..660abd6 100644 --- a/include/firebolt/actions.h +++ b/include/firebolt/actions.h @@ -22,31 +22,34 @@ #ifndef FIREBOLT_ACTIONS_H #define FIREBOLT_ACTIONS_H +#include #include #include #include #include #include #include -#include -namespace Firebolt::Actions { +namespace Firebolt::Actions +{ -class IActions { +class IActions +{ public: virtual ~IActions() = default; virtual Result intent() const = 0; virtual Result subscribeOnIntent(std::function&& notification) = 0; - virtual Result subscribeOnIntentChanged(std::function&& notification) { + virtual Result subscribeOnIntentChanged(std::function&& notification) + { return subscribeOnIntent(std::move(notification)); } virtual Result unsubscribe(SubscriptionId id) = 0; virtual void unsubscribeAll() = 0; -}; // class IActions +}; // class IActions } // namespace Firebolt::Actions diff --git a/src/actions_impl.cpp b/src/actions_impl.cpp index aba7b5b..b699bca 100644 --- a/src/actions_impl.cpp +++ b/src/actions_impl.cpp @@ -23,26 +23,32 @@ #include "json_types/actions.h" #include -namespace Firebolt::Actions { +namespace Firebolt::Actions +{ ActionsImpl::ActionsImpl(Firebolt::Helpers::IHelper& helper) - : helper_(helper) - , subscriptionManager_(helper, this) -{} + : helper_(helper), + subscriptionManager_(helper, this) +{ +} -Result ActionsImpl::intent() const { +Result ActionsImpl::intent() const +{ return helper_.get("Actions.intent"); } -Result ActionsImpl::subscribeOnIntent(std::function&& notification) { +Result ActionsImpl::subscribeOnIntent(std::function&& notification) +{ return subscriptionManager_.subscribe("Actions.onIntent", std::move(notification)); } -Result ActionsImpl::unsubscribe(SubscriptionId id) { +Result ActionsImpl::unsubscribe(SubscriptionId id) +{ return subscriptionManager_.unsubscribe(id); } -void ActionsImpl::unsubscribeAll() { +void ActionsImpl::unsubscribeAll() +{ subscriptionManager_.unsubscribeAll(); } diff --git a/src/actions_impl.h b/src/actions_impl.h index 229b60d..4c8d6ba 100644 --- a/src/actions_impl.h +++ b/src/actions_impl.h @@ -25,9 +25,11 @@ #include "firebolt/actions.h" #include -namespace Firebolt::Actions { +namespace Firebolt::Actions +{ -class ActionsImpl : public IActions { +class ActionsImpl : public IActions +{ public: explicit ActionsImpl(Firebolt::Helpers::IHelper& helper); ActionsImpl(const ActionsImpl&) = delete; diff --git a/src/json_types/actions.h b/src/json_types/actions.h index 6025350..60c76ce 100644 --- a/src/json_types/actions.h +++ b/src/json_types/actions.h @@ -23,14 +23,16 @@ #define FIREBOLT_ACTIONS_JSON_H #pragma once -#include -#include -#include #include "firebolt/actions.h" +#include +#include +#include -namespace Firebolt::Actions { +namespace Firebolt::Actions +{ -namespace JsonData { +namespace JsonData +{ } // namespace JsonData diff --git a/test/component/actionsGeneratedTest.cpp b/test/component/actionsGeneratedTest.cpp index e14323e..38a5356 100644 --- a/test/component/actionsGeneratedTest.cpp +++ b/test/component/actionsGeneratedTest.cpp @@ -61,4 +61,3 @@ TEST_F(ActionsGeneratedCTest, SubscribeOnIntent) auto result = Firebolt::IFireboltAccessor::Instance().ActionsInterface().unsubscribe(id.value()); verifyUnsubscribeResult(result); } - diff --git a/test/unit/actionsGeneratedTest.cpp b/test/unit/actionsGeneratedTest.cpp index 51b3ee3..a9f8ba7 100644 --- a/test/unit/actionsGeneratedTest.cpp +++ b/test/unit/actionsGeneratedTest.cpp @@ -16,8 +16,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "mock_helper.h" #include "actions_impl.h" +#include "mock_helper.h" #include class ActionsGeneratedUTest : public ::testing::Test @@ -34,24 +34,23 @@ TEST_F(ActionsGeneratedUTest, Constructs) TEST_F(ActionsGeneratedUTest, UnsubscribeForwardsToHelper) { - EXPECT_CALL(mockHelper, unsubscribe(7)) - .WillOnce(::testing::Return(Firebolt::Result{Firebolt::Error::None})); + EXPECT_CALL(mockHelper, unsubscribe(7)).WillOnce(::testing::Return(Firebolt::Result{Firebolt::Error::None})); auto result = impl.unsubscribe(7); ASSERT_TRUE(result) << "unsubscribe should return success when helper succeeds"; } - TEST_F(ActionsGeneratedUTest, ForwardsIntentTransportErrors) { EXPECT_CALL(mockHelper, getJson("Actions.intent", ::testing::_)) - .WillOnce(::testing::Invoke([](const std::string& /*method*/, const nlohmann::json& params) { - EXPECT_TRUE(params.is_null() || (params.is_object() && params.empty())) - << "Actions.intent getter should not send request params"; - return Firebolt::Result{Firebolt::Error::General}; - })); + .WillOnce(::testing::Invoke( + [](const std::string& /*method*/, const nlohmann::json& params) + { + EXPECT_TRUE(params.is_null() || (params.is_object() && params.empty())) + << "Actions.intent getter should not send request params"; + return Firebolt::Result{Firebolt::Error::General}; + })); auto result = impl.intent(); EXPECT_FALSE(result) << "Expected error propagation when helper getJson fails"; } -