Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-20 23:56:38

0001 
0002 #include <iostream>
0003 
0004 #include <memory>
0005 
0006 #include "FWCore/Utilities/interface/GetPassID.h"
0007 #include "FWCore/Version/interface/GetReleaseVersion.h"
0008 #include "FWCore/Framework/interface/Frameworkfwd.h"
0009 #include "FWCore/Framework/interface/global/EDProducer.h"
0010 #include "FWCore/Framework/interface/maker/WorkerT.h"
0011 #include "FWCore/Framework/interface/PreallocationConfiguration.h"
0012 #include "FWCore/Framework/interface/ExceptionActions.h"
0013 #include "DataFormats/Provenance/interface/ProductRegistry.h"
0014 #include "FWCore/Framework/interface/maker/WorkerMaker.h"
0015 #include "FWCore/Framework/interface/maker/MakeModuleParams.h"
0016 
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 
0019 #include "cppunit/extensions/HelperMacros.h"
0020 
0021 using namespace edm;
0022 
0023 class TestMod : public global::EDProducer<> {
0024 public:
0025   explicit TestMod(ParameterSet const& p);
0026 
0027   void produce(StreamID, Event& e, EventSetup const&) const override;
0028 };
0029 
0030 TestMod::TestMod(ParameterSet const&) { produces<int>(); }
0031 
0032 void TestMod::produce(StreamID, Event&, EventSetup const&) const {}
0033 
0034 // ----------------------------------------------
0035 class testmaker2 : public CppUnit::TestFixture {
0036   CPPUNIT_TEST_SUITE(testmaker2);
0037   CPPUNIT_TEST(maker2Test);
0038   CPPUNIT_TEST_SUITE_END();
0039 
0040 public:
0041   void setUp() {}
0042   void tearDown() {}
0043   void maker2Test();
0044 };
0045 
0046 ///registration of the test so that the runner can find it
0047 CPPUNIT_TEST_SUITE_REGISTRATION(testmaker2);
0048 
0049 void testmaker2::maker2Test()
0050 //int main()
0051 {
0052   std::unique_ptr<Maker> f = std::make_unique<WorkerMaker<TestMod>>();
0053 
0054   ParameterSet p1;
0055   p1.addParameter("@module_type", std::string("TestMod"));
0056   p1.addParameter("@module_label", std::string("t1"));
0057   p1.addParameter("@module_edm_type", std::string("EDProducer"));
0058   p1.registerIt();
0059 
0060   ParameterSet p2;
0061   p2.addParameter("@module_type", std::string("TestMod"));
0062   p2.addParameter("@module_label", std::string("t2"));
0063   p2.addParameter("@module_edm_type", std::string("EDProducer"));
0064   p2.registerIt();
0065 
0066   edm::ExceptionToActionTable table;
0067 
0068   edm::ProductRegistry preg;
0069   edm::PreallocationConfiguration prealloc;
0070   auto pc =
0071       std::make_shared<ProcessConfiguration>("PROD", edm::ParameterSetID(), edm::getReleaseVersion(), edm::getPassID());
0072   edm::MakeModuleParams params1(&p1, preg, &prealloc, pc);
0073   edm::MakeModuleParams params2(&p2, preg, &prealloc, pc);
0074 
0075   signalslot::Signal<void(const ModuleDescription&)> aSignal;
0076   auto m1 = f->makeModule(params1, aSignal, aSignal);
0077   std::unique_ptr<Worker> w1 = m1->makeWorker(&table);
0078   auto m2 = f->makeModule(params2, aSignal, aSignal);
0079   std::unique_ptr<Worker> w2 = m2->makeWorker(&table);
0080 
0081   //  return 0;
0082 }