11#define BOOST_TEST_MODULE Test Framework DataSamplingPolicy
12#define BOOST_TEST_MAIN
13#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include <boost/property_tree/ptree.hpp>
49 using boost::property_tree::ptree;
52 config.put(
"id",
"my_policy");
53 config.put(
"active",
"true");
54 config.put(
"query",
"c:TST/CHLEB/33;m:TST/MLEKO/33");
55 ptree samplingConditions;
56 ptree conditionRandom;
57 conditionRandom.put(
"condition",
"random");
58 conditionRandom.put(
"fraction",
"0.1");
59 conditionRandom.put(
"seed",
"2137");
60 samplingConditions.push_back(std::make_pair(
"", conditionRandom));
61 config.add_child(
"samplingConditions", samplingConditions);
62 config.put(
"blocking",
"false");
70 const auto& map = policy.getPathMap();
80 DataRef dr{
nullptr,
reinterpret_cast<const char*
>(headerStack.data()),
nullptr};
84 config.put(
"id",
"too-long-policy-name");
93 config.put(
"outputs",
"cc:TST/CHLEB_S/33;mm:TST/MLEKO_S/33");
99 const auto& map = policy.getPathMap();
105 config.put(
"outputs",
"cc:TST/CHLEB_S;mm:TST/MLEKO_S");
111 const auto& map = policy.getPathMap();
122 BOOST_REQUIRE(conditionNConsecutive);
124 boost::property_tree::ptree config;
125 config.put(
"samplesNumber", 3);
126 config.put(
"cycleSize", 10);
127 conditionNConsecutive->configure(config);
131 policy.
registerPath({
"tststs", {
"TST",
"CHLEB"}}, {{
"asdf"},
"AA",
"BBBB"});
A definition of DataSamplingConditionFactory.
A declaration of O2 Data Sampling Policy.
static std::unique_ptr< DataSamplingCondition > create(std::string name)
Creates instance of DataSamplingCondition child, given the name.
static DataSamplingPolicy fromConfiguration(const boost::property_tree::ptree &)
Configures a policy using structured configuration entry.
static header::DataDescription createPolicyDataDescription(std::string policyName, size_t id)
void registerPath(const framework::InputSpec &, const framework::OutputSpec &)
Adds a new association between inputs and outputs.
void registerCondition(std::unique_ptr< DataSamplingCondition > &&)
Adds a new association between inputs and outputs.
static header::DataOrigin createPolicyDataOrigin()
framework::Output prepareOutput(const framework::ConcreteDataMatcher &input, framework::Lifetime lifetime=framework::Lifetime::Timeframe) const
Returns Output for given InputSpec to pass data forward.
Defining PrimaryVertex explicitly as messageable.
A header which contains some meta-data generated by Data Sampling.
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())