11#include "TestTools/initGaudi.h"
12#include "ToyConversion/FooBar.h"
13#include "GaudiKernel/IAlgorithm.h"
14#include "GaudiKernel/IAlgManager.h"
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/IDataSelector.h"
17#include "GaudiKernel/SmartIF.h"
18#include "AthenaKernel/IClassIDSvc.h"
19#include "BesServices/AthenaOutputStream.h"
20#include "StoreGate/StoreGateSvc.h"
26using namespace Athena_test;
29 cout <<
"*** AthenaOutputStream_test starts ***" <<endl;
30 ISvcLocator* pSvcLoc(0);
31 if (!initGaudi(
"AthenaOutputStream_test.txt", pSvcLoc)) {
32 cerr <<
"This test can not be run" << endl;
38 const bool CREATEIF(
true);
39 IClassIDSvc* pCLIDSvc(0);
40 assert( (pSvcLoc->service(
"ClassIDSvc", pCLIDSvc, CREATEIF)).isSuccess() );
43 StoreGateSvc* pStore(0);
44 assert( (pSvcLoc->service(
"StoreGateSvc", pStore, CREATEIF)).isSuccess() );
47 SmartIF<IAlgManager> algMan(IID_IAlgManager, pSvcLoc);
48 assert( algMan.isValid() );
50 assert( (algMan->createAlgorithm(
"AthenaOutputStream",
"AthenaOutputStream", pAlg)).isSuccess() );
52 assert( (pAlg->sysInitialize()).isSuccess() );
53 assert( (pAlg->initialize()).isSuccess() );
55 assert( (pStore->record(
new Foo(),
"uno")).isSuccess());
56 assert( (pStore->record(
new Foo(),
"due")).isSuccess());
57 assert( (pStore->record(
new Bar(),
"uno")).isSuccess());
58 assert( (pStore->record(
new Bar(),
"due")).isSuccess());
60 AthenaOutputStream* pStream(
dynamic_cast<AthenaOutputStream*
>(pAlg));
64 pStream->collectAllObjects();
70 assert( 4 == (pStream->selectedObjects()->end() -
71 pStream->selectedObjects()->begin()) );
73 pStream->clearSelection();
74 assert( 0 == (pStream->selectedObjects()->end() -
75 pStream->selectedObjects()->begin()) );
79 cout <<
"*** AthenaOutputStream_test OK ***" <<endl;