2 #define BOOST_TEST_MODULE (eventprincipal_t) 3 #include "boost/test/unit_test.hpp" 45 return os << pd.
get();
54 std::map<std::string, art::ProductID> productIDs_{};
55 std::map<std::string, art::ProcessConfiguration*> processConfigurations_{};
76 descriptions.push_back(fake_single_process_branch(
"hlt",
"HLT"));
77 descriptions.push_back(fake_single_process_branch(
"prod",
"PROD"));
78 descriptions.push_back(fake_single_process_branch(
"test",
"TEST"));
79 descriptions.push_back(fake_single_process_branch(
"user",
"USER"));
80 descriptions.push_back(fake_single_process_branch(
"rick",
"USER2",
"rick"));
87 string const& processName,
92 processParams.
put(processName, moduleParams);
93 processParams.
put(
"process_name", processName);
96 processConfigurations_[tag] =
result;
106 string const moduleLabel{processName +
"dummyMod"};
107 string const moduleClass{
"DummyModule"};
110 modParams.
put(
"module_type", moduleClass);
111 modParams.
put(
"module_label", moduleLabel);
121 *fake_single_module_process(tag, processName, modParams)};
122 productIDs_.emplace(tag,
result.productID());
129 std::unique_ptr<art::EventPrincipal> pEvent_{
nullptr};
135 EventID const eventID{101, 87, 20};
139 std::unique_ptr<art::EDProduct> product =
140 std::make_unique<art::Wrapper<arttest::DummyProduct>>();
143 auto i = ptf().productIDs_.find(
tag);
146 auto pd = ptf().producedProducts_.get(
InEvent).description(i->second);
149 auto entryDescriptionPtr = std::make_shared<art::Parentage>();
150 auto productProvenancePtr = std::make_unique<art::ProductProvenance const>(
153 entryDescriptionPtr->parents());
155 auto*
process = ptf().processConfigurations_[
tag];
161 auto rp = std::make_unique<art::RunPrincipal>(runAux, *
process,
nullptr);
165 std::make_unique<art::SubRunPrincipal>(subRunAux, *
process,
nullptr);
166 srp->setRunPrincipal(rp.get());
169 pEvent_ = std::make_unique<art::EventPrincipal>(eventAux, *
process,
nullptr);
170 pEvent_->setSubRunPrincipal(srp.get());
171 pEvent_->createGroupsForProducedProducts(ptf().producedProducts_);
172 pEvent_->enableLookupOfProducedProducts(ptf().producedProducts_);
174 *pd,
move(productProvenancePtr),
move(product), make_unique<RangeSet>());
177 auto pdPtr = pEvent_->getProductDescription(i->second);
193 auto const&
h = pEvent_->getByProductID(invalid);
194 BOOST_TEST(
h.failed());
201 auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
204 auto const&
h = pEvent_->getBySelector(
206 BOOST_TEST(
h.failed());
213 auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
217 auto const&
h = pEvent_->getByLabel(
219 BOOST_TEST(
h.failed());
226 auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
229 auto const& query_results = pEvent_->getMany(
231 BOOST_TEST(query_results.empty());
238 auto const& wrapped = art::WrappedTypeID::make<art::ProductID>();
246 BOOST_TEST(query_results.empty());
249 BOOST_AUTO_TEST_SUITE_END()
EventPrincipalTestFixture()
art::BranchDescription fake_single_process_branch(std::string const &tag, std::string const &processName, std::string const &productInstanceName={})
constexpr pointer get() const noexcept
std::vector< BranchDescription > ProductDescriptions
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
ProcessConfiguration * fake_single_module_process(std::string const &tag, std::string const &processName, fhicl::ParameterSet const &moduleParams, std::string const &release=art::getReleaseVersion())
std::string const & getReleaseVersion()
RunNumber_t run() const noexcept
ParameterSetID id() const
RunNumber_t run() const noexcept
std::ostream & boost_test_print_type(std::ostream &os, cet::exempt_ptr< BranchDescription const > const pd)
static constexpr ProductID invalid() noexcept
constexpr ProductStatus present() noexcept
void put(std::string const &key)
ProductTablesFixture & ptf()
BOOST_AUTO_TEST_CASE(failgetbyIdTest)
auto const invalid_module_context