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"}};
76 TEST(TestStatus, OstreamOperator) {
82 MatchesRegex(
"Status\\(id='id', file_id='fileid', state=.*, error=false, result=''\\)"));
85 TEST(TestStatus, Comparison) {
107 alert2.
id.
key =
"different key";
123 TEST(TestAlertId, Comparison) {
129 auto alert2 = alert1;
130 alert2.
key =
"different key";
131 EXPECT_NE(alert1, alert2);
133 auto alert3 = alert1;
134 alert3.
category =
"different category";
135 EXPECT_NE(alert1, alert3);
141 alert1.
id.
key =
"key";
145 auto alert2 = alert1;
146 alert2.
id.
key =
"different key";
147 EXPECT_NE(alert1, alert2);
149 auto alert3 = alert1;
151 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.
void SetState(State s, std::optional< bool > error=std::nullopt) noexcept
Set state of data acquisition.
bool GetError() const noexcept
ObservableStatus test fixture.
Simple observer used for testing.
TEST_F(TestDpmDaqController, StatusUpdateInNotScheduledSucceeds)
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.
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")
ASSERT_EQ(meta.keyword_rules.size(), 1u)