16#include <TSSLSocket.h>
21# include <ext/stdio_filebuf.h>
38 m_f1 =
"/etc/redhat-release";
44 m_fr2 =
"http://annwm.lbl.gov/~leggett/tuple2.rt";
45 m_fr3 =
"https://t-dpm.grid.sinica.edu.tw/dpm/grid.sinica.edu.tw/home/atlas/atlasppsscratchdisk/mc10_7TeV/AOD/"
46 "e574_s1110_s1100_r1655_r1700/"
47 "mc10_7TeV.105805.filtered_minbias6.merge.AOD.e574_s1110_s1100_r1655_r1700_tid261524_00/"
48 "AOD.261524._032551.pool.root.1";
60 error() <<
"unable to register POSIX file open action with FileMgr" <<
endmsg;
64 error() <<
"unable to register POSIX file open ERR action with FileMgr" <<
endmsg;
70 error() <<
"unable to register all Close action with FileMgr" <<
endmsg;
94 std::ofstream ofs{
m_f3 };
95 ofs <<
"initial line" << std::endl;
109 error() <<
"the following error is expected" <<
endmsg;
112 info() <<
"unable to open " <<
m_f2 <<
" for WRITE|CREATE|EXCL - expected as file already exists" <<
endmsg;
114 error() <<
"opened " <<
m_f2 <<
" for reading with FD: " << fd <<
" This should not occur!" <<
endmsg;
119 error() <<
"unable to open " <<
m_f1 <<
" again for reading" <<
endmsg;
157 for (
int j = 0; j < 2; ++j ) {
160 error() <<
"unable to open t6.txt for writing" <<
endmsg;
162 info() <<
"opened t6.txt for writing, fd: " << fd <<
" will now close" <<
endmsg;
183 __gnu_cxx::stdio_filebuf<char> fb(
fp_2, std::ios::out );
185 ofs.std::ios::rdbuf( &fb );
186 ofs <<
"Hello World!" << std::endl;
191 __gnu_cxx::stdio_filebuf<char> fb2(
fp_3, std::ios::out );
193 ofs2.std::ios::rdbuf( &fb2 );
194 ofs2 <<
"Hello World!" << std::endl;
204 std::vector<std::string> v;
205 std::vector<std::string>::const_iterator itr;
209 log <<
"listing all open files [" << i <<
"]" << std::endl;
210 for ( itr = v.begin(); itr != v.end(); ++itr ) { log <<
" " << *itr << std::endl; }
214 log <<
"listing ALL files [" << i <<
"]" << std::endl;
215 for ( itr = v.begin(); itr != v.end(); ++itr ) { log <<
" " << *itr << std::endl; }
218 std::vector<const Io::FileAttr*> v2;
219 std::vector<const Io::FileAttr*>::const_iterator it2;
221 log <<
"listing all POSIX files ever opened [" << i <<
"]" << std::endl;
222 for ( it2 = v2.begin(); it2 != v2.end(); ++it2 ) { log <<
" " << ( *it2 )->name() << std::endl; }
284 info() <<
"PosixOpenAction called by " << c <<
" for tech " << fa->
tech() <<
" on " << fa <<
endmsg;
305 info() <<
"AllCloseAction called by " << c <<
" for tech " << fa->
tech() <<
" on " << fa <<
endmsg;
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
an algorithm to test the FileMgr
StatusCode initialize() override
StatusCode execute() override
StatusCode finalize() override
ServiceHandle< IFileMgr > p_fileMgr
StatusCode allCloseAction(FILEMGR_CALLBACK_ARGS)
StatusCode PosixOpenAction(FILEMGR_CALLBACK_ARGS)
FileMgrTest(const std::string &name, ISvcLocator *pSvcLocator)
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
const std::string & name() const override
The identifying name of the algorithm object.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
std::function< StatusCode(FILEMGR_CALLBACK_ARGS)> bfcn_action_t