ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
testAsyncOpBase.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_ocm_libdaq_test
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Definition of TestAsyncOpBase
7  */
8 #include "testAsyncOpBase.hpp"
9 
10 using namespace daq;
11 using namespace ::testing;
12 
14  : m_io_ctx()
15  , m_executor(m_io_ctx)
16  , m_logger(log4cplus::Logger::getInstance("test"))
17  , m_id("id")
18  , m_status(std::make_shared<ObservableStatus>(m_id, m_id))
19  , m_event_log(std::make_shared<ObservableEventLog>())
20  , m_pending_replies(PendingReplies::Create()) {
21 }
22 
24  m_prim_rr_client = std::make_shared<RecCmdsAsyncMock>();
25  m_prim_rr_client2 = std::make_shared<NiceMock<RecCmdsAsyncMock>>();
26  m_meta_rr_client = std::make_shared<MetaDaqAsyncMock>();
27  m_meta_rr_client2 = std::make_shared<NiceMock<MetaDaqAsyncMock>>();
28 
29  // Connect listener
30  m_status->ConnectObserver(std::reference_wrapper(m_observer));
31 
32  PrimSource p1("prim-source-1", m_prim_rr_client);
33  PrimSource p2("prim-source-2", m_prim_rr_client2);
34 
35  m_prim_sources = MakeSources<PrimSource>({p1, p2});
36 
37  MetaSource s1("meta-source-1", m_meta_rr_client);
38  MetaSource s2("meta-source-2", m_meta_rr_client2);
39 
40  m_meta_sources = MakeSources<MetaSource>({s1, s2});
41 }
42 
44  m_meta_rr_client.reset();
45  m_meta_rr_client2.reset();
46  m_prim_rr_client.reset();
47  m_prim_rr_client2.reset();
48 }
49 
51  return op::AsyncOpParams(*m_status.get(),
52  *m_event_log.get(),
53  m_alerts,
54  m_executor,
55  m_logger,
56  m_id,
57  *m_pending_replies.get(),
60 }
61 
TestAsyncOpBase::m_meta_sources
std::vector< daq::Source< daq::MetaSource > > m_meta_sources
Definition: testAsyncOpBase.hpp:55
TestAsyncOpBase::m_meta_rr_client
std::shared_ptr< daq::MetaDaqAsyncMock > m_meta_rr_client
Definition: testAsyncOpBase.hpp:41
TestAsyncOpBase::m_observer
StatusObserverMock m_observer
Definition: testAsyncOpBase.hpp:49
TestAsyncOpBase::SetUp
void SetUp() override
Definition: testAsyncOpBase.cpp:23
TestAsyncOpBase::m_logger
log4cplus::Logger m_logger
Definition: testAsyncOpBase.hpp:47
TestAsyncOpBase::m_prim_rr_client2
std::shared_ptr< daq::RecCmdsAsyncMock > m_prim_rr_client2
Definition: testAsyncOpBase.hpp:40
TestAsyncOpBase::m_event_log
std::shared_ptr< daq::ObservableEventLog > m_event_log
Definition: testAsyncOpBase.hpp:51
daq::PendingReplies
Simple class that allows you to keep track of how many replies are pending.
Definition: pendingReplies.hpp:58
TestAsyncOpBase::m_meta_rr_client2
std::shared_ptr< daq::MetaDaqAsyncMock > m_meta_rr_client2
Definition: testAsyncOpBase.hpp:42
TestAsyncOpBase::MakeParams
daq::op::AsyncOpParams MakeParams()
Definition: testAsyncOpBase.cpp:50
daq
Definition: asyncProcess.cpp:15
TestAsyncOpBase::m_prim_sources
std::vector< daq::Source< daq::PrimSource > > m_prim_sources
Definition: testAsyncOpBase.hpp:54
TestAsyncOpBase::m_id
std::string m_id
Definition: testAsyncOpBase.hpp:48
daq::ObservableStatus
Stores data acquisition status and allows subscription to status changes.
Definition: status.hpp:161
TestAsyncOpBase::m_executor
rad::IoExecutor m_executor
Definition: testAsyncOpBase.hpp:46
testAsyncOpBase.hpp
Contains declaration for async operations shared base class.
TestAsyncOpBase::TestAsyncOpBase
TestAsyncOpBase()
Definition: testAsyncOpBase.cpp:13
TestAsyncOpBase::m_alerts
daq::op::AlertState m_alerts
Definition: testAsyncOpBase.hpp:52
TestAsyncOpBase::m_prim_rr_client
std::shared_ptr< daq::RecCmdsAsyncMock > m_prim_rr_client
Definition: testAsyncOpBase.hpp:39
TestAsyncOpBase::TearDown
void TearDown() override
Definition: testAsyncOpBase.cpp:43
daq::MetaSource
Keeps relevant state to be able to communicate with a primary data source.
Definition: source.hpp:140
daq::op::AsyncOpParams
Parameters required for each async operation.
Definition: asyncOpParams.hpp:67
TestAsyncOpBase::m_pending_replies
std::shared_ptr< daq::PendingReplies > m_pending_replies
Definition: testAsyncOpBase.hpp:53
daq::PrimSource
Keeps relevant state to be able to communicate with a primary data source.
Definition: source.hpp:96
TestAsyncOpBase::m_status
std::shared_ptr< daq::ObservableStatus > m_status
Definition: testAsyncOpBase.hpp:50
daq::ObservableEventLog
Stores data acquisition status and allows subscription to status changes.
Definition: eventLog.hpp:107