APP-REST-RestTestSuite
view release on metacpan or search on metacpan
checking prerequisites...
requires:
! LWP::Parallel::UserAgent is not installed
- run below command to install any dependent modules.
you need a internet connection for this.
perl Build installdeps
[*] if you get "Net::SSLeay" installation error while installing
'LWP::Parallel::Useragent'
= install following packages based on your Linux flavour
- For Debian based (e.g. Ubuntu ) run below command
sudo apt-get install libssl-dev
- For RPM based ( e.g RHEL, CentOS) run below command
yum -y install openssl-devel
===================================================
lib/APP/REST/ParallelMyUA.pm view on Meta::CPAN
#print time,"Connecting to ", $request->url, "\n";
print STDERR ".";
$entry->{tick}->{start} = time;
}
=head2 on_failure
on_failure gets called whenever a connection fails right away
(either we timed out, or failed to connect to this address before,
or it's a duplicate). Please note that non-connection based
errors, for example requests for non-existant pages, will NOT call
on_failure since the response from the server will be a well
formed HTTP response!
=cut
sub on_failure {
my ( $self, $request, $response, $entry ) = @_;
print "Failed to connect to ", $request->url, "\n\t", $response->code, ", ",
$response->message, "\n"
if $response;
lib/APP/REST/ParallelMyUA.pm view on Meta::CPAN
if ( $response->is_success ) {
#print "\n\nWoa! Request to ",$request->url," returned code ", $response->code,
# ": ", $response->message, "\n";
#print $response->content;
} else {
#print "\n\nBummer! Request to ",$request->url," returned code ", $response->code,
# ": ", $response->message, "\n";
#print $response->error_as_HTML;
}
return;
}
1;
=head1 AUTHOR
Mithun Radhakrishnan, C<< <rkmithun at cpan.org> >>
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
use Data::Dumper;
use HTTP::Request;
use Time::HiRes qw( time sleep );
use File::Path;
use Cwd;
use LWP::UserAgent;
use APP::REST::ParallelMyUA;
use constant LOG_FILE => 'rest_client.log';
use constant ERR_LOG_FILE => 'rest_client_error.log';
use constant LINE => '=' x 50;
$| = 1; #make the pipe hot
$Data::Dumper::Indent = 1;
=head1 NAME
APP::REST::RestTestSuite - Suite for testing restful web services
=head1 VERSION
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
$total++;
}
print STDERR "\nRequesting [$total] web services together.\n";
foreach my $req (@reqs) {
# register all requests and wait for them to finish
if ( my $res = $pua->register($req) ) {
print STDERR $res->error_as_HTML;
}
}
print STDERR "Receiving response from web services. Please wait..!\n";
# will return once all forked web services are either completed or timeout
my $entries = $pua->wait();
print STDERR "\n\n";
foreach ( keys %$entries ) {
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
$log_dir,
(
$self->{html_log_required}
&& ( $self->{html_log_required} =~ /yes/i )
)
? LOG_FILE
. ".html"
: LOG_FILE
)
);
my $error_log_file = join(
$separator,
(
$log_dir,
(
$self->{html_log_required}
&& ( $self->{html_log_required} =~ /yes/i )
)
? ERR_LOG_FILE
. ".html"
: ERR_LOG_FILE
)
);
$self->{file}->{log_file} = $log_file;
$self->{file}->{err_log_file} = $error_log_file;
}
sub _open_fh {
my ( $self, %args ) = @_;
my ( $fh, $err ) = (undef) x 2;
my $file = $args{FILE};
my $mode = $args{MODE};
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
406 : Requested representation not available for the resource.
408 : Request has timed out.
409 : State of the resource doesn't permit request.
410 : The URI used to refer to a resource.
411 : The server needs to know the size of the entity body and it should be specified in the Content Length header.
412 : Operation not completed because preconditions were not met.
413 : The representation was too large for the server to handle.
414 : The URI has more than 2k characters.
415 : Representation not supported for the resource.
416 : Requested range not satisfiable.
500 : Internal server error.
501 : Requested HTTP operation not supported.
502 : Backend service failure (data store failure).
505 : HTTP version not supported.
############################
#END_HTTP_CODE_DEF
############################
####################
#END_OF_CONFIG_FILE
####################
( run in 1.056 second using v1.01-cache-2.11-cpan-65fba6d93b7 )