42{
43 ISvcLocator * m_svcLoc;
45
46
47 const int SZ = 3;
48 std::string FileName="";
50 std::string filename_in[SZ] = {"../cmt/CppUnit_jobOptions.txt", "../test/CppUnit_jobOptions.txt", "../share/CppUnit_jobOptions.txt"};
52
53 for (
int i=0;
i<SZ;
i++)
54 {
56 try
57 {
59 if (!inFile[i])
60 throw(fn);
62 }
63 catch(std::string fn)
64 {
65
66 }
67
69
70 }
71
72
73
74
75
76 if ( FileName == "" )
77 {
78 FileName = "../run/CppUnit_jobOptions_generated.txt";
79 std::system("touch ../run/CppUnit_jobOptions_generated.txt; rm ../run/CppUnit_jobOptions_generated.txt");
80 std::ofstream jobopt("../run/CppUnit_jobOptions_generated.txt");
81
82 {
83 std::list<std::string>
opts;
84 opts.push_back(
"#pragma print off");
85 opts.push_back(
"ApplicationMgr.Dlls += { \"StoreGate\" };");
86
87 opts.push_back(
"ApplicationMgr.ExtSvc += { \"ClassIDSvc\" };");
88 opts.push_back(
"ApplicationMgr.ExtSvc += { \"StoreGateSvc\", \"StoreGateSvc/DetectorStore\", \"StoreGateSvc/HistoryStore\" };");
89 opts.push_back(
"ApplicationMgr.ExtSvc += { \"ActiveStoreSvc\" };");
90 opts.push_back(
"AuditorSvc.Auditors += { \"AlgContextAuditor\"};");
91 opts.push_back(
"StoreGateSvc.OutputLevel = 2;");
92 opts.push_back(
"StoreGateSvc.ActivateHistory = false;");
93
94 opts.push_back(
"MessageSvc.useColors = false;");
95 opts.push_back(
"MessageSvc.OutputLevel = 3;");
96
97 for ( std::list<std::string>::const_iterator iopt=
opts.begin();
98 iopt!=
opts.end(); ++iopt )
99 {
100 jobopt << *iopt << std::endl;
101 }
102 }
103 jobopt.close();
104 }
105 try {
107
109 m_svcLoc = 0;
111 std::cerr << "This test can not be run" << std::endl;
112 return false;
113 }
114 CPPUNIT_ASSERT( 0 != m_svcLoc);
115
116 m_storeGate = 0;
117 static const bool CREATE(
true);
118 bool sc = ( m_svcLoc->service(
"StoreGateSvc",
119 m_storeGate,
CREATE) ).isSuccess();
120 CPPUNIT_ASSERT(
sc );
121 CPPUNIT_ASSERT( 0 != m_storeGate );
122
123 if (
false ==
sc || 0 == m_storeGate ) {
124 std::string
error =
"No valid pointer to StoreGateSvc !!";
125 std::cerr <<
error << std::endl;
126
127 return false;
128 } else {
129 return true;
130 }
131 } catch ( std::exception& e ) {
132 std::cerr <<
"Catched : " <<
e.what() << std::endl;
133 return false;
134 }
135}
The Athena Transient Store API.
bool initGaudi(ISvcLocator *&pSvcLoc)
Minimal Gaudi initialization for unit testing without job options.