TestServiceUsingService_module.cc
Go to the documentation of this file.
7 
8 namespace art {
9  namespace test {
10  class TestServiceUsingService;
11  }
12 }
13 
15 public:
18 
19  void analyze(art::Event const&) override;
20 
21  void beginJob() override;
22  void endJob() override;
23 
24 private:
26 };
27 
29  fhicl::ParameterSet const& p)
30  : EDAnalyzer{p}
31  , debug_level_{ServiceHandle<ServiceUsing const>()->getCachedValue()}
32 {}
33 
35 {
36  // Test that art::ServiceHandle can be dereferenced in a module destructor
38  ->getCachedValue();
39 }
40 
41 void
43 {
44  // NOP.
45 }
46 
47 void
49 {
51  BOOST_CHECK_EQUAL(debug_level_, sus->getCachedValue());
52  BOOST_CHECK_EQUAL(ServiceHandle<Wanted const> {}->getCachedValue(),
53  sus->getCachedValue());
54 }
55 
56 void
58 {
60  BOOST_CHECK(sus->postBeginJobCalled());
61 
62  int const current_value{sus->getCachedValue()};
63  BOOST_CHECK_NE(debug_level_, current_value);
64  BOOST_CHECK_EQUAL(ServiceHandle<Wanted const> {}->getCachedValue(),
65  current_value);
66 }
67 
Definition: test.py:1
TestServiceUsingService(fhicl::ParameterSet const &)
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
p
Definition: test.py:228
void analyze(art::Event const &) override