ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
metadaqifMock.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_test
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Mockup of metadaqif classes
7  */
8 // GCOVR_EXCL_START
9 #ifndef OCM_DAQ_TEST_MOCK_META_DAQ_ASYNC_MOCK_HPP
10 #define OCM_DAQ_TEST_MOCK_META_DAQ_ASYNC_MOCK_HPP
11 #include <daq/config.hpp>
12 #include <Metadaqif.hpp>
13 #include <gmock/gmock.h>
14 
15 namespace daq {
16 
17 struct MetaDaqAsyncMock : metadaqif::MetaDaqAsync {
18  MOCK_METHOD1(StartDaq,
19  ::elt::mal::future<std::shared_ptr<::metadaqif::DaqReply>>(const std::string&));
20  MOCK_METHOD1(StopDaq,
21  ::elt::mal::future<std::shared_ptr<::metadaqif::DaqStopReply>>(const std::string&));
22  MOCK_METHOD1(AbortDaq,
23  ::elt::mal::future<std::shared_ptr<::metadaqif::DaqReply>>(const std::string&));
24  MOCK_METHOD1(GetDaqStatus,
25  ::elt::mal::future<std::shared_ptr<::metadaqif::DaqStatus>>(const std::string&));
26 
27  // mal API stuff
29  std::shared_ptr<::elt::mal::Mal>());
30  MOCK_METHOD0(asyncConnect,
31  ::elt::mal::future<void>());
32  MOCK_METHOD1(registerConnectionListener, elt::mal::rr::ListenerRegistration(elt::mal::rr::ClientRrEntity::ConnectionListener));
33 };
34 
35 struct DaqReplyMock : metadaqif::DaqReply {
36  public:
37  MOCK_CONST_METHOD0(getId, std::string());
38  MOCK_METHOD1(setId, void(const std::string&));
39 
40  MOCK_CONST_METHOD0(getStatus, uint32_t());
41  MOCK_METHOD1(setStatus, void(uint32_t));
42 
43  MOCK_CONST_METHOD0(getMessage, std::string());
44  MOCK_METHOD1(setMessage, void(const std::string&));
45 
46  std::unique_ptr<metadaqif::DaqReply> clone() const override {
47  return {};
48  }
49  std::unique_ptr<metadaqif::DaqReply> cloneKey() const override {
50  return {};
51  }
52  bool hasKey() const override {
53  return false;
54  };
55  bool keyEquals(const metadaqif::DaqReply& other) const override {
56  return false;
57  }
58 };
59 
60 struct DaqStopReplyMock : metadaqif::DaqStopReply {
61  public:
62  MOCK_CONST_METHOD0(getId, std::string());
63  MOCK_METHOD1(setId, void(const std::string&));
64 
65  MOCK_CONST_METHOD0(getFiles, std::vector<std::string>());
66  MOCK_METHOD1(setFiles, void(std::vector<std::string> const&));
67 
68  MOCK_CONST_METHOD0(getKeywords, std::string());
69  MOCK_METHOD1(setKeywords, void(std::string const&));
70 
71  std::unique_ptr<metadaqif::DaqStopReply> clone() const override {
72  return {};
73  }
74  std::unique_ptr<metadaqif::DaqStopReply> cloneKey() const override {
75  return {};
76  }
77  bool hasKey() const override {
78  return false;
79  };
80  bool keyEquals(const metadaqif::DaqStopReply& other) const override {
81  return false;
82  }
83 };
84 
85 
86 struct DaqStatusMock : metadaqif::DaqStatus {
87  public:
88  MOCK_CONST_METHOD0(getId, std::string());
89  MOCK_METHOD1(setId, void(const std::string&));
90 
91  MOCK_CONST_METHOD0(getState, metadaqif::DaqState());
92  MOCK_METHOD1(setState, void(metadaqif::DaqState));
93 
94  MOCK_CONST_METHOD0(getMessage, std::string());
95  MOCK_METHOD1(setMessage, void(const std::string&));
96 
97  MOCK_CONST_METHOD0(getFiles, std::vector<std::string>());
98  MOCK_METHOD1(setFiles, void(std::vector<std::string> const&));
99 
100  MOCK_CONST_METHOD0(getKeywords, std::string());
101  MOCK_METHOD1(setKeywords, void(std::string const&));
102 
103  MOCK_CONST_METHOD0(getTimestamp, double());
104  MOCK_METHOD1(setTimestamp, void(double));
105 
106  std::unique_ptr<metadaqif::DaqStatus> clone() const override {
107  return {};
108  }
109  std::unique_ptr<metadaqif::DaqStatus> cloneKey() const override {
110  return {};
111  }
112  bool hasKey() const override {
113  return false;
114  };
115  bool keyEquals(const metadaqif::DaqStatus& other) const override {
116  return false;
117  }
118 };
119 
120 }
121 #endif // #ifndef OCM_DAQ_TEST_MOCK_META_DAQ_ASYNC_MOCK_HPP
122 // GCOVR_EXCL_STOP
daq::DaqStopReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getKeywords, std::string())
daq::DaqReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getId, std::string())
daq::DaqStopReplyMock::hasKey
bool hasKey() const override
Definition: metadaqifMock.hpp:77
daq::DaqStatusMock::clone
std::unique_ptr< metadaqif::DaqStatus > clone() const override
Definition: metadaqifMock.hpp:106
daq::DaqReplyMock::hasKey
bool hasKey() const override
Definition: metadaqifMock.hpp:52
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setKeywords, void(std::string const &))
daq::DaqReplyMock::cloneKey
std::unique_ptr< metadaqif::DaqReply > cloneKey() const override
Definition: metadaqifMock.hpp:49
daq::DaqReplyMock::MOCK_METHOD1
MOCK_METHOD1(setId, void(const std::string &))
daq::DaqStopReplyMock::MOCK_METHOD1
MOCK_METHOD1(setId, void(const std::string &))
daq::MetaDaqAsyncMock::MOCK_METHOD1
MOCK_METHOD1(registerConnectionListener, elt::mal::rr::ListenerRegistration(elt::mal::rr::ClientRrEntity::ConnectionListener))
daq::DaqStopReplyMock::keyEquals
bool keyEquals(const metadaqif::DaqStopReply &other) const override
Definition: metadaqifMock.hpp:80
daq::MetaDaqAsyncMock
Definition: metadaqifMock.hpp:17
daq::DaqReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getMessage, std::string())
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setFiles, void(std::vector< std::string > const &))
daq::DaqStopReplyMock
Definition: metadaqifMock.hpp:60
daq::DaqReplyMock::clone
std::unique_ptr< metadaqif::DaqReply > clone() const override
Definition: metadaqifMock.hpp:46
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getFiles, std::vector< std::string >())
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getMessage, std::string())
daq
Definition: asyncProcess.cpp:15
config.hpp
daq::DaqStopReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getFiles, std::vector< std::string >())
daq::MetaDaqAsyncMock::MOCK_METHOD1
MOCK_METHOD1(AbortDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqReply >>(const std::string &))
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getId, std::string())
daq::MetaDaqAsyncMock::MOCK_METHOD0
MOCK_METHOD0(asyncConnect, ::elt::mal::future< void >())
daq::DaqReplyMock
Definition: metadaqifMock.hpp:35
daq::DaqReplyMock::keyEquals
bool keyEquals(const metadaqif::DaqReply &other) const override
Definition: metadaqifMock.hpp:55
daq::MetaDaqAsyncMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getMal, std::shared_ptr<::elt::mal::Mal >())
daq::DaqReplyMock::MOCK_METHOD1
MOCK_METHOD1(setStatus, void(uint32_t))
daq::MetaDaqAsyncMock::MOCK_METHOD1
MOCK_METHOD1(StartDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqReply >>(const std::string &))
daq::MetaDaqAsyncMock::MOCK_METHOD1
MOCK_METHOD1(StopDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqStopReply >>(const std::string &))
daq::DaqReplyMock::MOCK_METHOD1
MOCK_METHOD1(setMessage, void(const std::string &))
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setId, void(const std::string &))
daq::MetaDaqAsyncMock::MOCK_METHOD1
MOCK_METHOD1(GetDaqStatus, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqStatus >>(const std::string &))
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setTimestamp, void(double))
daq::DaqStopReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getId, std::string())
daq::DaqStatusMock
Definition: metadaqifMock.hpp:86
daq::DaqStopReplyMock::MOCK_METHOD1
MOCK_METHOD1(setFiles, void(std::vector< std::string > const &))
daq::DaqStopReplyMock::clone
std::unique_ptr< metadaqif::DaqStopReply > clone() const override
Definition: metadaqifMock.hpp:71
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setMessage, void(const std::string &))
daq::DaqReplyMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getStatus, uint32_t())
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getState, metadaqif::DaqState())
daq::DaqStatusMock::keyEquals
bool keyEquals(const metadaqif::DaqStatus &other) const override
Definition: metadaqifMock.hpp:115
daq::DaqStatusMock::MOCK_METHOD1
MOCK_METHOD1(setState, void(metadaqif::DaqState))
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getTimestamp, double())
daq::DaqStopReplyMock::cloneKey
std::unique_ptr< metadaqif::DaqStopReply > cloneKey() const override
Definition: metadaqifMock.hpp:74
daq::DaqStopReplyMock::MOCK_METHOD1
MOCK_METHOD1(setKeywords, void(std::string const &))
daq::DaqStatusMock::hasKey
bool hasKey() const override
Definition: metadaqifMock.hpp:112
daq::DaqStatusMock::MOCK_CONST_METHOD0
MOCK_CONST_METHOD0(getKeywords, std::string())
daq::DaqStatusMock::cloneKey
std::unique_ptr< metadaqif::DaqStatus > cloneKey() const override
Definition: metadaqifMock.hpp:109