BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
AthenaOutputStream_test.cxx File Reference

unit test for AtRndSvc More...

#include <cassert>
#include <iostream>
#include <vector>
#include "TestTools/initGaudi.h"
#include "ToyConversion/FooBar.h"
#include "GaudiKernel/IAlgorithm.h"
#include "GaudiKernel/IAlgManager.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/IDataSelector.h"
#include "GaudiKernel/SmartIF.h"
#include "AthenaKernel/IClassIDSvc.h"
#include "BesServices/AthenaOutputStream.h"
#include "StoreGate/StoreGateSvc.h"

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

unit test for AtRndSvc

Author
Paolo Calafiura pcala.nosp@m.fiur.nosp@m.a@lbl.nosp@m..gov -ATLAS Collaboration
Id
AthenaOutputStream_test.cxx,v 1.1.1.1 2004/09/28 01:51:05 liwd Exp

Definition in file AthenaOutputStream_test.cxx.

Function Documentation

◆ main()

int main ( )

Definition at line 28 of file AthenaOutputStream_test.cxx.

28 {
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;
33 return 0;
34 }
35 assert(pSvcLoc);
36
37 //locate necessary stuff
38 const bool CREATEIF(true);
39 IClassIDSvc* pCLIDSvc(0);
40 assert( (pSvcLoc->service("ClassIDSvc", pCLIDSvc, CREATEIF)).isSuccess() );
41 assert( pCLIDSvc );
42
43 StoreGateSvc* pStore(0);
44 assert( (pSvcLoc->service("StoreGateSvc", pStore, CREATEIF)).isSuccess() );
45 assert( pStore );
46
47 SmartIF<IAlgManager> algMan(IID_IAlgManager, pSvcLoc);
48 assert( algMan.isValid() );
49 IAlgorithm* pAlg(0);
50 assert( (algMan->createAlgorithm( "AthenaOutputStream", "AthenaOutputStream", pAlg)).isSuccess() );
51
52 assert( (pAlg->sysInitialize()).isSuccess() );
53 assert( (pAlg->initialize()).isSuccess() );
54
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());
59
60 AthenaOutputStream* pStream(dynamic_cast<AthenaOutputStream*>(pAlg));
61 assert( pStream );
62
63 //fill the vector of selected objects
64 pStream->collectAllObjects();
65
66 // cout << pStream->selectedObjects()->end() -
67 // pStream->selectedObjects()->begin() <<endl;
68 // verify that we got the right objects in the list
69 // this of course depends on AthenaOutputStream_test.txt
70 assert( 4 == (pStream->selectedObjects()->end() -
71 pStream->selectedObjects()->begin()) );
72
73 pStream->clearSelection();
74 assert( 0 == (pStream->selectedObjects()->end() -
75 pStream->selectedObjects()->begin()) );
76
77
78 //all done
79 cout << "*** AthenaOutputStream_test OK ***" <<endl;
80 return 0;
81}