ATLAS Offline Software
Public Member Functions | Public Attributes | Private Attributes | List of all members
Athena_test::InitGaudiGoogleTest Class Reference

#include <InitGaudiGoogleTest.h>

Inheritance diagram for Athena_test::InitGaudiGoogleTest:
Collaboration diagram for Athena_test::InitGaudiGoogleTest:

Public Member Functions

 InitGaudiGoogleTest (MSG::Level level=MSG::ALWAYS)
 Ctor parameter: More...
 
virtual ~InitGaudiGoogleTest ()
 dtor More...
 

Public Attributes

IAppMgrUI * theApp
 public members are visible in tests More...
 
SmartIF< IProperty > propMgr
 
SmartIF< ISvcLocator > svcLoc
 
SmartIF< ISvcManager > svcMgr
 

Private Attributes

MSG::Level m_msgLevel
 

Detailed Description

Definition at line 32 of file InitGaudiGoogleTest.h.

Constructor & Destructor Documentation

◆ InitGaudiGoogleTest()

Athena_test::InitGaudiGoogleTest::InitGaudiGoogleTest ( MSG::Level  level = MSG::ALWAYS)

Ctor parameter:

Parameters
levelcontrols MessageSvc

Definition at line 15 of file InitGaudiGoogleTest.cxx.

15  :
16  // create a new ApplicationMgr w/o singleton behaviour
17  theApp( Gaudi::createApplicationMgrEx( "GaudiCoreSvc",
18  "ApplicationMgr" ) ),
19  propMgr( theApp ),
20  svcLoc( theApp ),
21  svcMgr( theApp ),
22  m_msgLevel( level ) {
23  EXPECT_TRUE( theApp != nullptr );
24  EXPECT_TRUE( propMgr.isValid() );
25  EXPECT_TRUE( svcLoc.isValid() );
26  EXPECT_TRUE( svcMgr.isValid() );
27  // set the new ApplicationMgr as instance in Gaudi
28  Gaudi::setInstance( theApp );
29  EXPECT_TRUE( propMgr->setProperty( "JobOptionsType", "NONE" ).isSuccess() );
30  EXPECT_TRUE( propMgr->setProperty( "OutputLevel",
31  std::to_string( m_msgLevel ) ).isSuccess() );
32  bool lconfig= false;
33  // Configure ApplicationMgr
34  if( m_msgLevel == MSG::ALWAYS ) {
35  // Redirect cout to /dev/null around configure() to get rid of Gaudi
36  // messages in unit tests
37  std::streambuf* coutbuf= std::cout.rdbuf(); // save std::cout buf
38  std::ofstream out( "/dev/null" );
39  std::cout.rdbuf( out.rdbuf() ); // redirect std::cout
40  lconfig= theApp->configure().isSuccess();
41  std::cout.rdbuf( coutbuf ); // restore std::cout
42  }
43  else {
44  // just configure()
45  lconfig= theApp->configure().isSuccess();
46  }
47  EXPECT_TRUE( lconfig ) << "InitGaudiGoogleTest: theApp->configure() failure";
48  EXPECT_TRUE( theApp->initialize().isSuccess() );
49  }

◆ ~InitGaudiGoogleTest()

Athena_test::InitGaudiGoogleTest::~InitGaudiGoogleTest ( )
virtual

dtor

Definition at line 54 of file InitGaudiGoogleTest.cxx.

54  {
55  EXPECT_TRUE( theApp->finalize().isSuccess() );
56  EXPECT_TRUE( theApp->terminate().isSuccess() );
57  }

Member Data Documentation

◆ m_msgLevel

MSG::Level Athena_test::InitGaudiGoogleTest::m_msgLevel
private

Definition at line 55 of file InitGaudiGoogleTest.h.

◆ propMgr

SmartIF<IProperty> Athena_test::InitGaudiGoogleTest::propMgr

Definition at line 49 of file InitGaudiGoogleTest.h.

◆ svcLoc

SmartIF<ISvcLocator> Athena_test::InitGaudiGoogleTest::svcLoc

Definition at line 50 of file InitGaudiGoogleTest.h.

◆ svcMgr

SmartIF<ISvcManager> Athena_test::InitGaudiGoogleTest::svcMgr

Definition at line 51 of file InitGaudiGoogleTest.h.

◆ theApp

IAppMgrUI* Athena_test::InitGaudiGoogleTest::theApp

public members are visible in tests

Definition at line 48 of file InitGaudiGoogleTest.h.


The documentation for this class was generated from the following files:
Athena_test::InitGaudiGoogleTest::theApp
IAppMgrUI * theApp
public members are visible in tests
Definition: InitGaudiGoogleTest.h:48
Athena_test::InitGaudiGoogleTest::m_msgLevel
MSG::Level m_msgLevel
Definition: InitGaudiGoogleTest.h:55
Athena_test::InitGaudiGoogleTest::svcMgr
SmartIF< ISvcManager > svcMgr
Definition: InitGaudiGoogleTest.h:51
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
Athena_test::InitGaudiGoogleTest::propMgr
SmartIF< IProperty > propMgr
Definition: InitGaudiGoogleTest.h:49
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TrigConf::MSGTC::ALWAYS
@ ALWAYS
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:29
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Athena_test::InitGaudiGoogleTest::svcLoc
SmartIF< ISvcLocator > svcLoc
Definition: InitGaudiGoogleTest.h:50