ifw-daq  3.0.0-pre2
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
MOCK_METHOD1(setMessage, void(const std::string &))
MOCK_METHOD1(setId, void(const std::string &))
MOCK_CONST_METHOD0(getMessage, std::string())
std::unique_ptr< metadaqif::DaqReply > clone() const override
bool keyEquals(const metadaqif::DaqReply &other) const override
MOCK_CONST_METHOD0(getId, std::string())
bool hasKey() const override
std::unique_ptr< metadaqif::DaqReply > cloneKey() const override
MOCK_CONST_METHOD0(getStatus, uint32_t())
MOCK_METHOD1(setStatus, void(uint32_t))
MOCK_CONST_METHOD0(getTimestamp, double())
MOCK_CONST_METHOD0(getMessage, std::string())
MOCK_CONST_METHOD0(getId, std::string())
std::unique_ptr< metadaqif::DaqStatus > cloneKey() const override
MOCK_METHOD1(setId, void(const std::string &))
MOCK_CONST_METHOD0(getKeywords, std::string())
MOCK_METHOD1(setTimestamp, void(double))
MOCK_CONST_METHOD0(getState, metadaqif::DaqState())
MOCK_METHOD1(setState, void(metadaqif::DaqState))
MOCK_METHOD1(setKeywords, void(std::string const &))
MOCK_METHOD1(setMessage, void(const std::string &))
MOCK_CONST_METHOD0(getFiles, std::vector< std::string >())
bool keyEquals(const metadaqif::DaqStatus &other) const override
MOCK_METHOD1(setFiles, void(std::vector< std::string > const &))
bool hasKey() const override
std::unique_ptr< metadaqif::DaqStatus > clone() const override
MOCK_METHOD1(setFiles, void(std::vector< std::string > const &))
MOCK_CONST_METHOD0(getId, std::string())
MOCK_METHOD1(setId, void(const std::string &))
std::unique_ptr< metadaqif::DaqStopReply > clone() const override
MOCK_CONST_METHOD0(getKeywords, std::string())
MOCK_CONST_METHOD0(getFiles, std::vector< std::string >())
std::unique_ptr< metadaqif::DaqStopReply > cloneKey() const override
bool hasKey() const override
bool keyEquals(const metadaqif::DaqStopReply &other) const override
MOCK_METHOD1(setKeywords, void(std::string const &))
MOCK_CONST_METHOD0(getMal, std::shared_ptr<::elt::mal::Mal >())
MOCK_METHOD1(GetDaqStatus, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqStatus >>(const std::string &))
MOCK_METHOD1(AbortDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqReply >>(const std::string &))
MOCK_METHOD1(StartDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqReply >>(const std::string &))
MOCK_METHOD1(registerConnectionListener, elt::mal::rr::ListenerRegistration(elt::mal::rr::ClientRrEntity::ConnectionListener))
MOCK_METHOD1(StopDaq, ::elt::mal::future< std::shared_ptr<::metadaqif::DaqStopReply >>(const std::string &))
MOCK_METHOD0(asyncConnect, ::elt::mal::future< void >())