10#include <gtest/gtest.h>
11#include <log4cplus/logger.h>
20using namespace ::testing;
21using namespace std::chrono_literals;
31 ,
m_logger(log4cplus::Logger::getInstance(
"test")) {
35 m_status = std::make_shared<ObservableStatus>(
"id",
"fileid");
42 std::shared_ptr<daq::ObservableStatus>
m_status;
51 auto result = fut.get();
52 EXPECT_FALSE(result.error);
59 auto [fut, abort] = op::InitiateAbortableOperation<op::AwaitStateAsync>(
60 m_executor, m_io_ctx, m_status, State::Acquiring, 100ms, m_logger);
63 EXPECT_FALSE(fut.is_ready());
65 EXPECT_FALSE(fut.is_ready());
67 m_status->SetState(State::Acquiring);
71 auto result = fut.get();
72 EXPECT_FALSE(result.error);
79 auto [fut, abort] = op::InitiateAbortableOperation<op::AwaitStateAsync>(
80 m_executor, m_io_ctx, m_status, State::Acquiring, 0ms, m_logger);
86 auto result = fut.get();
87 EXPECT_TRUE(result.error);
94 auto [fut, abort] = op::InitiateAbortableOperation<op::AwaitStateAsync>(
95 m_executor, m_io_ctx, m_status, State::Acquiring, 100ms, m_logger);
107 auto [fut, abort] = op::InitiateAbortableOperation<op::AwaitStateAsync>(
108 m_executor, m_io_ctx, m_status, State::Acquiring, 0ms, m_logger);
112 auto& mut_status =
const_cast<Status&
>(m_status->GetStatus());
113 mut_status.
state = State::Acquiring;
118 auto result = fut.get();
119 EXPECT_FALSE(result.error);
Contains declaration for the AwaitStateAsync operation.
Started operation was aborted.
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
Contains error related declarations for DAQ.
log4cplus::Logger m_logger
boost::asio::io_context m_io_ctx
rad::IoExecutor m_executor
std::shared_ptr< daq::ObservableStatus > m_status
void MakeTestProgress(boost::asio::io_context &io_ctx, Future *fut=nullptr)
Test helper that progress the test by executing pending jobs and optionally wait for a future to be r...
Contains declarations for the helper functions to initiate operations.
Non observable status object that keeps stores status of data acquisition.
Async operation to await Data Acquisition state.
boost::future< ResultType > Initiate()
Initiates operation that await state.
TEST_F(TestAsyncOpAwaitState, ConditionAlreadySatisfiedReturnsReadyFuture)
EXPECT_EQ(meta.rr_uri, "zpb.rr://meta")
ASSERT_TRUE(std::holds_alternative< OlasReceiver >(spec.receivers[0]))
Defines shared test utilities.