15#include <gmock/gmock.h>
16#include <gtest/gtest.h>
30using ::testing::InSequence;
31using ::testing::NiceMock;
32using ::testing::Return;
33using ::testing::Sequence;
61 auto lock = std::scoped_lock(callback_lock);
69 auto lock = std::scoped_lock(callback_lock);
76 std::mutex callback_lock;
87 std::unique_ptr<EventPublisherIf>
MakePublisher(
const std::string& topic)
override {
89 return std::unique_ptr<MockEventPublisher>(
pub.at(topic));
92 std::unique_ptr<EventSubscriberIf>
MakeSubscriber(
const std::string& topic)
override {
94 return std::unique_ptr<MockEventSubscriber>(
sub.at(topic));
97 std::map<std::string, MockEventPublisher*>
pub;
98 std::map<std::string, MockEventSubscriber*>
sub;
107 es = std::make_shared<MockEventService>();
120 std::shared_ptr<MockEventService>
es;
Definition helpers.hpp:76
void Publish(const JsonPayload &sample) override
Publishes a JSON object.
Definition helpers.hpp:48
friend MockEventService
Definition helpers.hpp:78
Definition helpers.hpp:114
std::unique_ptr< EventPublisherIf > MakePublisher(const std::string &topic) override
Creates a new publisher for a specified topic.
Definition helpers.hpp:87
std::map< std::string, MockEventPublisher * > pub
Definition helpers.hpp:129
MockEventService()
Definition helpers.hpp:84
std::map< std::string, MockEventSubscriber * > sub
Definition helpers.hpp:130
std::unique_ptr< EventSubscriberIf > MakeSubscriber(const std::string &topic) override
Creates a new subscriber for a specified topic.
Definition helpers.hpp:92
Definition helpers.hpp:88
void Subscribe(std::function< void(const JsonPayload &)> cb) override
Subscribes to a specified topic.
Definition helpers.hpp:60
MOCK_METHOD(void, SubscribeMock,(std::function< void(const JsonPayload &)>),())
MOCK_METHOD(void, Unsubscribe,(),(override))
std::function< void(const JsonPayload &)> GetCallback()
Definition helpers.hpp:68
friend MockEventService
Definition helpers.hpp:90
Component metrics interface.
Definition componentMetricsIf.hpp:85
Interface class for publishing JSON events.
Definition eventServiceIf.hpp:52
Interface class for providing pub/sub facilities for JSON events.
Definition eventServiceIf.hpp:29
Interface class for subscribing to JSON events.
Definition eventServiceIf.hpp:68
virtual void Unsubscribe()=0
Unsubscribes from a specified topic.
Base interface for all OLDB adapters.
Definition oldbIf.hpp:25
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Container class that holds services of any type.
Definition serviceContainer.hpp:39
void Add(Service &&service, const std::string &name="")
Insert new service into the container.
Definition serviceContainer.hpp:62
Header file for ComponentMetricsIf.
Low-level interface of the event service.
Declaration of helper mock class for ComponentMetricsIf.
Header file providing a FakeOldbIf.
Header file providing a FakeRuntimeRepoIf.
Definition fakeClock.cpp:15
Definition commandReplier.cpp:22
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
ACTION(Throw)
Definition helpers.hpp:123
A container that can hold any type of service.
Definition helpers.hpp:133
std::shared_ptr< MockEventService > es
Definition helpers.hpp:152
ServiceContainer & operator*()
Definition helpers.hpp:111
FakeServices()
Definition helpers.hpp:102
MockEventService & Es()
Definition helpers.hpp:115
ServiceContainer services
Definition helpers.hpp:151