/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Control/BesServices/BesServices-00-00-11/test/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.

Namespaces

namespace  Athena_test

Functions

int main ()


Detailed Description

unit test for AtRndSvc

Author:
Paolo Calafiura <pcalafiura@lbl.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

int main (  ) 

Definition at line 28 of file AthenaOutputStream_test.cxx.

00028            {
00029   cout << "*** AthenaOutputStream_test starts ***" <<endl;
00030   ISvcLocator* pSvcLoc(0);
00031   if (!initGaudi("AthenaOutputStream_test.txt", pSvcLoc)) {
00032     cerr << "This test can not be run" << endl;
00033     return 0;
00034   }  
00035   assert(pSvcLoc);
00036 
00037   //locate necessary stuff
00038   const bool CREATEIF(true);
00039   IClassIDSvc* pCLIDSvc(0);
00040   assert( (pSvcLoc->service("ClassIDSvc", pCLIDSvc, CREATEIF)).isSuccess() );
00041   assert( pCLIDSvc );
00042 
00043   StoreGateSvc* pStore(0);
00044   assert( (pSvcLoc->service("StoreGateSvc", pStore, CREATEIF)).isSuccess() );
00045   assert( pStore );
00046 
00047   SmartIF<IAlgManager> algMan(IID_IAlgManager, pSvcLoc);
00048   assert( algMan.isValid() );
00049   IAlgorithm* pAlg(0);
00050   assert( (algMan->createAlgorithm( "AthenaOutputStream", "AthenaOutputStream", pAlg)).isSuccess() );
00051 
00052   assert( (pAlg->sysInitialize()).isSuccess() );
00053   assert( (pAlg->initialize()).isSuccess() );
00054 
00055   assert( (pStore->record(new Foo(), "uno")).isSuccess());
00056   assert( (pStore->record(new Foo(), "due")).isSuccess());
00057   assert( (pStore->record(new Bar(), "uno")).isSuccess());
00058   assert( (pStore->record(new Bar(), "due")).isSuccess());
00059   
00060   AthenaOutputStream* pStream(dynamic_cast<AthenaOutputStream*>(pAlg));
00061   assert( pStream );
00062 
00063   //fill the vector of selected objects
00064   pStream->collectAllObjects();
00065 
00066   //  cout << pStream->selectedObjects()->end() - 
00067   //    pStream->selectedObjects()->begin() <<endl;
00068   // verify that we got the right objects in the list
00069   //  this of course depends on AthenaOutputStream_test.txt
00070   assert( 4 == (pStream->selectedObjects()->end() - 
00071                 pStream->selectedObjects()->begin()) );
00072   
00073   pStream->clearSelection();
00074   assert( 0 == (pStream->selectedObjects()->end() - 
00075                 pStream->selectedObjects()->begin()) );
00076 
00077 
00078   //all done
00079   cout << "*** AthenaOutputStream_test OK ***" <<endl;
00080   return 0;
00081 }


Generated on Tue Nov 29 23:14:53 2016 for BOSS_7.0.2 by  doxygen 1.4.7