alma::acs::jlog::test::CacheUtils Class Reference

Collaboration diagram for alma::acs::jlog::test::CacheUtils:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static Collection< Integer > generateKeys (int size, boolean exact, int minValue, int maxValue, Collection< Integer > common)
static Collection< ILogEntrygenerateLogs (int numOfLogs) throws Exception
static Collection< ILogEntrygenerateLogsType (int numOfLogs, LogTypeHelper logType) throws Exception
static void populateCache (ILogMap cache, int numOfLogs) throws Exception
static ILogMap getCache (int type, Integer opt) throws Exception
static Collection< Integer > generateKeys (int size, boolean exact, int minValue, int maxValue, Collection< Integer > common)
static Collection< ILogEntrygenerateLogs (int numOfLogs) throws Exception
static Collection< ILogEntrygenerateLogsType (int numOfLogs, LogTypeHelper logType) throws Exception

Static Public Attributes

static final String logHeaderStr = " TimeStamp=\""
static final String logBodyStr = "\" Routine=\"CacheTest::testGet\" Host=\"this\" Process=\"test\" Thread=\"main\" Context=\"\"><![CDATA["
static final String logFooterStr = "]]></"
static final int LOGFILECACHE_TYPE = 0
static final int LOGBUFFEREDFILECACHE_TYPE = 1
static final int LOGCACHE_TYPE = 2
static final int NUMOFCACHETYPES = 3

Static Private Attributes

static ACSLogParser parser

Detailed Description

A collection of methods to be used in the tests

Author:
acaproni

Member Function Documentation

static Collection<Integer> alma::acs::jlog::test::CacheUtils::generateKeys ( int  size,
boolean  exact,
int  minValue,
int  maxValue,
Collection< Integer >  common 
) [inline, static]

Generate a random collection of keys.

The size of the collection can be random or fixed. If it is random then the exact parameter must be false; in that case the number of elements returned is limited by size (inclusive) The number of elements in the collection is fixed if the exact parameter is true; in that case the number of elements returned is specified in size.

If the size is random, the returned collection can be empty.

If common is not null, each generated key must also be present in common. For this to work, the size of common is an upper limit for the size of the returned collection.

Parameters:
size The upper limit of the number of elements in the collection or the number of elements in the returned collection depending on the value of the exact parameter
exact If true the size of the returned collection is equal to size otherwise size is the maximum limit
minValue The minimum allowed value of the keys in the collection (inclusive)
maxValue The maximum allowed value of the keys in the collection (inclusive)
common A collection of keys They key in the returned collection must be present in common too If common is null the keys are generated without constraints
Returns:
A posible empty collection of keys
static Collection<Integer> alma::acs::jlog::test::CacheUtils::generateKeys ( int  size,
boolean  exact,
int  minValue,
int  maxValue,
Collection< Integer >  common 
) [inline, static]

Generate a random collection of keys.

The size of the collection can be random or fixed. If it is random then the exact parameter must be false; in that case the number of elements returned is limited by size (inclusive) The number of elements in the collection is fixed if the exact parameter is true; in that case the number of elements returned is specified in size.

If the size is random, the returned collection can be empty.

If common is not null, each generated key must also be present in common. For this to work, the size of common is an upper limit for the size of the returned collection.

Parameters:
size The upper limit of the number of elements in the collection or the number of elements in the returned collection depending on the value of the exact parameter
exact If true the size of the returned collection is equal to size otherwise size is the maximum limit
minValue The minimum allowed value of the keys in the collection (inclusive)
maxValue The maximum allowed value of the keys in the collection (inclusive)
common A collection of keys They key in the returned collection must be present in common too If common is null the keys are generated without constraints
Returns:
A posible empty collection of keys
static Collection<ILogEntry> alma::acs::jlog::test::CacheUtils::generateLogs ( int  numOfLogs  )  throws Exception [inline, static]

Generate a set of logs to be used for testing Each log has

  • a different time stamp.
  • the message contains the key of the log
  • the log type is random (all types but Trace because trace has no body)
Parameters:
numOfLogs The number of logs to put in the collection
Returns:
The collection with the logs

References logBodyStr, logFooterStr, logHeaderStr, alma::acs::logging::engine::parser::ACSLogParser::parse(), and parser.

static Collection<ILogEntry> alma::acs::jlog::test::CacheUtils::generateLogs ( int  numOfLogs  )  throws Exception [inline, static]

Generate a set of logs to be used for testing Each log has

  • a different time stamp.
  • the message contains the key of the log
  • the log type is random (all types but Trace because trace has no body)
Parameters:
numOfLogs The number of logs to put in the collection
Returns:
The collection with the logs

References logBodyStr, logFooterStr, logHeaderStr, alma::acs::logging::engine::parser::ACSLogParser::parse(), and parser.

Referenced by populateCache().

static Collection<ILogEntry> alma::acs::jlog::test::CacheUtils::generateLogsType ( int  numOfLogs,
LogTypeHelper  logType 
) throws Exception [inline, static]

Generate a set of logs of a given type Each log has

  • a different time stamp.
  • the message contains the key of the log
Parameters:
numOfLogs The number of logs to put in the collection
Returns:
The collection with the logs

References logBodyStr, logFooterStr, logHeaderStr, alma::acs::logging::engine::parser::ACSLogParser::parse(), and parser.

static Collection<ILogEntry> alma::acs::jlog::test::CacheUtils::generateLogsType ( int  numOfLogs,
LogTypeHelper  logType 
) throws Exception [inline, static]

Generate a set of logs of a given type Each log has

  • a different time stamp.
  • the message contains the key of the log
Parameters:
numOfLogs The number of logs to put in the collection
Returns:
The collection with the logs

References logBodyStr, logFooterStr, logHeaderStr, alma::acs::logging::engine::parser::ACSLogParser::parse(), and parser.

static ILogMap alma::acs::jlog::test::CacheUtils::getCache ( int  type,
Integer  opt 
) throws Exception [inline, static]

Create a cache of the given type. The cache is created with the empty constructor if the opt param is null. If opt is not null the cache is created passing opt in the constructor. LogFileCache has only the empty constructor: for this class opt is ignored.

Parameters:
type The type of the cache
opt The optional integer argument (if it is null, the cache is created with the empty constructor)
Returns:
The cache implementing ILogMap

References LOGBUFFEREDFILECACHE_TYPE, LOGCACHE_TYPE, and LOGFILECACHE_TYPE.

static void alma::acs::jlog::test::CacheUtils::populateCache ( ILogMap  cache,
int  numOfLogs 
) throws Exception [inline, static]

Add numOfLogs log to the cache.

Parameters:
cache The cache to fill with logs
numOfLogs The number of logs to insert in cache

References generateLogs().


Member Data Documentation

static final String alma::acs::jlog::test::CacheUtils::logBodyStr = "\" Routine=\"CacheTest::testGet\" Host=\"this\" Process=\"test\" Thread=\"main\" Context=\"\"><![CDATA[" [static]

Referenced by generateLogs(), and generateLogsType().

Referenced by getCache().

Referenced by getCache().

Referenced by getCache().

static final String alma::acs::jlog::test::CacheUtils::logFooterStr = "]]></" [static]

Referenced by generateLogs(), and generateLogsType().

static final String alma::acs::jlog::test::CacheUtils::logHeaderStr = " TimeStamp=\"" [static]

Referenced by generateLogs(), and generateLogsType().

Referenced by generateLogs(), and generateLogsType().


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

Generated by  doxygen 1.6.2