CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

TestBase Class Reference

#include <TestBase.h>

Inheritance diagram for TestBase:
DQMSummaryReader L1TriggerScalerRead RunInfoRead RunSummaryRead

List of all members.

Public Member Functions

virtual void run ()=0
virtual void run ()=0
void setVerbosityLevel (coral::MsgLevel level)
void setVerbosityLevel (coral::MsgLevel level)
 TestBase ()
 TestBase ()
virtual ~TestBase ()
virtual ~TestBase ()

Protected Member Functions

coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)

Private Attributes

coral::IConnection * m_connection

Detailed Description

Definition at line 21 of file TestBase.h.


Constructor & Destructor Documentation

TestBase::TestBase ( )

Definition at line 10 of file TestBase.cc.

References instance.

                  :
  m_connection( 0 ) {
  coral::Context& context = coral::Context::instance();
  context.loadComponent( "CORAL/RelationalPlugins/oracle" );
  coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>( "CORAL/RelationalPlugins/oracle" );    
  if ( ! domain.isValid() )
    throw std::runtime_error( "Could not load the OracleAccess plugin" );
}
TestBase::~TestBase ( ) [virtual]

Definition at line 19 of file TestBase.cc.

References m_connection.

                    {
  if ( m_connection ) delete m_connection;
}
TestBase::TestBase ( )
virtual TestBase::~TestBase ( ) [virtual]

Member Function Documentation

coral::ISession * TestBase::connect ( const std::string &  connectionString,
const std::string &  user,
const std::string &  password 
) [protected]

Definition at line 24 of file TestBase.cc.

References instance, m_connection, and python::CommonUtils::session.

Referenced by L1TriggerScalerRead::dropTable(), RunSummaryRead::readData(), RunInfoRead::readData(), L1TriggerScalerRead::readData(), and DQMSummaryReader::readData().

                                           {
  coral::Context& ctx = coral::Context::instance();
  coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle");
  if ( ! iHandle.isValid() ) 
    throw std::runtime_error( "Could not load the OracleAccess plugin" );
  
  std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString );
  if ( ! m_connection )
    m_connection = iHandle->newConnection( connectionAndSchema.first );

  if ( ! m_connection->isConnected() )
    m_connection->connect();

  coral::ISession* session = m_connection->newSession( connectionAndSchema.second );
  if ( session ) 
    session->startUserSession( user, pass );
  
  return session;
}
coral::ISession* TestBase::connect ( const std::string &  connectionString,
const std::string &  user,
const std::string &  password 
) [protected]
virtual void TestBase::run ( ) [pure virtual]
virtual void TestBase::run ( ) [pure virtual]
void TestBase::setVerbosityLevel ( coral::MsgLevel  level)

Definition at line 47 of file TestBase.cc.

                                                 {
  coral::MessageStream::setMsgVerbosity(level);
}
void TestBase::setVerbosityLevel ( coral::MsgLevel  level)

Member Data Documentation

coral::IConnection * TestBase::m_connection [private]

Definition at line 33 of file TestBase.h.

Referenced by connect(), and ~TestBase().