/[cwmp]/google/trunk/t/06-queue.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /google/trunk/t/06-queue.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 197 - (hide annotations)
Mon Nov 12 22:03:01 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 709 byte(s)
 r206@brr:  dpavlin | 2007-11-12 23:02:21 +0100
 - move protocol dump to new cpe-queue.pl command
 - queue now stores data in YAML to preserve perl structures intact
 - queue jobs are now finished correctly
 - remove all traces of default_queue

1 dpavlin 194 #!/usr/bin/perl
2     use strict;
3     use warnings;
4    
5     my $debug = shift @ARGV;
6    
7 dpavlin 197 use Test::More tests => 213;
8 dpavlin 194 use Data::Dump qw/dump/;
9     use lib 'lib';
10    
11     BEGIN {
12     use_ok('CWMP::Queue');
13     }
14    
15     #use Cwd qw/abs_path/;
16     #ok(my $abs_path = abs_path($0), "abs_path");
17     #$abs_path =~ s!/[^/]*$!/!; #!fix-vim
18    
19     ok( my $obj = CWMP::Queue->new({
20     id => 'test',
21     debug => $debug,
22     }), 'new' );
23     isa_ok( $obj, 'CWMP::Queue' );
24    
25     for my $i ( 1 .. 42 ) {
26 dpavlin 197 ok( $obj->enqueue({
27 dpavlin 194 i => $i,
28     foo => 'bar',
29 dpavlin 197 }), "enqueue $i" );
30 dpavlin 194 };
31    
32     my $i = 1;
33    
34 dpavlin 197 while ( my $job = $obj->dequeue ) {
35     ok( $job, "dequeue $i" );
36     ok( my $dispatch = $job->dispatch, "dispatch $i" );
37     cmp_ok( $dispatch->{i}, '==', $i, "i == $i" );
38     ok( $job->finish, "finish $i" );
39 dpavlin 194 $i++;
40     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26