| 1 |
#!/usr/bin/perl -w |
|---|
| 2 |
|
|---|
| 3 |
use strict; |
|---|
| 4 |
use Test::More 'no_plan'; |
|---|
| 5 |
$| = 1; |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
# =begin testing |
|---|
| 10 |
{ |
|---|
| 11 |
# Make sure Log::Log4perl loads |
|---|
| 12 |
BEGIN { use_ok('Log::Log4perl', qw(:nowarn)) |
|---|
| 13 |
or diag("Can't load Log::Log4perl package. Check to make sure the package library is correctly listed within the path."); |
|---|
| 14 |
|
|---|
| 15 |
# Suppress all logging messages, since we need clean output for unit testing. |
|---|
| 16 |
Log::Log4perl->init({ |
|---|
| 17 |
"log4perl.rootLogger" => "DEBUG, Buffer", |
|---|
| 18 |
"log4perl.appender.Buffer" => "Log::Log4perl::Appender::TestBuffer", |
|---|
| 19 |
"log4perl.appender.Buffer.min_level" => "fatal", |
|---|
| 20 |
"log4perl.appender.Buffer.layout" => "Log::Log4perl::Layout::PatternLayout", |
|---|
| 21 |
"log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", |
|---|
| 22 |
}); |
|---|
| 23 |
} |
|---|
| 24 |
require_ok('Log::Log4perl'); |
|---|
| 25 |
use Log::Log4perl qw(:easy); |
|---|
| 26 |
|
|---|
| 27 |
# Make sure HoneyClient::Util::Config loads. |
|---|
| 28 |
BEGIN { use_ok('HoneyClient::Util::Config', qw(getVar)) |
|---|
| 29 |
or diag("Can't load HoneyClient::Util::Config package. Check to make sure the package library is correctly listed within the path."); |
|---|
| 30 |
|
|---|
| 31 |
# Suppress all logging messages, since we need clean output for unit testing. |
|---|
| 32 |
Log::Log4perl->init({ |
|---|
| 33 |
"log4perl.rootLogger" => "DEBUG, Buffer", |
|---|
| 34 |
"log4perl.appender.Buffer" => "Log::Log4perl::Appender::TestBuffer", |
|---|
| 35 |
"log4perl.appender.Buffer.min_level" => "fatal", |
|---|
| 36 |
"log4perl.appender.Buffer.layout" => "Log::Log4perl::Layout::PatternLayout", |
|---|
| 37 |
"log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", |
|---|
| 38 |
}); |
|---|
| 39 |
|
|---|
| 40 |
} |
|---|
| 41 |
require_ok('HoneyClient::Util::Config'); |
|---|
| 42 |
can_ok('HoneyClient::Util::Config', 'getVar'); |
|---|
| 43 |
use HoneyClient::Util::Config qw(getVar); |
|---|
| 44 |
|
|---|
| 45 |
# Make sure the module loads properly, with the exportable |
|---|
| 46 |
# functions shared. |
|---|
| 47 |
BEGIN { use_ok('HoneyClient::Manager::Database') or diag("Can't load HoneyClient::Manager::Database package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 48 |
require_ok('HoneyClient::Manager::Database'); |
|---|
| 49 |
use HoneyClient::Manager::Database; |
|---|
| 50 |
|
|---|
| 51 |
# Suppress all logging messages, since we need clean output for unit testing. |
|---|
| 52 |
Log::Log4perl->init({ |
|---|
| 53 |
"log4perl.rootLogger" => "DEBUG, Buffer", |
|---|
| 54 |
"log4perl.appender.Buffer" => "Log::Log4perl::Appender::TestBuffer", |
|---|
| 55 |
"log4perl.appender.Buffer.min_level" => "fatal", |
|---|
| 56 |
"log4perl.appender.Buffer.layout" => "Log::Log4perl::Layout::PatternLayout", |
|---|
| 57 |
"log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", |
|---|
| 58 |
}); |
|---|
| 59 |
|
|---|
| 60 |
# Make sure we use the exception testing library. |
|---|
| 61 |
require_ok('Test::Exception'); |
|---|
| 62 |
can_ok('Test::Exception', 'dies_ok'); |
|---|
| 63 |
use Test::Exception; |
|---|
| 64 |
|
|---|
| 65 |
# Make sure YAML::XS loads. |
|---|
| 66 |
BEGIN { use_ok('YAML::XS') or diag("Can't load YAML::XS package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 67 |
require_ok('YAML::XS'); |
|---|
| 68 |
use YAML::XS; |
|---|
| 69 |
|
|---|
| 70 |
# Make sure XML::RPC loads. |
|---|
| 71 |
BEGIN { use_ok('XML::RPC') or diag("Can't load XML::RPC package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 72 |
require_ok('XML::RPC'); |
|---|
| 73 |
use XML::RPC; |
|---|
| 74 |
|
|---|
| 75 |
# Make sure Data::Dumper loads. |
|---|
| 76 |
BEGIN { use_ok('Data::Dumper') or diag("Can't load Data::Dumper package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 77 |
require_ok('Data::Dumper'); |
|---|
| 78 |
use Data::Dumper; |
|---|
| 79 |
|
|---|
| 80 |
# Make sure LWP::UserAgent loads. |
|---|
| 81 |
BEGIN { use_ok('LWP::UserAgent') or diag("Can't load LWP::UserAgent package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 82 |
require_ok('LWP::UserAgent'); |
|---|
| 83 |
use LWP::UserAgent; |
|---|
| 84 |
|
|---|
| 85 |
# Make sure Data::Structure::Util loads. |
|---|
| 86 |
BEGIN { use_ok('Data::Structure::Util', qw(unbless)) or diag("Can't load Data::Structure::Util package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 87 |
require_ok('Data::Structure::Util'); |
|---|
| 88 |
can_ok('Data::Structure::Util', 'unbless'); |
|---|
| 89 |
use Data::Structure::Util; |
|---|
| 90 |
} |
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
1; |
|---|