28 {
29 cout << "*** AthenaOutputStream_test starts ***" << endl;
30 ISvcLocator* pSvcLoc( 0 );
31 if ( !initGaudi( "AthenaOutputStream_test.txt", pSvcLoc ) )
32 {
33 cerr << "This test can not be run" << endl;
34 return 0;
35 }
36 assert( pSvcLoc );
37
38
39 const bool CREATEIF( true );
40 IClassIDSvc* pCLIDSvc( 0 );
41 assert( ( pSvcLoc->service( "ClassIDSvc", pCLIDSvc, CREATEIF ) ).isSuccess() );
42 assert( pCLIDSvc );
43
44 StoreGateSvc* pStore( 0 );
45 assert( ( pSvcLoc->service( "StoreGateSvc", pStore, CREATEIF ) ).isSuccess() );
46 assert( pStore );
47
48 SmartIF<IAlgManager> algMan( IID_IAlgManager, pSvcLoc );
49 assert( algMan.isValid() );
50 IAlgorithm* pAlg( 0 );
51 assert( ( algMan->createAlgorithm( "AthenaOutputStream", "AthenaOutputStream", pAlg ) )
52 .isSuccess() );
53
54 assert( ( pAlg->sysInitialize() ).isSuccess() );
55 assert( ( pAlg->initialize() ).isSuccess() );
56
57 assert( ( pStore->record( new Foo(), "uno" ) ).isSuccess() );
58 assert( ( pStore->record( new Foo(), "due" ) ).isSuccess() );
59 assert( ( pStore->record( new Bar(), "uno" ) ).isSuccess() );
60 assert( ( pStore->record( new Bar(), "due" ) ).isSuccess() );
61
62 AthenaOutputStream* pStream( dynamic_cast<AthenaOutputStream*>( pAlg ) );
63 assert( pStream );
64
65
66 pStream->collectAllObjects();
67
68
69
70
71
72 assert( 4 == ( pStream->selectedObjects()->end() - pStream->selectedObjects()->begin() ) );
73
74 pStream->clearSelection();
75 assert( 0 == ( pStream->selectedObjects()->end() - pStream->selectedObjects()->begin() ) );
76
77
78 cout << "*** AthenaOutputStream_test OK ***" << endl;
79 return 0;
80}