diff --git a/AtlasTest/DatabaseTest/RDBAccessTest/CMakeLists.txt b/AtlasTest/DatabaseTest/RDBAccessTest/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c4f05c531b08f816c5cf15f0986185e5bcfcfc27 --- /dev/null +++ b/AtlasTest/DatabaseTest/RDBAccessTest/CMakeLists.txt @@ -0,0 +1,30 @@ +################################################################################ +# Package: RDBAccessTest +################################################################################ + +# Declare the package name: +atlas_subdir( RDBAccessTest ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + Control/MinimalRunTime + GaudiKernel + TestPolicy + PRIVATE + Database/AthenaPOOL/RDBAccessSvc ) + +# External dependencies: +find_package( Boost COMPONENTS filesystem thread system ) +find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) + +# Component(s) in the package: +atlas_add_component( RDBAccessTest + src/*.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AthenaBaseComps GaudiKernel ) + +# Install files from the package: +atlas_install_headers( RDBAccessTest ) +atlas_install_joboptions( share/*.py ) + diff --git a/AtlasTest/DatabaseTest/RDBAccessTest/RDBAccessTest/RDBAccessTest.h b/AtlasTest/DatabaseTest/RDBAccessTest/RDBAccessTest/RDBAccessTest.h index 8fe0ca8faa1ff8623828ea08d24fd87ba5f393bf..47ccbb6bb8af4325c892ab7e119ab6ad5e3e4183 100755 --- a/AtlasTest/DatabaseTest/RDBAccessTest/RDBAccessTest/RDBAccessTest.h +++ b/AtlasTest/DatabaseTest/RDBAccessTest/RDBAccessTest/RDBAccessTest.h @@ -14,7 +14,7 @@ #ifndef RDBACCESSTEST_H #define RDBACCESSTEST_H -#include "GaudiKernel/Algorithm.h" +#include "AthenaBaseComps/AthAlgorithm.h" class IRDBRecordset; @@ -25,7 +25,7 @@ class IRDBRecordset; * */ -class RDBAccessTest:public Algorithm +class RDBAccessTest:public AthAlgorithm { public: /// Standard constructor @@ -47,7 +47,6 @@ class RDBAccessTest:public Algorithm private: const IRDBRecordset* m_tifg; - ISvcLocator* m_locator; }; #endif diff --git a/AtlasTest/DatabaseTest/RDBAccessTest/cmt/requirements b/AtlasTest/DatabaseTest/RDBAccessTest/cmt/requirements index 4d01137fde6dff441361795170d058525fd59729..08247f9ed2fc49f29d84c227da6fc1dbbac2de82 100755 --- a/AtlasTest/DatabaseTest/RDBAccessTest/cmt/requirements +++ b/AtlasTest/DatabaseTest/RDBAccessTest/cmt/requirements @@ -4,6 +4,7 @@ use AtlasPolicy AtlasPolicy-* use TestPolicy TestPolicy-* use GaudiInterface GaudiInterface-* External use MinimalRunTime MinimalRunTime-* Control -no_auto_imports +use AthenaBaseComps AthenaBaseComps-* Control apply_pattern component_library library RDBAccessTest *.cxx diff --git a/AtlasTest/DatabaseTest/RDBAccessTest/src/RDBAccessTest.cxx b/AtlasTest/DatabaseTest/RDBAccessTest/src/RDBAccessTest.cxx index 091dae7a91ccc7d78b335c90423079b85c5a4f85..93393e2868aea5ef80e2ba25697923313b934e2a 100755 --- a/AtlasTest/DatabaseTest/RDBAccessTest/src/RDBAccessTest.cxx +++ b/AtlasTest/DatabaseTest/RDBAccessTest/src/RDBAccessTest.cxx @@ -17,12 +17,10 @@ #include "RDBAccessSvc/IRDBAccessSvc.h" #include "RDBAccessSvc/IRDBRecordset.h" #include "RDBAccessSvc/IRDBRecord.h" - -#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ServiceHandle.h" RDBAccessTest::RDBAccessTest(const std::string& name, ISvcLocator* pSvcLocator) : - Algorithm(name, pSvcLocator), - m_locator(pSvcLocator) + AthAlgorithm(name, pSvcLocator) { } @@ -32,22 +30,18 @@ RDBAccessTest::~RDBAccessTest() StatusCode RDBAccessTest::initialize() { - MsgStream log(msgSvc(), name()); - log << MSG::INFO << " initializing " << endreq; - - IRDBAccessSvc* iAccessSvc; - StatusCode sc = m_locator->service("RDBAccessSvc",iAccessSvc); + ATH_MSG_INFO( " initializing " ); - if(sc.isFailure()) - return sc; + ServiceHandle<IRDBAccessSvc> iAccessSvc ("RDBAccessSvc", name()); + ATH_CHECK( iAccessSvc.retrieve() ); iAccessSvc->connect(); - log << MSG::INFO << " Tag for TIFG is " << iAccessSvc->getChildTag("TIFG","ATLAS-00","ATLAS",false) << endreq; + ATH_MSG_INFO( " Tag for TIFG is " << iAccessSvc->getChildTag("TIFG","ATLAS-00","ATLAS",false) ); m_tifg = iAccessSvc->getRecordset("TIFG","ATLAS-00","ATLAS"); iAccessSvc->disconnect(); - log << MSG::INFO << " TIFG data corresponding to ATLAS-00 fetched " << endreq; + ATH_MSG_INFO( " TIFG data corresponding to ATLAS-00 fetched " ); return StatusCode::SUCCESS; } @@ -55,34 +49,33 @@ StatusCode RDBAccessTest::initialize() StatusCode RDBAccessTest::execute() { unsigned int ind; - MsgStream log(msgSvc(), name()); - log << MSG::INFO << " executing " << endreq; + ATH_MSG_INFO( " executing " ); - log << MSG::INFO << " --> Number of records fetched = " << m_tifg->size() << endreq; + ATH_MSG_INFO( " --> Number of records fetched = " << m_tifg->size() ); - log << MSG::INFO << " Iterating by index " << endreq; + ATH_MSG_INFO( " Iterating by index " ); for(ind = 0; ind < m_tifg->size(); ind++) { const IRDBRecord* rec = (*m_tifg)[ind]; - log << MSG::INFO << " STRUCTURE " << ind << endreq; - log << MSG::INFO << " section = " << rec->getInt("SECTION") << endreq; - log << MSG::INFO << " nelem = " << rec->getInt("NELEM") << endreq; - log << MSG::INFO << " dz = " << rec->getDouble("DZ") << endreq; + ATH_MSG_INFO( " STRUCTURE " << ind ); + ATH_MSG_INFO( " section = " << rec->getInt("SECTION") ); + ATH_MSG_INFO( " nelem = " << rec->getInt("NELEM") ); + ATH_MSG_INFO( " dz = " << rec->getDouble("DZ") ); } - log << MSG::INFO << " ****** \n\n " << endreq; + ATH_MSG_INFO( " ****** \n\n " ); - log << MSG::INFO << " Using iterator " << endreq; + ATH_MSG_INFO( " Using iterator " ); IRDBRecordset::const_iterator first = m_tifg->begin(); IRDBRecordset::const_iterator last = m_tifg->end(); ind = 0; for(; first!=last; first++) { - log << MSG::INFO << " STRUCTURE " << ind++ << endreq; - log << MSG::INFO << " section = " << (*first)->getInt("SECTION") << endreq; - log << MSG::INFO << " nelem = " << (*first)->getInt("NELEM") << endreq; - log << MSG::INFO << " dz = " << (*first)->getDouble("DZ") << endreq; + ATH_MSG_INFO( " STRUCTURE " << ind++ ); + ATH_MSG_INFO( " section = " << (*first)->getInt("SECTION") ); + ATH_MSG_INFO( " nelem = " << (*first)->getInt("NELEM") ); + ATH_MSG_INFO( " dz = " << (*first)->getDouble("DZ") ); } return StatusCode::SUCCESS; @@ -90,9 +83,7 @@ StatusCode RDBAccessTest::execute() StatusCode RDBAccessTest::finalize() { - MsgStream log(msgSvc(), name()); - log << MSG::INFO <<" finalizing " << endreq; - + ATH_MSG_INFO(" finalizing " ); return StatusCode::SUCCESS; }