Skip to content

Commit

Permalink
Check that Services are accessible from ESProducer
Browse files Browse the repository at this point in the history
If the Service system is not available, tests using this module will throw an exception.
  • Loading branch information
Dr15Jones authored and fwyzard committed Jul 15, 2020
1 parent fc92bcd commit 9197def
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions FWCore/Integration/test/WhatsItESProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/TriggerNamesService.h"

#include "FWCore/Integration/test/WhatsIt.h"
#include "FWCore/Integration/test/Doodad.h"
Expand All @@ -34,6 +35,8 @@
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/Utilities/interface/ESGetToken.h"

#include "FWCore/ServiceRegistry/interface/Service.h"

//
// class decleration
//
Expand Down Expand Up @@ -113,6 +116,10 @@ namespace edmtest {

// ------------ method called to produce the data ------------
WhatsItESProducer::ReturnType WhatsItESProducer::produce(const GadgetRcd& iRecord) {
//This tests that the Service system is accessible from a ESProducer
edm::Service<edm::service::TriggerNamesService> tns;
tns->getProcessName();

edm::ESHandle<Doodad> doodad = iRecord.getHandle(token_);
auto pWhatsIt = std::make_unique<WhatsIt>();
pWhatsIt->a = doodad->a;
Expand Down

0 comments on commit 9197def

Please sign in to comment.