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
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
64 pStream->collectAllObjects();
65
66
67
68
69
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
79 cout << "*** AthenaOutputStream_test OK ***" <<endl;
80 return 0;
81}