42 tmpdirPath_ = folly::fs::canonical(tmpdir_.path()).
string();
70 const std::string f(tmpdirPath_ +
"/Basic1"), d1(
"a"), d2(
"b"),
d3(
"c");
78 auto cbId = updater_->registerFile(
95 updater_->cancelCallback(cbId);
110 const std::string f(tmpdirPath_ +
"/Cancel1"), d(
"111");
112 auto cb = updater_->registerFile(
116 updater_->cancelCallback(cb);
119 EXPECT_THROW(updater_->cancelCallback(cb), std::out_of_range);
136 const std::string f1(tmpdirPath_ +
"/Complex1"), d1(
"a"), d11(
"AA");
137 const std::string f2(tmpdirPath_ +
"/Complex2"), d2(
"b"), d21(
"B"), d22(
"X");
142 std::vector<std::string> data3;
143 size_t count1 = 0, count2 = 0, count3 = 0, count4 = 0;
147 auto cb1 = updater_->registerFile(
156 auto cb2 = updater_->registerFile(
164 updater_->registerFiles(
169 ASSERT_EQ(newData.end(), newData.find(f1));
172 ASSERT_NE(newData.end(), newData.find(f1));
176 data3 = {f3Data, f1Data};
199 EXPECT_EQ(std::vector<std::string>({
d3,
"<NODATA>"}), data3);
212 EXPECT_EQ(std::vector<std::string>({
d3, d1}), data3);
215 auto cb4 = updater_->registerFile(
223 delayedWrite(f2, d21);
239 updater_->cancelCallback(cb1);
250 EXPECT_EQ(std::vector<std::string>({
d3, d11}), data3);
253 updater_->cancelCallback(cb2);
266 updater_->cancelCallback(cb4);
Map::mapped_type get_default(const Map &map, const Key &key)
static const std::chrono::milliseconds kPollIntervalMs
#define EXPECT_THROW(statement, expected_exception)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
std::chrono::steady_clock::time_point now()
void delayedWrite(const std::string &path, const std::string &data)
std::unordered_map< std::string, std::string > CallbackArg
FOLLY_ALWAYS_INLINE void post() noexcept
FOLLY_ALWAYS_INLINE bool try_wait_until(const std::chrono::time_point< Clock, Duration > &deadline, const WaitOptions &opt=wait_options()) noexcept
static const std::chrono::milliseconds kMaxSemaphoreWaitMs
std::unique_ptr< MultiFilePoller > updater_
bool wait(Waiter *waiter, bool shouldSleep, Waiter *&next)
const Map::mapped_type & get_or_throw(const Map &map, const Key &key, const std::string &exceptionStrPrefix=std::string())
bool writeFile(const Container &data, const char *filename, int flags=O_WRONLY|O_CREAT|O_TRUNC, mode_t mode=0666)
#define ASSERT_NE(val1, val2)
#define ASSERT_FALSE(condition)
static const std::chrono::milliseconds kWriteWaitMs
RfcParam d3(false, exampleHex1)
#define ASSERT_TRUE(condition)
static constexpr uint64_t data[1]
Future< typename std::decay< T >::type > makeFuture(T &&t)
TEST_F(AcceptorTest, TestCanAcceptWithNoConnectionCounter)