[Rt-commit] r5438 - in Test-Chimps: . trunk/bin trunk/examples
zev at bestpractical.com
zev at bestpractical.com
Fri Jun 23 17:34:36 EDT 2006
Author: zev
Date: Fri Jun 23 17:34:34 2006
New Revision: 5438
Modified:
Test-Chimps/ (props changed)
Test-Chimps/trunk/bin/poll_and_submit.pl
Test-Chimps/trunk/bin/report_server.pl
Test-Chimps/trunk/bin/submit_report.pl
Test-Chimps/trunk/examples/list.tmpl
Test-Chimps/trunk/lib/Test/Chimps/Report.pm
Test-Chimps/trunk/lib/Test/Chimps/Server.pm
Log:
r4252 at galvatron (orig r19): zev | 2006-06-21 17:44:06 -0400
r4250 at galvatron: zev | 2006-06-21 17:43:57 -0400
renamed extra_data to report_variables
Modified: Test-Chimps/trunk/bin/poll_and_submit.pl
==============================================================================
--- Test-Chimps/trunk/bin/poll_and_submit.pl (original)
+++ Test-Chimps/trunk/bin/poll_and_submit.pl Fri Jun 23 17:34:34 2006
@@ -74,7 +74,7 @@
@checkout_paths = ();
my $report = Test::Chimps::Report->new(model => $model,
- extra_data =>
+ report_variables =>
{ category => $project,
subcategory => 'repository snapshot / ' . $Config{osname},
project => scalar fileparse($config->{$project}->{svn_uri}),
Modified: Test-Chimps/trunk/bin/report_server.pl
==============================================================================
--- Test-Chimps/trunk/bin/report_server.pl (original)
+++ Test-Chimps/trunk/bin/report_server.pl Fri Jun 23 17:34:34 2006
@@ -3,7 +3,7 @@
use Test::Chimps::Server;
my $server = Test::Chimps::Server->new(base_dir => '/var/www/bps-smokes',
- extra_validation_spec =>
+ variables_validation_spec =>
{ category => 1,
subcategory => 1,
project => 1,
Modified: Test-Chimps/trunk/bin/submit_report.pl
==============================================================================
--- Test-Chimps/trunk/bin/submit_report.pl (original)
+++ Test-Chimps/trunk/bin/submit_report.pl Fri Jun 23 17:34:34 2006
@@ -15,7 +15,7 @@
my $duration = time - $start_time;
my $report = Test::Chimps::Report->new(model => $model,
- extra_data =>
+ report_variables =>
{ category => 'Jifty',
subcategory => 'repository snapshot / Linux',
project => 'jifty',
Modified: Test-Chimps/trunk/examples/list.tmpl
==============================================================================
--- Test-Chimps/trunk/examples/list.tmpl (original)
+++ Test-Chimps/trunk/examples/list.tmpl Fri Jun 23 17:34:34 2006
@@ -79,7 +79,7 @@
% foreach my $report (sort by_revision_then_date
% @{$categories{$category}->{$subcategory}}) {
% my $id = $report->{id};
-% my $data = $report->extra_data;
+% my $data = $report->report_variables;
% my $model = Test::TAP::Model::Visual->new_with_struct($report->model_structure);
<tr>
<td class="report_summary"><% $data->{project} %></td>
@@ -129,19 +129,19 @@
my %categories;
foreach my $report (@reports) {
- my $data = $report->extra_data;
+ my $data = $report->report_variables;
push @{$categories{$data->{category}}->{$data->{subcategory}}}, $report;
}
sub by_revision_then_date {
- my $res = $b->extra_data->{revision} <=> $a->extra_data->{revision};
+ my $res = $b->report_variables->{revision} <=> $a->report_variables->{revision};
if ($res != 0) {
return $res;
}
- my ($adate, $bdate) = (DateTime->from_epoch(epoch => str2time($a->extra_data->{timestamp})),
- DateTime->from_epoch(epoch => str2time($b->extra_data->{timestamp})));
+ my ($adate, $bdate) = (DateTime->from_epoch(epoch => str2time($a->report_variables->{timestamp})),
+ DateTime->from_epoch(epoch => str2time($b->report_variables->{timestamp})));
return DateTime->compare($bdate, $adate);
}
</%init>
Modified: Test-Chimps/trunk/lib/Test/Chimps/Report.pm
==============================================================================
--- Test-Chimps/trunk/lib/Test/Chimps/Report.pm (original)
+++ Test-Chimps/trunk/lib/Test/Chimps/Report.pm Fri Jun 23 17:34:34 2006
@@ -56,9 +56,10 @@
this class in conjunction with C<Test::Chimps::Server>,
C<report_text> should probably be HTML.
-=item * extra_data
+=item * report_variables
-Extra data to be transmitted with the report.
+Report variables to be transmitted with the report. The decision
+of which variables should be submitted is made by the server.
=back
@@ -79,7 +80,7 @@
{
isa => 'Test::TAP::Model'},
report_text => 0,
- extra_data =>
+ report_variables =>
{ optional => 1,
type => HASHREF } },
called => 'The Test::Chimps::Report constructor');
@@ -91,13 +92,13 @@
$self->{report_text} = $args{report_text};
} else {
my $v;
- if (defined $args{extra_data}) {
+ if (defined $args{report_variables}) {
$v = Test::TAP::HTMLMatrix->new($args{model},
- Dump($args{extra_data}));
- $self->{extra_data} = $args{extra_data};
+ Dump($args{report_variables}));
+ $self->{report_variables} = $args{report_variables};
} else {
$v = Test::TAP::HTMLMatrix->new($args{model});
- $self->{extra_data} = '';
+ $self->{report_variables} = '';
}
$v->has_inline_css(1);
$self->{report_text} = $v->detail_html;
@@ -126,15 +127,15 @@
return $self->{report_text};
}
-=head2 extra_data
+=head2 report_variables
Accessor for any extra data passed in.
=cut
-sub extra_data {
+sub report_variables {
my $self = shift;
- return $self->{extra_data};
+ return $self->{report_variables};
}
=head1 AUTHOR
Modified: Test-Chimps/trunk/lib/Test/Chimps/Server.pm
==============================================================================
--- Test-Chimps/trunk/lib/Test/Chimps/Server.pm (original)
+++ Test-Chimps/trunk/lib/Test/Chimps/Server.pm Fri Jun 23 17:34:34 2006
@@ -64,12 +64,6 @@
Burst upload rate allowed (see L<Algorithm::Bucket>). Defaults to
5.
-=item * extra_validation_spec
-
-A hash reference of the form accepted by Params::Validate. If
-supplied, this will be used to validate the extra data submitted to
-the server.
-
=item * list_template
Template filename under base_dir/template_dir to use for listing
@@ -99,6 +93,12 @@
Directory under base_dir where html templates will be stored.
Defaults to 'templates'.
+=item * variables_validation_spec
+
+A hash reference of the form accepted by Params::Validate. If
+supplied, this will be used to validate the report variables
+submitted to the server.
+
=back
=cut
@@ -107,7 +107,7 @@
no strict 'refs';
our @fields = qw/base_dir bucket_file max_rate max_size
max_smokes_per_subcategory report_dir
- template_dir list_template extra_validation_spec/;
+ template_dir list_template variables_validation_spec/;
foreach my $field (@fields) {
*{$field} =
@@ -145,7 +145,7 @@
callbacks =>
{ "greater than or equal to 0" =>
sub { $_[0] >= 0 }} },
- extra_validation_spec =>
+ variables_validation_spec =>
{ type => HASHREF,
optional => 1 },
list_template =>
@@ -218,7 +218,7 @@
print $cgi->header("text/plain");
$self->_limit_rate($cgi);
$self->_validate_params($cgi);
- $self->_extra_validation_spec($cgi);
+ $self->_variables_validation_spec($cgi);
$self->_add_report($cgi);
$self->_clean_old_reports($cgi);
@@ -276,22 +276,22 @@
# uncompress_smoke();
}
-sub _extra_validation_spec {
+sub _variables_validation_spec {
my $self = shift;
my $cgi = shift;
my @reports = map { Load($_) } $cgi->param("reports");
- if (defined $self->{extra_validation_spec}) {
+ if (defined $self->{variables_validation_spec}) {
foreach my $report (@reports) {
eval {
- validate(@{[%{$report->{extra_data}}]}, $self->{extra_validation_spec});
+ validate(@{[%{$report->{report_variables}}]}, $self->{variables_validation_spec});
};
if (defined $@ && $@) {
# XXX: doesn't dump subroutines because we're using YAML::Syck
- print "This server accepts extra parameters. It's validation ",
- "string looks like this:\n", Dump($self->{extra_validation_spec}),
- "\nYour extra data looks like this:\n", Dump($report->{extra_data});
+ print "This server accepts specific report variables. It's validation ",
+ "string looks like this:\n", Dump($self->{variables_validation_spec}),
+ "\nYour extra data looks like this:\n", Dump($report->{report_variables});
exit;
}
More information about the Rt-commit
mailing list