my
$NUMBER_OF_TESTS
= 6;
if
( !
defined
(
$ENV
{HELIOS_INI}) ) {
plan
skip_all
=>
'$HELIOS_INI not set; tests skipped.'
;
}
else
{
plan
tests
=>
$NUMBER_OF_TESTS
;
}
use_ok(
'Helios::Config'
);
my
$config_class
= Helios::Config->init();
ok (
$config_class
->parseConfig(),
'parsing configuration'
);
my
$conf
=
$config_class
->getConfig();
ok(
defined
(
$conf
->{dsn}),
'dsn for collective database'
);
if
(
defined
(
$conf
->{log_priority_threshold}) ) {
delete
$conf
->{log_priority_threshold};
}
use_ok(
'HeliosX::Logger::HiRes'
);
HeliosX::Logger::HiRes->setConfig(
$conf
);
HeliosX::Logger::HiRes->setService(
'HeliosX::Logger::HiRes'
);
HeliosX::Logger::HiRes->setHostname(
$config_class
->getHostname());
HeliosX::Logger::HiRes->init();
ok( HeliosX::Logger::HiRes->logMsg(
undef
, 7,
"Test message"
) );
my
$d
= HeliosX::Logger::HiRes->getDriver();
my
@test_msgs
=
$d
->search(
'HeliosX::Logger::HiRes::LogEntry'
=> {
service
=>
'HeliosX::Logger::HiRes'
} );
cmp_ok(
scalar
(
@test_msgs
),
'>='
, 1,
scalar
(
@test_msgs
).
' test msgs actually logged'
);
foreach
(
@test_msgs
) {
$d
->remove(
$_
);
}