9 #include <gmock/gmock.h>
10 #include <gtest/gtest.h>
14 using namespace ::testing;
43 EXPECT_FALSE(s.
GetError()) <<
"By default error flag should be false";
55 MatchesRegex(
"ObservableStatus\\(id='id', file_id='fileid', state=.*, error=false\\)"));
65 std::vector<DpPart> files = {{
"origin1",
"path1"}, {
"origin2",
"path2"}};
67 auto time = Status::Clock::now();
84 TEST(TestStatus, OstreamOperator) {
87 s.
timestamp = std::chrono::time_point<std::chrono::system_clock>(
88 std::chrono::nanoseconds(1693899318896895717));
92 MatchesRegex(
"Status\\(id='id', file_id='fileid', state=.*, error=false, "
93 "result=''\\, timestamp=2023-09-05T07:35:18.896)"));
96 TEST(TestStatus, Comparison) {
106 Status s1(
"id",
"fileid");
109 alert.
id.
key =
"key";
118 alert2.
id.
key =
"different key";
134 TEST(TestAlertId, Comparison) {
140 auto alert2 = alert1;
141 alert2.
key =
"different key";
142 EXPECT_NE(alert1, alert2);
144 auto alert3 = alert1;
145 alert3.
category =
"different category";
146 EXPECT_NE(alert1, alert3);
152 alert1.
id.
key =
"key";
156 auto alert2 = alert1;
157 alert2.
id.
key =
"different key";
158 EXPECT_NE(alert1, alert2);
160 auto alert3 = alert1;
162 EXPECT_NE(alert1, alert3);
Stores data acquisition status and allows subscription to status changes.
boost::signals2::connection ConnectObserver(Observer o)
Connect observer that is invoked when state is modified.
State GetState() const noexcept
void SetError(bool error) noexcept
Set error flag for data acquisition.
Status const & GetStatus() const noexcept
Connect observer that is invoked when state is modified.
void SetState(State s, std::optional< bool > error=std::nullopt) noexcept
Set state of data acquisition.
bool GetError() const noexcept
Status::Clock::time_point GetTimestamp() const noexcept
ObservableStatus test fixture.
Simple observer used for testing.
TEST_F(TestDpmClient, StartMonitoringSendsRequestAndReceivesReply)
std::string key
Unique key for each alert.
std::string category
Standardized category.
void SetAlert(std::vector< Alert > &alerts, Alert alert)
Set alert.
bool ClearAlert(std::vector< Alert > &alerts, AlertId const &alert)
Clear alert.
State
Observable states of the data acquisition process.
@ Acquiring
All data sources have reported data acquisition is in progress.
@ Starting
Transitional state between NotStarted and Acquiring when sources have not begun acquiring data yet.
@ NotStarted
Initial state of data acquisition.
TEST(TestDaqContext, Files)
Describes an active Data Acquisition alert.
Uniquely identfies an alert.
Contains declaration for Status and ObservableStatus.
Non observable status object that keeps stores status of data acquisition.
std::vector< Alert > alerts
Active alerts.
TimePoint timestamp
Timestamp of last update.
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")
ASSERT_EQ(meta.keyword_rules.size(), 1u)