Changeset 345
- Timestamp:
- 01/06/07 20:52:25 (2 years ago)
- Files:
-
- library/perl/trunk/Assurer/examples/config.yaml (modified) (1 diff)
- library/perl/trunk/Assurer/lib/Assurer.pm (modified) (1 diff)
- library/perl/trunk/Assurer/lib/Assurer/Plugin.pm (modified) (1 diff)
- library/perl/trunk/Assurer/lib/Assurer/Plugin/HTTP.pm (modified) (2 diffs)
- library/perl/trunk/Assurer/lib/Assurer/Test.pm (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
library/perl/trunk/Assurer/examples/config.yaml
r343 r345 1 global: 2 config: 3 no_diag: 1 4 1 5 plugins: 2 6 - module: HTTP 7 name: http://svn.mizzy.org/ #0 3 8 config: 4 9 url: http://svn.mizzy.org/ 5 10 match: It works! 11 12 - module: HTTP 13 name: http://svn.mizzy.org/ #1 14 config: 15 url: http://svn.mizzy.org/ 16 match: It not works! library/perl/trunk/Assurer/lib/Assurer.pm
r343 r345 47 47 $class->use or die $@; 48 48 49 $class->new({ config => $plugin->{config} })->run; 49 $class->new({ 50 config => $plugin->{config}, 51 name => $plugin->{name}, 52 })->run; 50 53 } 54 } 55 56 sub log { 57 my ($self, $level, $msg) = @_; 58 warn "[$level] $msg\n"; 51 59 } 52 60 library/perl/trunk/Assurer/lib/Assurer/Plugin.pm
r343 r345 3 3 use strict; 4 4 use warnings; 5 use UNIVERSAL::require; 5 6 6 7 sub new { 7 8 my ( $class, $args ) = @_; 8 9 9 my $self = { 10 config => $args->{config}, 11 }; 10 my $self = { %$args }; 12 11 13 12 bless $self, $class; 13 14 my $name = $self->{name} || 'no name'; 15 $self->log('info', "Testing $name"); 16 return $self; 17 } 18 19 sub log { 20 my $self = shift; 21 Assurer->context->log(@_); 14 22 } 15 23 library/perl/trunk/Assurer/lib/Assurer/Plugin/HTTP.pm
r343 r345 3 3 use strict; 4 4 use warnings; 5 use Test::More tests => 1;6 5 use base qw( Assurer::Plugin ); 6 use Assurer::Test; 7 7 use LWP::Simple; 8 8 … … 10 10 my $self = shift; 11 11 12 like ( get($self->{config}->{url}), qr/$self->{config}->{match}/ ); 12 my $url = $self->{config}->{url}; 13 my $match = $self->{config}->{match}; 14 like ( 15 get($url), 16 qr/$match/, 17 "Content of $url matches '$match'", 18 ); 13 19 } 14 20
