Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv10555/lib/HTTP/WebTest/Plugin
Modified Files:
TextMatchTest.pm SetRequest.pm ResponseTimeTest.pm Loader.pm
HarnessReport.pm DefaultReport.pm Cookies.pm
ContentSizeTest.pm Apache.pm
Log Message:
Test parameters validation API have been changed. All plugins have
been fixed to conform new API. This change is required for proper
support of embeded Perl in wtscript files.
Index: TextMatchTest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/TextMatchTest.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** TextMatchTest.pm 2002/01/24 12:26:33 1.1.1.1
--- TextMatchTest.pm 2002/02/02 04:08:19 1.2
***************
*** 76,84 ****
sub param_types {
! return { qw(ignore_case yesno
! text_forbid list
! text_require list
! regex_forbid list
! regex_require list) };
}
--- 76,84 ----
sub param_types {
! return q(ignore_case yesno
! text_forbid list
! text_require list
! regex_forbid list
! regex_require list);
}
***************
*** 88,91 ****
--- 88,95 ----
# response content
my $content = $self->webtest->last_response->content;
+
+ $self->validate_params(qw(ignore_case
+ text_forbid text_require
+ regex_forbid regex_require));
# ignore case or not?
Index: SetRequest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SetRequest.pm 2002/01/28 06:32:02 1.2
--- SetRequest.pm 2002/02/02 04:08:19 1.3
***************
*** 89,123 ****
sub param_types {
! return { qw(url uri
! method string
! params hashlist
! auth list
! proxies hashlist
! pauth list) };
! }
!
! sub validate_params {
! my $self = shift;
! my $params = shift;
!
! my %checks = $self->SUPER::validate_params($params);
!
! if(exists $checks{method}) {
! $checks{method} &&=
! $self->test_result($params->{method} =~ /^(?:GET|POST)$/i ? 1 : 0,
! 'Request method should be either GET or POST.');
! }
! if(exists $checks{auth}) {
! $checks{auth} &&=
! $self->test_result(@{$params->{auth}} == 2,
! 'Parameter auth should have two elements.');
! }
! if(exists $checks{pauth}) {
! $checks{pauth} &&=
! $self->test_result(@{$params->{pauth}} == 2,
! 'Parameter auth should have two elements.');
! }
!
! return %checks;
}
--- 89,98 ----
sub param_types {
! return q(url uri
! method scalar('^(?:GET|POST)$')
! params hashlist
! auth list('scalar','scalar')
! proxies hashlist
! pauth list('scalar','scalar'));
}
***************
*** 130,133 ****
--- 105,111 ----
# get request object
my $request = $self->webtest->last_request;
+
+ $self->validate_params(qw(url method params
+ auth proxies pauth));
# get various params we handle
Index: ResponseTimeTest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/ResponseTimeTest.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ResponseTimeTest.pm 2002/01/24 12:26:30 1.1.1.1
--- ResponseTimeTest.pm 2002/02/02 04:08:19 1.2
***************
*** 45,50 ****
sub param_types {
! return { qw(min_rtime string
! max_rtime string) };
}
--- 45,50 ----
sub param_types {
! return q(min_rtime scalar
! max_rtime scalar);
}
***************
*** 54,57 ****
--- 54,59 ----
# response time
my $rtime = $self->webtest->last_response_time;
+
+ $self->validate_params(qw(min_rtime max_rtime));
# response time limits
Index: Loader.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Loader.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Loader.pm 2002/01/24 12:26:32 1.1.1.1
--- Loader.pm 2002/02/02 04:08:19 1.2
***************
*** 45,53 ****
sub param_types {
! return { qw(plugins list) };
}
sub start_tests {
my $self = shift;
my $plugins = $self->global_test_param('plugins');
--- 45,55 ----
sub param_types {
! return q(plugins list);
}
sub start_tests {
my $self = shift;
+
+ $self->global_validate_params(qw(plugins));
my $plugins = $self->global_test_param('plugins');
Index: HarnessReport.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/HarnessReport.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** HarnessReport.pm 2002/01/24 12:26:30 1.1.1.1
--- HarnessReport.pm 2002/02/02 04:08:19 1.2
***************
*** 54,57 ****
--- 54,59 ----
my @results = @{$self->webtest->last_test->results};
+ $self->validate_params(qw(test_name));
+
my $test_name = $self->test_param('test_name');
my $url = 'N/A';
Index: DefaultReport.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/DefaultReport.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DefaultReport.pm 2002/01/28 06:32:02 1.2
--- DefaultReport.pm 2002/02/02 04:08:19 1.3
***************
*** 102,126 ****
sub param_types {
! return { %{ shift->SUPER::param_types },
! qw(default_report yesno
! test_name string
! show_html yesno
! show_cookies yesno
! terse string) };
! }
!
! sub validate_params {
! my $self = shift;
! my $params = shift;
!
! my %checks = $self->SUPER::validate_params($params);
!
! if(exists $checks{terse}) {
! $checks{terse} &&=
! $self->test_result($params->{terse} =~ /^(?:no|summary|failed_only)$/i ? 1 : 0,
! 'Parameter terse can be either no, summary or failed_only.');
! }
!
! return %checks;
}
--- 102,111 ----
sub param_types {
! return shift->SUPER::param_types . "\n" .
! q(default_report yesno
! test_name scalar
! show_html yesno
! show_cookies yesno
! terse scalar('^(?:no|summary|failed_only)$') );
}
***************
*** 131,134 ****
--- 116,121 ----
my $self = shift;
+ $self->global_validate_params(qw(default_report));
+
return unless $self->global_yesno_test_param('default_report', 1);
***************
*** 142,147 ****
--- 129,139 ----
my $self = shift;
+ $self->global_validate_params(qw(default_report));
+
return unless $self->global_yesno_test_param('default_report', 1);
+ $self->validate_params(qw(test_name show_html
+ show_cookies terse));
+
# get test params we handle
my $test_name = $self->test_param('test_name');
***************
*** 234,237 ****
--- 226,231 ----
sub end_tests {
my $self = shift;
+
+ $self->global_validate_params(qw(default_report));
return unless $self->global_yesno_test_param('default_report', 1);
Index: Cookies.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Cookies.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Cookies.pm 2002/01/24 12:26:29 1.1.1.1
--- Cookies.pm 2002/02/02 04:08:19 1.2
***************
*** 225,232 ****
sub param_types {
! return { qw(accept_cookies yesno
! send_cookies yesno
! cookie list
! cookies list) };
}
--- 225,232 ----
sub param_types {
! return q(accept_cookies yesno
! send_cookies yesno
! cookie list
! cookies list);
}
***************
*** 235,238 ****
--- 235,241 ----
sub prepare_request {
my $self = shift;
+
+ $self->validate_params(qw(accept_cookies send_cookies
+ cookies cookie));
my $accept_cookies = $self->yesno_test_param('accept_cookies', 1);
Index: ContentSizeTest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/ContentSizeTest.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ContentSizeTest.pm 2002/01/24 12:26:32 1.1.1.1
--- ContentSizeTest.pm 2002/02/02 04:08:19 1.2
***************
*** 45,50 ****
sub param_types {
! return { qw(min_bytes string
! max_bytes string) };
}
--- 45,50 ----
sub param_types {
! return q(min_bytes scalar
! max_bytes scalar);
}
***************
*** 54,57 ****
--- 54,59 ----
# response content length
my $nbytes = length $self->webtest->last_response->content;
+
+ $self->validate_params(qw(min_bytes max_bytes));
# size limits
Index: Apache.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/Apache.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Apache.pm 2002/01/28 06:32:02 1.2
--- Apache.pm 2002/02/02 04:08:19 1.3
***************
*** 222,256 ****
sub param_types {
! return { qw(file_path list
! include_file_path list
! apache_dir string
! apache_loglevel string
! apache_exec string
! apache_options string
! apache_max_wait string
! error_log string
! ignore_error_log yesno
! mail_server string
! mail_addresses string) };
! }
!
! sub validate_params {
! my $self = shift;
! my $params = shift;
!
! my %checks = $self->SUPER::validate_params($params);
!
! if(exists $checks{file_path}) {
! $checks{file_path} &&=
! $self->test_result(@{$params->{file_path}} == 2,
! 'Parameter file_path should have two elements.');
! }
! if(exists $checks{include_file_path}) {
! $checks{include_file_path} &&=
! $self->test_result((@{$params->{include_file_path}} % 2) == 0,
! 'Parameter include_file_path should have even number of elements.');
! }
!
! return %checks;
}
--- 222,236 ----
sub param_types {
! return q(file_path list('scalar','scalar')
! include_file_path hashlist
! apache_dir scalar
! apache_loglevel scalar
! apache_exec scalar
! apache_options scalar
! apache_max_wait scalar
! error_log scalar
! ignore_error_log yesno
! mail_server scalar
! mail_addresses scalar);
}
***************
*** 289,292 ****
--- 269,277 ----
my $request = $self->webtest->last_request;
+ $self->global_validate_params(qw(apache_dir apache_loglevel
+ apache_exec apache_options
+ apache_max_wait error_log));
+ $self->validate_params(qw(file_path include_file_path));
+
# get various params we handle
my $apache_dir = $self->global_test_param('apache_dir');
***************
*** 352,355 ****
--- 337,342 ----
my $self = shift;
+ $self->validate_params(qw(ignore_error_log));
+
# get various params we handle
my $ignore_error_log = $self->yesno_test_param('ignore_error_log');
***************
*** 469,472 ****
--- 456,461 ----
my $config = join '', <$fh_in>; # Slurp entire file
$fh_in->close;
+
+ $self->global_validate_params(qw(mail_server mail_addresses));
# get test params we use
|