IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4257


Ignore:
Timestamp:
Jun 14, 2005, 3:02:08 PM (21 years ago)
Author:
evanalst
Message:

Update test case fro psDBInit and psDBCleanup to include error conditions.

Location:
trunk/psLib/test/dataIO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataIO/tst_psDB.c

    r4105 r4257  
    99 *  @author Aaron Culliney, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-03 23:46:07 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-15 01:02:08 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9898    psDB *dbh = NULL;
    9999
    100     psLogMsg( __func__, PS_LOG_INFO, "initialize database connection...\n" );
    101 
     100    // Initialize database connection with test database
    102101    dbh = psDBInit(host, user, passwd, dbname);
    103102    if (dbh == NULL) {
     
    290289}
    291290
    292 // Testpoint #XXX, initialize/break-down MySQL connection.
     291// Testpoint #841, initialize/break-down MySQL connection.
    293292psS32 TPDBInit( void )
    294293{
    295     psS32 failed = 0;
    296     psDB *dbh = NULL;
    297 
    298     psLogMsg( __func__, PS_LOG_INFO, "psDBInit/psDBCleanup shall initialize/cleanup database connection.\n" );
    299 
    300     dbh = _init_psDB();
    301     if (dbh == NULL) {
    302         return 1;
    303     }
    304 
    305     psDBCleanup(dbh);
    306 
    307     return failed;
     294    psDB *dbh = NULL;
     295
     296    // Initialize database with valid arguments
     297    dbh = _init_psDB();
     298    if (dbh == NULL) {
     299        psError(PS_ERR_UNKNOWN,true,"Did not expect NULL to be returned for valid arguments");
     300        return 1;
     301    }
     302
     303    // Cleanup database/connection with valid psDB object
     304    psDBCleanup(dbh);
     305
     306    // Attempt to initialize database with invalid arguments
     307    dbh = psDBInit("xxx",NULL,NULL,NULL);
     308    if(dbh != NULL) {
     309        psError(PS_ERR_UNKNOWN,true,"Did not expect non-NULL psDB with invalid arguments");
     310        return 2;
     311    }
     312
     313    // Attempt cleanup database/connection with NULL psDB object
     314    psDBCleanup(NULL);
     315
     316    return 0;
    308317}
    309318
  • trunk/psLib/test/dataIO/verified/tst_psDB.stderr

    r4128 r4257  
    55\**********************************************************************************/
    66
    7 <DATE><TIME>|<HOST>|I|TPDBInit
    8     psDBInit/psDBCleanup shall initialize/cleanup database connection.
    9 <DATE><TIME>|<HOST>|I|_init_psDB
    10     initialize database connection...
     7<DATE><TIME>|<HOST>|E|psDBInit (FILE:LINENO)
     8    Failed to connect to database.  Error: Unknown MySQL server host 'xxx' (1)
     9<DATE><TIME>|<HOST>|E|psDBCleanup (FILE:LINENO)
     10    Invalid psDB has been specified.
    1111
    1212---> TESTPOINT PASSED (psDB{dbInit} | tst_psDB.c)
     
    1818\**********************************************************************************/
    1919
    20 <DATE><TIME>|<HOST>|I|_init_psDB
    21     initialize database connection...
    2220<DATE><TIME>|<HOST>|I|TPDBChange
    2321    psDBChange shall change to a new test database.
     
    3129\**********************************************************************************/
    3230
    33 <DATE><TIME>|<HOST>|I|_init_psDB
    34     initialize database connection...
    3531<DATE><TIME>|<HOST>|I|TPDBCreateTable
    3632    psDBCreateTable shall create a new table in the new test database.
     
    4440\**********************************************************************************/
    4541
    46 <DATE><TIME>|<HOST>|I|_init_psDB
    47     initialize database connection...
    4842<DATE><TIME>|<HOST>|I|TPDBDropTable
    4943    psDBDropTable shall create/drop a new table in the new test database.
     
    6357\**********************************************************************************/
    6458
    65 <DATE><TIME>|<HOST>|I|_init_psDB
    66     initialize database connection...
    6759<DATE><TIME>|<HOST>|I|TPDBSelectColumn
    6860    psDBSelectColumn shall select data from a test table.
     
    9284\**********************************************************************************/
    9385
    94 <DATE><TIME>|<HOST>|I|_init_psDB
    95     initialize database connection...
    9686<DATE><TIME>|<HOST>|I|TPDBSelectColumnNum
    9787    psDBSelectColumnNum shall select data from a test table.
     
    121111\**********************************************************************************/
    122112
    123 <DATE><TIME>|<HOST>|I|_init_psDB
    124     initialize database connection...
    125113<DATE><TIME>|<HOST>|I|TPDBSelectRows
    126114    psDBSelectRows shall select data from a test table.
     
    166154\**********************************************************************************/
    167155
    168 <DATE><TIME>|<HOST>|I|_init_psDB
    169     initialize database connection...
    170156<DATE><TIME>|<HOST>|I|TPDBInsertOneRow
    171157    psDBInsertOneRow shall insert a row into a test table.
     
    179165\**********************************************************************************/
    180166
    181 <DATE><TIME>|<HOST>|I|_init_psDB
    182     initialize database connection...
    183167<DATE><TIME>|<HOST>|I|TPDBInsertRows
    184168    psDBInsertRows shall insert rows into a test table.
     
    232216\**********************************************************************************/
    233217
    234 <DATE><TIME>|<HOST>|I|_init_psDB
    235     initialize database connection...
    236218<DATE><TIME>|<HOST>|I|TPDBDumpRows
    237219    psDBDumpRows shall dump all rows from a test table.
     
    285267\**********************************************************************************/
    286268
    287 <DATE><TIME>|<HOST>|I|_init_psDB
    288     initialize database connection...
    289269<DATE><TIME>|<HOST>|I|TPDBDumpCols
    290270    psDBDumpCols shall dump all cols from a test table.
    291271<DATE><TIME>|<HOST>|I|_print_row
    292     [key_string]=[]
     272    [key_string]=[]
    293273
    294274---> TESTPOINT PASSED (psDB{dbDumpCols} | tst_psDB.c)
     
    300280\**********************************************************************************/
    301281
    302 <DATE><TIME>|<HOST>|I|_init_psDB
    303     initialize database connection...
    304282<DATE><TIME>|<HOST>|I|TPDBUpdateRows
    305283    psDBUpdateRows shall update rows in a test table.
     
    329307\**********************************************************************************/
    330308
    331 <DATE><TIME>|<HOST>|I|_init_psDB
    332     initialize database connection...
    333309<DATE><TIME>|<HOST>|I|TPDBDeleteRows
    334310    psDBDeleteRows shall delete rows from a test table.
Note: See TracChangeset for help on using the changeset viewer.