Leosac  0.8.0
Open Source Access Control
Leosac::Test::Helper::TestHelper Class Referenceabstract

Base class for test fixtures, it defines a ZMQ context, a BUS and a sub socket connect to the bus. More...

#include <TestHelper.hpp>

+ Inheritance diagram for Leosac::Test::Helper::TestHelper:
+ Collaboration diagram for Leosac::Test::Helper::TestHelper:

Public Member Functions

 TestHelper ()
 
virtual ~TestHelper ()
 
virtual void SetUp () override final
 We need this 2-step initialization to prevent calling virtual method (run_module) in constructor. More...
 

Public Attributes

zmqpp::context ctx_
 A context for the test case. More...
 
MessageBus bus_
 A BUS identical to the one spawned by core. More...
 
zmqpp::socket bus_sub_
 A SUB socket connected to the previous bus. More...
 
zmqpp::socket bus_push_
 A PUSH socket to write on the bus. More...
 
std::unique_ptr< zmqpp::actor > module_actor_
 An actor, to run the module code the same way it would be run by the core. More...
 

Private Member Functions

virtual bool run_module (zmqpp::socket *pipe)=0
 Called in the module's actor's thread. More...
 

Detailed Description

Base class for test fixtures, it defines a ZMQ context, a BUS and a sub socket connect to the bus.

Definition at line 116 of file TestHelper.hpp.

Constructor & Destructor Documentation

◆ TestHelper()

Leosac::Test::Helper::TestHelper::TestHelper ( )
inline

Definition at line 127 of file TestHelper.hpp.

◆ ~TestHelper()

virtual Leosac::Test::Helper::TestHelper::~TestHelper ( )
inlinevirtual

Definition at line 138 of file TestHelper.hpp.

Member Function Documentation

◆ run_module()

virtual bool Leosac::Test::Helper::TestHelper::run_module ( zmqpp::socket *  pipe)
privatepure virtual

Called in the module's actor's thread.

Override this: Construct configuration for the module then run_test_module() with appropriate parameters.

Implemented in Leosac::Test::LedTest, Leosac::Test::WiegandReaderTest, and Leosac::Test::RplethTest.

◆ SetUp()

virtual void Leosac::Test::Helper::TestHelper::SetUp ( )
inlinefinaloverridevirtual

We need this 2-step initialization to prevent calling virtual method (run_module) in constructor.

Definition at line 146 of file TestHelper.hpp.

Member Data Documentation

◆ bus_

MessageBus Leosac::Test::Helper::TestHelper::bus_

A BUS identical to the one spawned by core.

Definition at line 160 of file TestHelper.hpp.

◆ bus_push_

zmqpp::socket Leosac::Test::Helper::TestHelper::bus_push_

A PUSH socket to write on the bus.

Definition at line 170 of file TestHelper.hpp.

◆ bus_sub_

zmqpp::socket Leosac::Test::Helper::TestHelper::bus_sub_

A SUB socket connected to the previous bus.

Definition at line 165 of file TestHelper.hpp.

◆ ctx_

zmqpp::context Leosac::Test::Helper::TestHelper::ctx_

A context for the test case.

Definition at line 155 of file TestHelper.hpp.

◆ module_actor_

std::unique_ptr<zmqpp::actor> Leosac::Test::Helper::TestHelper::module_actor_

An actor, to run the module code the same way it would be run by the core.

Does NOT subscribe to anything.

Definition at line 176 of file TestHelper.hpp.


The documentation for this class was generated from the following file: