From 9197def0f8c6a57f166db65bd55cf393dc9dc0ae Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 14 Jul 2020 14:30:58 -0500 Subject: [PATCH] Check that Services are accessible from ESProducer If the Service system is not available, tests using this module will throw an exception. --- FWCore/Integration/test/WhatsItESProducer.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FWCore/Integration/test/WhatsItESProducer.cc b/FWCore/Integration/test/WhatsItESProducer.cc index 927e500e788ac..079212c6ecc98 100644 --- a/FWCore/Integration/test/WhatsItESProducer.cc +++ b/FWCore/Integration/test/WhatsItESProducer.cc @@ -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" @@ -34,6 +35,8 @@ #include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/Utilities/interface/ESGetToken.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + // // class decleration // @@ -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 tns; + tns->getProcessName(); + edm::ESHandle doodad = iRecord.getHandle(token_); auto pWhatsIt = std::make_unique(); pWhatsIt->a = doodad->a;