| 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 the module loads properly, with the exportable |
|---|
| 28 |
# functions shared. |
|---|
| 29 |
BEGIN { use_ok('HoneyClient::Util::SOAP', qw(getServerHandle getClientHandle)) or diag("Can't load HoneyClient::Util::SOAP package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 30 |
require_ok('HoneyClient::Util::SOAP'); |
|---|
| 31 |
can_ok('HoneyClient::Util::SOAP', 'getServerHandle'); |
|---|
| 32 |
can_ok('HoneyClient::Util::SOAP', 'getClientHandle'); |
|---|
| 33 |
use HoneyClient::Util::SOAP qw(getServerHandle getClientHandle); |
|---|
| 34 |
|
|---|
| 35 |
# Make sure HoneyClient::Util::Config loads. |
|---|
| 36 |
BEGIN { use_ok('HoneyClient::Util::Config', qw(getVar)) or diag("Can't load HoneyClient::Util::Config package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 37 |
require_ok('HoneyClient::Util::Config'); |
|---|
| 38 |
can_ok('HoneyClient::Util::Config', 'getVar'); |
|---|
| 39 |
use HoneyClient::Util::Config qw(getVar); |
|---|
| 40 |
|
|---|
| 41 |
# Suppress all logging messages, since we need clean output for unit testing. |
|---|
| 42 |
Log::Log4perl->init({ |
|---|
| 43 |
"log4perl.rootLogger" => "DEBUG, Buffer", |
|---|
| 44 |
"log4perl.appender.Buffer" => "Log::Log4perl::Appender::TestBuffer", |
|---|
| 45 |
"log4perl.appender.Buffer.min_level" => "fatal", |
|---|
| 46 |
"log4perl.appender.Buffer.layout" => "Log::Log4perl::Layout::PatternLayout", |
|---|
| 47 |
"log4perl.appender.Buffer.layout.ConversionPattern" => "%d{yyyy-MM-dd HH:mm:ss} %5p [%M] (%F:%L) - %m%n", |
|---|
| 48 |
}); |
|---|
| 49 |
|
|---|
| 50 |
# Make sure SOAP::Lite loads. |
|---|
| 51 |
BEGIN { use_ok('SOAP::Lite') or diag("Can't load SOAP::Lite package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 52 |
require_ok('SOAP::Lite'); |
|---|
| 53 |
use SOAP::Lite; |
|---|
| 54 |
|
|---|
| 55 |
# Make sure SOAP::Transport::HTTP loads. |
|---|
| 56 |
BEGIN { use_ok('SOAP::Transport::HTTP') or diag("Can't load SOAP::Transport::HTTP package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 57 |
require_ok('SOAP::Transport::HTTP'); |
|---|
| 58 |
use SOAP::Transport::HTTP; |
|---|
| 59 |
|
|---|
| 60 |
# Make sure Data::Dumper loads. |
|---|
| 61 |
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."); } |
|---|
| 62 |
require_ok('Data::Dumper'); |
|---|
| 63 |
use Data::Dumper; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
# =begin testing |
|---|
| 69 |
{ |
|---|
| 70 |
# Check to make sure we can get a valid handle. |
|---|
| 71 |
my $daemon = getServerHandle(namespace => "HoneyClient::Manager::VM"); |
|---|
| 72 |
isa_ok($daemon, 'SOAP::Server', "getServerHandle(namespace => 'HoneyClient::Manager::VM')") or diag("The getServerHandle() call failed."); |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
# =begin testing |
|---|
| 78 |
{ |
|---|
| 79 |
# Check to make sure we can get a valid handle. |
|---|
| 80 |
my $stub = getClientHandle(namespace => "HoneyClient::Manager::VM"); |
|---|
| 81 |
isa_ok($stub, 'SOAP::Lite', "getClientHandle(namespace => 'HoneyClient::Manager::VM')") or diag("The getClientHandle() call failed."); |
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
1; |
|---|