FOSSology  4.4.0
Open Source License Compliance by Open Source Software
FoLibCPPTest Class Reference

Test cases for CPP DB Manager. More...

Inheritance diagram for FoLibCPPTest:
Inheritance graph
Collaboration diagram for FoLibCPPTest:
Collaboration graph

Public Member Functions

 FoLibCPPTest (const FoLibCPPTest &obj)
 
void setUp ()
 
void tearDown ()
 
void test_runCommandQueryCheckIfSuccess ()
 
void test_tableExists ()
 
void test_runSimpleQuery ()
 
void test_runPreparedStatement ()
 
void test_transactions ()
 
void test_runBadCommandQueryCheckIfError ()
 
void test_runSchedulerConnectConstructor ()
 

Private Member Functions

 CPPUNIT_TEST_SUITE (FoLibCPPTest)
 
 CPPUNIT_TEST (test_runSimpleQuery)
 
 CPPUNIT_TEST (test_runCommandQueryCheckIfSuccess)
 
 CPPUNIT_TEST (test_tableExists)
 
 CPPUNIT_TEST (test_runPreparedStatement)
 
 CPPUNIT_TEST (test_transactions)
 
 CPPUNIT_TEST (test_runBadCommandQueryCheckIfError)
 
 CPPUNIT_TEST (test_runSchedulerConnectConstructor)
 
 CPPUNIT_TEST_SUITE_END ()
 

Private Attributes

fo::DbManagerdbManager
 Object for DbManager.
 

Detailed Description

Test cases for CPP DB Manager.

Definition at line 31 of file test_fossdbmanagerclass.cc.

Member Function Documentation

◆ setUp()

void FoLibCPPTest::setUp ( )
inline

One time setup to create test environment and get new DbManager

Definition at line 51 of file test_fossdbmanagerclass.cc.

◆ tearDown()

void FoLibCPPTest::tearDown ( )
inline

Tear down to destroy DbManager object and test environment

Definition at line 58 of file test_fossdbmanagerclass.cc.

◆ test_runBadCommandQueryCheckIfError()

void FoLibCPPTest::test_runBadCommandQueryCheckIfError ( )
inline

Test to check bad query

Test:
  1. Spawn a new DbManager.
  2. Call fo::DbManager::queryPrintf() with a corrupted statement.
  3. Check if result is a failure.
Todo:
implement fo::DbManager::setLogFile() and check that errors pass through

Definition at line 233 of file test_fossdbmanagerclass.cc.

◆ test_runCommandQueryCheckIfSuccess()

void FoLibCPPTest::test_runCommandQueryCheckIfSuccess ( )
inline

Test to check if simple query executes successfully

Test:
  1. Spawn a new DbManager.
  2. Call fo::DbManager::queryPrintf() with simple statement.
  3. Check for the result.

Definition at line 71 of file test_fossdbmanagerclass.cc.

◆ test_runPreparedStatement()

void FoLibCPPTest::test_runPreparedStatement ( )
inline

Test to check fo::DbManager::execPrepared() function

Test:
  1. Spawn a new DbManager.
  2. Create a prepared statement.
  3. Call fo::DbManager::execPrepared() with the newly created statement.
  4. Check for the result.

Definition at line 140 of file test_fossdbmanagerclass.cc.

◆ test_runSchedulerConnectConstructor()

void FoLibCPPTest::test_runSchedulerConnectConstructor ( )
inline

Test to check if DbManager can create connection with scheduler connect

Test:
  1. Create a test sysconf dir with a VERSION file.
  2. Set the argv
  3. Call fo::DbManager::DbManager() with the argv.
  4. Execute a statement and check the result.
Todo:
make this correctly

Definition at line 255 of file test_fossdbmanagerclass.cc.

◆ test_runSimpleQuery()

void FoLibCPPTest::test_runSimpleQuery ( )
inline

Test to check fo::QueryResult::getSimpleResults() function

Test:
  1. Spawn a new DbManager.
  2. Create a new table and insert some values in it.
  3. Call fo::DbManager::queryPrintf() to select new result.
  4. Check the fo::QueryResult object for row count.
  5. Check the value of fo::QueryResult::getSimpleResults().

Definition at line 106 of file test_fossdbmanagerclass.cc.

◆ test_tableExists()

void FoLibCPPTest::test_tableExists ( )
inline

Test to check fo::DbManager::tableExists() function

Test:
  1. Spawn a new DbManager.
  2. Create a new table.
  3. Call fo::DbManager::tableExists() with newly created table.
  4. Check for the result to be true.
  5. Call fo::DbManager::tableExists() with non existing table name.
  6. Check for the result to be false.

Definition at line 88 of file test_fossdbmanagerclass.cc.

◆ test_transactions()

void FoLibCPPTest::test_transactions ( )
inline

Test to check transaction functions

Test:
  1. Spawn a new DbManager.
  2. Create a test table.
  3. Spawn two new DbManager s.
  4. Call fo::DbManager::begin() on new managers.
  5. Insert some data using new managers.
  6. Call fo::DbManager::commit() on one manager.
  7. Call fo::DbManager::rollback() on another manager.
  8. Inserts from other manager should not be there in the table.

Definition at line 183 of file test_fossdbmanagerclass.cc.


The documentation for this class was generated from the following file: