| 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 the module loads properly, with the exportable |
|---|
| 12 |
# functions shared. |
|---|
| 13 |
BEGIN { use_ok('HoneyClient::Agent') or diag("Can't load HoneyClient::Agent package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 14 |
require_ok('HoneyClient::Agent'); |
|---|
| 15 |
can_ok('HoneyClient::Agent', 'init'); |
|---|
| 16 |
can_ok('HoneyClient::Agent', 'destroy'); |
|---|
| 17 |
use HoneyClient::Agent; |
|---|
| 18 |
|
|---|
| 19 |
# Make sure HoneyClient::Util::SOAP loads. |
|---|
| 20 |
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."); } |
|---|
| 21 |
require_ok('HoneyClient::Util::SOAP'); |
|---|
| 22 |
can_ok('HoneyClient::Util::SOAP', 'getServerHandle'); |
|---|
| 23 |
can_ok('HoneyClient::Util::SOAP', 'getClientHandle'); |
|---|
| 24 |
use HoneyClient::Util::SOAP qw(getServerHandle getClientHandle); |
|---|
| 25 |
|
|---|
| 26 |
# Make sure HoneyClient::Util::Config loads. |
|---|
| 27 |
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."); } |
|---|
| 28 |
require_ok('HoneyClient::Util::Config'); |
|---|
| 29 |
can_ok('HoneyClient::Util::Config', 'getVar'); |
|---|
| 30 |
use HoneyClient::Util::Config qw(getVar); |
|---|
| 31 |
|
|---|
| 32 |
# TODO: Change Driver::IE to Driver::Browser::IE |
|---|
| 33 |
# Make sure HoneyClient::Agent::Driver::IE loads. |
|---|
| 34 |
BEGIN { use_ok('HoneyClient::Agent::Driver::IE') or diag("Can't load HoneyClient::Agent::Driver::IE package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 35 |
require_ok('HoneyClient::Agent::Driver::IE'); |
|---|
| 36 |
can_ok('HoneyClient::Agent::Driver::IE', 'new'); |
|---|
| 37 |
can_ok('HoneyClient::Agent::Driver::IE', 'drive'); |
|---|
| 38 |
can_ok('HoneyClient::Agent::Driver::IE', 'getNextLink'); |
|---|
| 39 |
can_ok('HoneyClient::Agent::Driver::IE', 'next'); |
|---|
| 40 |
can_ok('HoneyClient::Agent::Driver::IE', 'isFinished'); |
|---|
| 41 |
can_ok('HoneyClient::Agent::Driver::IE', 'status'); |
|---|
| 42 |
use HoneyClient::Agent::Driver::IE; |
|---|
| 43 |
|
|---|
| 44 |
# Make sure Storable loads. |
|---|
| 45 |
BEGIN { use_ok('Storable', qw(nfreeze thaw)) or diag("Can't load Storable package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 46 |
require_ok('Storable'); |
|---|
| 47 |
can_ok('Storable', 'nfreeze'); |
|---|
| 48 |
can_ok('Storable', 'thaw'); |
|---|
| 49 |
use Storable qw(nfreeze thaw); |
|---|
| 50 |
|
|---|
| 51 |
# Make sure MIME::Base64 loads. |
|---|
| 52 |
BEGIN { use_ok('MIME::Base64', qw(encode_base64 decode_base64)) or diag("Can't load MIME::Base64 package. Check to make sure the package library is correctly listed within the path."); } |
|---|
| 53 |
require_ok('MIME::Base64'); |
|---|
| 54 |
can_ok('MIME::Base64', 'encode_base64'); |
|---|
| 55 |
can_ok('MIME::Base64', 'decode_base64'); |
|---|
| 56 |
use MIME::Base64 qw(encode_base64 decode_base64); |
|---|
| 57 |
|
|---|
| 58 |
#XXX: Check to see if the port number should be externalized. |
|---|
| 59 |
# Global test variables. |
|---|
| 60 |
our $PORT = getVar(name => "port", |
|---|
| 61 |
namespace => "HoneyClient::Agent"); |
|---|
| 62 |
our ($stub, $som); |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
# =begin testing |
|---|
| 68 |
{ |
|---|
| 69 |
# XXX: Test init() method. |
|---|
| 70 |
our $URL = HoneyClient::Agent->init(); |
|---|
| 71 |
our $PORT = getVar(name => "port", |
|---|
| 72 |
namespace => "HoneyClient::Agent"); |
|---|
| 73 |
our $HOST = getVar(name => "address", |
|---|
| 74 |
namespace => "HoneyClient::Agent"); |
|---|
| 75 |
is($URL, "http://$HOST:$PORT/HoneyClient/Agent", "init()") or diag("Failed to start up the VM SOAP server. Check to see if any other daemon is listening on TCP port $PORT."); |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
# =begin testing |
|---|
| 81 |
{ |
|---|
| 82 |
# XXX: Test destroy() method. |
|---|
| 83 |
is(HoneyClient::Agent->destroy(), 1, "destroy()") or diag("Unable to terminate Agent SOAP server. Be sure to check for any stale or lingering processes."); |
|---|
| 84 |
|
|---|
| 85 |
# TODO: delete this. |
|---|
| 86 |
#exit; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
# =begin testing |
|---|
| 92 |
{ |
|---|
| 93 |
# XXX: Fill this in. |
|---|
| 94 |
1; |
|---|
| 95 |
} |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
1; |
|---|