Skip to content

Commit

Permalink
Remove use of legacy module classes from framework tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr15Jones committed Oct 4, 2021
1 parent ec48861 commit ea9139b
Show file tree
Hide file tree
Showing 44 changed files with 186 additions and 244 deletions.
18 changes: 10 additions & 8 deletions FWCore/Framework/test/stubs/DeleteEarlyModules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

// user include files
#include "DataFormats/TestObjects/interface/DeleteEarly.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/Exception.h"
Expand All @@ -26,16 +26,18 @@
#include "FWCore/Framework/interface/Event.h"

namespace edmtest {
class DeleteEarlyProducer : public edm::EDProducer {
class DeleteEarlyProducer : public edm::global::EDProducer<> {
public:
DeleteEarlyProducer(edm::ParameterSet const& pset) { produces<DeleteEarly>(); }
explicit DeleteEarlyProducer(edm::ParameterSet const& pset) { produces<DeleteEarly>(); }

virtual void beginJob() {
void beginJob() override {
// Needed because DeleteEarly objects may be allocated and deleted in initialization
edmtest::DeleteEarly::resetDeleteCount();
}

virtual void produce(edm::Event& e, edm::EventSetup const&) { e.put(std::make_unique<DeleteEarly>()); }
void produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const override {
e.put(std::make_unique<DeleteEarly>());
}
};

class DeleteEarlyReader : public edm::global::EDAnalyzer<> {
Expand All @@ -60,12 +62,12 @@ namespace edmtest {
private:
};

class DeleteEarlyCheckDeleteAnalyzer : public edm::EDAnalyzer {
class DeleteEarlyCheckDeleteAnalyzer : public edm::one::EDAnalyzer<> {
public:
DeleteEarlyCheckDeleteAnalyzer(edm::ParameterSet const& pset)
: m_expectedValues(pset.getUntrackedParameter<std::vector<unsigned int>>("expectedValues")), m_index(0) {}

virtual void analyze(edm::Event const&, edm::EventSetup const&) {
void analyze(edm::Event const&, edm::EventSetup const&) override {
if (DeleteEarly::nDeletes() != m_expectedValues.at(m_index)) {
throw cms::Exception("DeleteEarlyError")
<< "On index " << m_index << " we expected " << m_expectedValues[m_index] << " deletes but we see "
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/test/stubs/HistoryAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
----------------------------------------------------------------------*/

#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "FWCore/Framework/interface/Event.h"
Expand All @@ -27,7 +27,7 @@ namespace edm {

namespace edmtest {

class HistoryAnalyzer : public edm::EDAnalyzer {
class HistoryAnalyzer : public edm::one::EDAnalyzer<> {
public:
explicit HistoryAnalyzer(edm::ParameterSet const& params);
void analyze(edm::Event const& event, edm::EventSetup const&);
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/test/stubs/RunLumiEventAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define Integration_RunLumiEventAnalyzer_h

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/propagate_const.h"

Expand All @@ -14,7 +14,7 @@ namespace edm {

namespace edmtest {

class RunLumiEventAnalyzer : public edm::EDAnalyzer {
class RunLumiEventAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
public:
explicit RunLumiEventAnalyzer(edm::ParameterSet const& pset);

Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/test/stubs/TestMergeResults.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "DataFormats/TestObjects/interface/ThingWithIsEqual.h"
#include "DataFormats/TestObjects/interface/ThingWithMerge.h"
#include "FWCore/Framework/interface/ConstProductRegistry.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/FileBlock.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
Expand All @@ -41,7 +41,7 @@ namespace edm {

namespace edmtest {

class TestMergeResults : public edm::EDAnalyzer {
class TestMergeResults : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
public:
explicit TestMergeResults(edm::ParameterSet const&);
virtual ~TestMergeResults();
Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/test/stubs/TestMod.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

#include <iostream>

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

using namespace edm;

class TestMod : public EDProducer {
class TestMod : public global::EDProducer<> {
public:
explicit TestMod(ParameterSet const& p);

void produce(Event& e, EventSetup const&);
void produce(StreamID, Event& e, EventSetup const&) const final;
};

TestMod::TestMod(ParameterSet const& p) {
Expand All @@ -21,7 +21,7 @@ TestMod::TestMod(ParameterSet const& p) {
// << std::endl;
}

void TestMod::produce(Event&, EventSetup const&) {
void TestMod::produce(StreamID, Event&, EventSetup const&) const {
//std::cerr << "Hi" << std::endl;
}

Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/test/stubs/TestSchedulerModule1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\date 19 May 2005
*/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

Expand All @@ -17,17 +17,17 @@

using namespace edm;

class TestSchedulerModule1 : public EDProducer {
class TestSchedulerModule1 : public global::EDProducer<> {
public:
explicit TestSchedulerModule1(ParameterSet const& p) : pset_(p) { produces<edmtest::StringProduct>(); }

void produce(Event& e, EventSetup const&);
void produce(StreamID, Event& e, EventSetup const&) const final;

private:
ParameterSet pset_;
};

void TestSchedulerModule1::produce(Event& e, EventSetup const&) {
void TestSchedulerModule1::produce(StreamID, Event& e, EventSetup const&) const {
std::string myname = pset_.getParameter<std::string>("module_name");
e.put(std::make_unique<edmtest::StringProduct>(myname));
}
Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/test/stubs/TestSchedulerModule2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
\date 19 May 2005
*/

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

Expand All @@ -17,17 +17,17 @@

namespace edm {

class TestSchedulerModule2 : public EDProducer {
class TestSchedulerModule2 : public global::EDProducer<> {
public:
explicit TestSchedulerModule2(ParameterSet const& p) : pset_(p) { produces<edmtest::StringProduct>(); }

void produce(Event& e, EventSetup const&);
void produce(StreamID, Event& e, EventSetup const&) const final;

private:
ParameterSet pset_;
};

void TestSchedulerModule2::produce(Event& e, EventSetup const&) {
void TestSchedulerModule2::produce(StreamID, Event& e, EventSetup const&) const {
std::string myname = pset_.getParameter<std::string>("module_name");
e.put(std::make_unique<edmtest::StringProduct>(myname));
}
Expand Down
29 changes: 14 additions & 15 deletions FWCore/Framework/test/stubs/ToyAnalyzers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Toy EDAnalyzers for testing purposes only.
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/TestObjects/interface/ToyProducts.h"
//
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/stream/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
Expand All @@ -36,14 +35,14 @@ namespace edmtest {
//
// every call to NonAnalyzer::analyze does nothing.
//
class NonAnalyzer : public edm::EDAnalyzer {
class NonAnalyzer : public edm::global::EDAnalyzer<> {
public:
explicit NonAnalyzer(edm::ParameterSet const& /*p*/) {}
virtual ~NonAnalyzer() {}
virtual void analyze(edm::Event const& e, edm::EventSetup const& c);
~NonAnalyzer() override {}
void analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const& c) const final;
};

void NonAnalyzer::analyze(edm::Event const&, edm::EventSetup const&) {}
void NonAnalyzer::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {}

//--------------------------------------------------------------------
//
Expand Down Expand Up @@ -265,14 +264,14 @@ namespace edmtest {

//--------------------------------------------------------------------
//
class SCSimpleAnalyzer : public edm::EDAnalyzer {
class SCSimpleAnalyzer : public edm::global::EDAnalyzer<> {
public:
SCSimpleAnalyzer(edm::ParameterSet const&) {}

virtual void analyze(edm::Event const& e, edm::EventSetup const&);
void analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const final;
};

void SCSimpleAnalyzer::analyze(edm::Event const& e, edm::EventSetup const&) {
void SCSimpleAnalyzer::analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const {
// Get the product back out; it should be sorted.
edm::Handle<SCSimpleProduct> h;
e.getByLabel("scs", h);
Expand Down Expand Up @@ -330,23 +329,23 @@ namespace edmtest {

//--------------------------------------------------------------------
//
class DSVAnalyzer : public edm::EDAnalyzer {
class DSVAnalyzer : public edm::global::EDAnalyzer<> {
public:
DSVAnalyzer(edm::ParameterSet const&) {}

virtual void analyze(edm::Event const& e, edm::EventSetup const&);
void analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const final;

private:
void do_sorted_stuff(edm::Event const& e);
void do_unsorted_stuff(edm::Event const& e);
void do_sorted_stuff(edm::Event const& e) const;
void do_unsorted_stuff(edm::Event const& e) const;
};

void DSVAnalyzer::analyze(edm::Event const& e, edm::EventSetup const&) {
void DSVAnalyzer::analyze(edm::StreamID, edm::Event const& e, edm::EventSetup const&) const {
do_sorted_stuff(e);
do_unsorted_stuff(e);
}

void DSVAnalyzer::do_sorted_stuff(edm::Event const& e) {
void DSVAnalyzer::do_sorted_stuff(edm::Event const& e) const {
typedef DSVSimpleProduct product_type;
typedef product_type::value_type detset;
typedef detset::value_type value_type;
Expand All @@ -370,7 +369,7 @@ namespace edmtest {
}
}

void DSVAnalyzer::do_unsorted_stuff(edm::Event const& e) {
void DSVAnalyzer::do_unsorted_stuff(edm::Event const& e) const {
typedef DSVWeirdProduct product_type;
typedef product_type::value_type detset;
typedef detset::value_type value_type;
Expand Down
9 changes: 4 additions & 5 deletions FWCore/Framework/test/stubs/ToyDoubleProducers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Toy EDProducers of doubles for testing purposes only.
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/TestObjects/interface/ToyProducts.h"

#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand All @@ -29,20 +29,19 @@ namespace edmtest {
// Produces an DoubleProduct instance.
//

class ToyDoubleProducer : public edm::EDProducer {
class ToyDoubleProducer : public edm::global::EDProducer<> {
public:
explicit ToyDoubleProducer(edm::ParameterSet const& p) : value_(p.getParameter<double>("dvalue")) {
produces<DoubleProduct>();
}
explicit ToyDoubleProducer(double d) : value_(d) { produces<DoubleProduct>(); }
virtual ~ToyDoubleProducer() {}
virtual void produce(edm::Event& e, edm::EventSetup const& c);
void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const final;

private:
double value_;
};

void ToyDoubleProducer::produce(edm::Event& e, edm::EventSetup const&) {
void ToyDoubleProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const {
// Make output
e.put(std::make_unique<DoubleProduct>(value_));
}
Expand Down
Loading

0 comments on commit ea9139b

Please sign in to comment.