ApTest Manager documentation: API: SuiteDB

SuiteDB

NAME

SuiteDB - suite metadata class

AUTHOR

Shane P. McCarron <shane@aptest.com>

COPYRIGHT

Copyright 2004-2006 Applied Testing and Technology, Inc. All Rights Reserved.

SYNOPSIS

use SuiteDB;

# open the suite Database for writing
my $db = new SuiteDB(1);

# who is the creator of this suite?
my $name = $db->creator()

# and what is the description
my $desc = $db->description() ;

# release the database
$db->release();

The SuiteDB object is a generic multi-level data structure storage facility. The data stored in this facility is expected to be keyed by a unique value - usually a value prefixed by the module that wanted to store it. The purpose of this data store is to act as a general use storage facility for meta information related to items in a Test Suite (e.g., test session summary information).

The data structure of this object is optimized to be most efficient when used in conjunction with MLDBM and a single key hashed database (with short key names). This object CAN use serialized objects as well, but it is MUCH slower. Note that when using MLDBM, the save method doesn't do anything (except possibly for the first time it is called if the database had not yet been converted to MLDBM format).

DATA STRUCTURE

lock
a handle to the lock that is set for the object
writeable
a boolean that indicates whether the session is open read/write
usingDBM
a boolean to indicate if the file is from a DBM source
data->
a hash of stored test data
{description}
{creator}
{lastEditUpdate}
{lastRunUpdate}
{SET_name}
numtests - the number of tests
locked - whether the set is locked or not
mtime - the last modification time of the set (really the last modification time of any session in the set).
summary - the summary of the set
sessions - the sessions that are in this set
{SESS_nnnn}
assignedto - the list of assignees
description - the description
numtests - the number of tests
numUntested - the number still untested
isActive - whether the session is active or not
locked - whether the session is locked or not
mtime - the last modification time of the session
summary - the summary of the session
testset - the name of the associated test set
user - the name of the user who last changed the set
variable - the hash of session variables

METHODS

new - open the suiteDB

$suiteDb = new SuiteDB(name, [read/write [, timeout[, path]]]);

Creates a new suite database object, optionally opening a non-default target file and optionally making it writeable.

name the name of the test suite to open
read/write boolean set to True if the suite database needs to be writeable or False if it can be readOnly.
timeout the number of seconds to wait for a lock. Defaults to 60 seconds.
path a path to an alternate database (the default is implementation defined).

returns a reference to the suite database object.

initialize - reset the database file.

Removes everything from the database.

returns true if it succeeded, false if it did not.

path - get/set the path to the file

returns a path to the file.

print - print the contents of the suiteDB

$suiteDb->print();
$suiteDb->print(ID);

returns the string-ified version of the entire database.

release - save and release the data object

$suiteDb->release() ;

save - save the database

returns the path saved into, or undef if the save failed.

deleteSession - delete a session from the database

$suiteDb->deleteSession($session);

deletes a session if it is defined.

deleteSet - delete a set from the database

$suiteDb->deleteSet($name);

deletes a set if it is defined.

session - accessor for session data

$suiteDb->session(ID);
$suiteDb->session(ID, ref);

With an ID parameter, retrieves the data for a specific session.

With an ID and a ref, sets the parameters for a session to ref.

returns the pointer a SuiteDB::Session object that represents the specific session.

sessionList - return a list of sessions in the suite, or in a set

@sessionList = $suiteH->sessionList() ;
@sessionList = $suiteH->sessionList(set) ;

set - accessor for set data

$setHash = $suiteDb->set(ID);
$setHash = $suiteDb->set(ID, ref);

With an ID parameter, retrieves the data for a specific set.

With an ID and a ref, sets the parameters for a set to ref.

Adds a lastChangeTime key to the dataset when updating a test set. Returns the pointer to the data for a specific set.

setList - return a list of sets in the suite

@setList = $suiteDb->setList() ;

lastEditUpdate - return the timestamp of the last edit change

$time = $suiteDb->lastEditUpdate() ;

lastRunUpdate - return the timestamp of the last run status change

$time = $suiteDb->lastRunUpdate() ;
$time = $suiteDb->lastRunUpdate(setName) ;

dirtyFlag - set the last update time at now and mark dirty

$val = $suiteDb->dirtyFlag( [ state ] ) ;

If state is supplied, it is a value to set. When state is 0, the data is NOT dirty. When state is 1, the associated "Run" data was updated, and the data is dirty. When state is 2, the associated "Edit" data was updated and the data is dirty.

Returns undef if the database is not writeable. Otherwise returns the current value of the dirtyFlag state;

userList - get/set the list of users with specific privileges

@list = $suiteDb->userList(alevel, [listRef] ) ;

Returns a list of users who have an access level of at least "alevel". If the user database has not been updated since the list for this level was last cached, just returns the cached list. Otherwise generates a new list, updates the cache, and returns that list.

Returns the list of users.

results - get a handle to a test suite results object

$rRef = $suiteDb->results( [ $rRef ] ) ;

$rRef is an optional reference to a results object. If provided, that object is put into the suiteDB cache. Otherwise, the object currently in the cache is returned.

variables - get a handle to a test suite variableset object

$vRef = $suiteDb->variables( [ $vRef ] ) ;

$vRef is an optional reference to a VariableSet object. If provided, that object is put into the suiteDB cache. Otherwise, the object currently in the cache is returned.

schema - get a handle to a test suite schema object

$sRef = $suiteDb->schema( [ $sRef ] ) ;

$sRef is an optional reference to a schema object. If provided, that object is put into the suiteDB cache. Otherwise, the object currently in the cache is returned.

variableSet - get a handle to a test suite variable set

$vset = $suiteDb->dirtyFlag( [ curSet ] ) ;

If curSet is supplied, it is used as a handle to a variable set object for the suiteDB. Otherwise, one is initialized.

Returns a handle to a variable set.

SuiteDB::Session

NAME

SuiteDB::Session - class for manipulating session metadata

METHODS

new - create a new Session object

$session = new SuiteDB::Session(sessnum) ;

Creates a session object. Returns a reference to the created object.

defaultVariable - return a variable OR the default if it is not set

$value = $session->defaultVariable() ;

Returns the value of the variable from the session, or the default value if the session has no setting for the variable.

variable - accessor for variable attributes

$session->variable(varName) ;
varName
the name of the variable.

returns the value of variable in a scalar context.

DESTROY() - tidy up

SuiteDB::Set

NAME

SuiteDB::Set - class for manipulating set metadata

METHODS

new - create a new Set object

$set = SuiteDB::Set->new(setname, hashRef) ;

Creates a set object. Returns a reference to the created object.

Copyright © 2000-2006 Applied Testing and Technology, Inc. All rights reserved.