Changeset 15021
- Timestamp:
- Sep 25, 2007, 1:50:34 PM (19 years ago)
- Location:
- trunk/DataStore
- Files:
-
- 6 edited
-
lib/DataStore/File/Parser.pm (modified) (2 diffs)
-
lib/DataStore/FileSet.pm (modified) (2 diffs)
-
lib/DataStore/FileSet/Parser.pm (modified) (2 diffs)
-
lib/DataStore/Product.pm (modified) (2 diffs)
-
t/02_fileset_parse.t (modified) (5 diffs)
-
t/06_fileset.t (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataStore/lib/DataStore/File/Parser.pm
r7951 r15021 1 1 # Copyright (C) 2006 Joshua Hoblitt 2 2 # 3 # $Id: Parser.pm,v 1.1 1 2006-07-22 01:17:33 smalleExp $3 # $Id: Parser.pm,v 1.12 2007-09-25 23:50:34 jhoblitt Exp $ 4 4 5 5 package DataStore::File::Parser; … … 90 90 'is valid http uri' => 91 91 sub { is_uri($_[0]) and $_[0] =~ /^http:/ }, 92 'uri ends with /' => sub { $_[0] =~ m|/$| }, 92 'uri ends with /index.txt' => 93 sub { $_[0] =~ m|/index.txt$| }, 94 93 95 }, 94 96 default => 'http://example.org/', -
trunk/DataStore/lib/DataStore/FileSet.pm
r11834 r15021 1 1 # Copyright (C) 2006 Joshua Hoblitt 2 2 # 3 # $Id: FileSet.pm,v 1.1 2 2007-02-15 22:04:03jhoblitt Exp $3 # $Id: FileSet.pm,v 1.13 2007-09-25 23:50:34 jhoblitt Exp $ 4 4 5 5 package DataStore::FileSet; … … 119 119 type => SCALAR, 120 120 callbacks => { 121 'is valid uri dirname' => sub { $_[0] =~ m|/$| }, 121 'uri ends with /index.txt' 122 => sub { $_[0] =~ m|/index.txt$| }, 122 123 } 123 124 }, -
trunk/DataStore/lib/DataStore/FileSet/Parser.pm
r15020 r15021 1 1 # Copyright (C) 2006 Joshua Hoblitt 2 2 # 3 # $Id: Parser.pm,v 1.1 4 2007-09-25 23:37:44 jhoblitt Exp $3 # $Id: Parser.pm,v 1.15 2007-09-25 23:50:34 jhoblitt Exp $ 4 4 5 5 package DataStore::FileSet::Parser; … … 193 193 type => $type, 194 194 extra => \@extra, 195 uri => $self->base_uri . $fileset . '/ ',195 uri => $self->base_uri . $fileset . '/index.txt', 196 196 }); 197 197 } continue { -
trunk/DataStore/lib/DataStore/Product.pm
r15020 r15021 1 1 # Copyright (C) 2006 Joshua Hoblitt 2 2 # 3 # $Id: Product.pm,v 1. 9 2007-09-25 23:37:44 jhoblitt Exp $3 # $Id: Product.pm,v 1.10 2007-09-25 23:50:34 jhoblitt Exp $ 4 4 5 5 package DataStore::Product; … … 102 102 type => SCALAR, 103 103 callbacks => { 104 'uri ends with /index.txt' => sub { $_[0] =~ m|/index.txt$| }, 104 'uri ends with /index.txt' 105 => sub { $_[0] =~ m|/index.txt$| }, 105 106 } 106 107 }, -
trunk/DataStore/t/02_fileset_parse.t
r15020 r15021 3 3 # Copyright (C) 2006 Joshua Hoblitt 4 4 # 5 # $Id: 02_fileset_parse.t,v 1. 9 2007-09-25 23:37:44 jhoblitt Exp $5 # $Id: 02_fileset_parse.t,v 1.10 2007-09-25 23:50:34 jhoblitt Exp $ 6 6 7 7 use strict; … … 143 143 is(@$results[0]->datetime, '2006-01-01T00:03:04Z', 'correct datetime'); 144 144 is(@$results[0]->type, 'OBJECT', 'correct type'); 145 is(@$results[0]->uri, 'http://foo.com/otis0123456/ ', 'correct uri');145 is(@$results[0]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri'); 146 146 147 147 isa_ok(@$results[1], 'DataStore::FileSet'); … … 149 149 is(@$results[1]->datetime, '2006-01-01T00:03:04Z', 'correct datetime'); 150 150 is(@$results[1]->type, 'OBJECT', 'correct type'); 151 is(@$results[1]->uri, 'http://foo.com/otis0123456/ ', 'correct uri');151 is(@$results[1]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri'); 152 152 153 153 isa_ok(@$results[2], 'DataStore::FileSet'); … … 155 155 is(@$results[2]->datetime, '2006-01-01T00:03:04Z', 'correct datetime'); 156 156 is(@$results[2]->type, 'OBJECT', 'correct type'); 157 is(@$results[2]->uri, 'http://foo.com/otis0123456/ ', 'correct uri');157 is(@$results[2]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri'); 158 158 159 159 isa_ok(@$results[3], 'DataStore::FileSet'); … … 161 161 is(@$results[3]->datetime, '2006-01-01T00:03:04Z', 'correct datetime'); 162 162 is(@$results[3]->type, 'OBJECT', 'correct type'); 163 is(@$results[3]->uri, 'http://foo.com/otis0123456/ ', 'correct uri');163 is(@$results[3]->uri, 'http://foo.com/otis0123456/index.txt', 'correct uri'); 164 164 } 165 165 -
trunk/DataStore/t/06_fileset.t
r8722 r15021 3 3 # Copyright (C) 2006 Joshua Hoblitt 4 4 # 5 # $Id: 06_fileset.t,v 1. 8 2006-08-31 22:58:34 jhoblitt Exp $5 # $Id: 06_fileset.t,v 1.9 2007-09-25 23:50:34 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use lib qw( ./lib ./t ); 11 11 12 use Test::More tests => 1 8;12 use Test::More tests => 19; 13 13 14 14 =head1 NAME … … 33 33 { 34 34 my $dsf = DataStore::FileSet->new( 35 uri => 'http://example.org/ ',35 uri => 'http://example.org/index.txt', 36 36 fileset => '12buckelyourshoe', 37 37 datetime => '2042-01-01T00:00:00Z', … … 44 44 eval { 45 45 my $dsf = DataStore::FileSet->new( 46 uri => 'http://example.org/ ',46 uri => 'http://example.org/index.txt', 47 47 fileset => '12buckelyourshoe', 48 48 datetime => '2042-01-01T00:00:00Z', … … 57 57 my $dsf = DataStore::FileSet->new( uri => 'http://example.org' ); 58 58 }; 59 like($@, qr/ is valid uri dirname/,59 like($@, qr/uri ends with \/index.txt/, 60 60 '->new() fails when uri param does not end with /'); 61 61 62 62 eval { 63 my $dsf = DataStore::FileSet->new( uri => '://example.org' ); 63 my $dsf = DataStore::FileSet->new( uri => 'http://example.org/index.html' ); 64 }; 65 like($@, qr/uri ends with \/index.txt/, 66 '->new() fails when uri param does not end with /'); 67 68 eval { 69 my $dsf = DataStore::FileSet->new( uri => '://example.org/index.txt' ); 64 70 }; 65 71 like($@, qr/is valid http uri/, … … 105 111 print $server->Start(), "\n"; 106 112 107 $server->RegisterURL('/ ', \&bar);113 $server->RegisterURL('/index.txt', \&bar); 108 114 $server->Process(); # Run forever 109 115 … … 116 122 { 117 123 my $dsp = DataStore::FileSet->new( 118 uri => "http://localhost:$port/ ",124 uri => "http://localhost:$port/index.txt", 119 125 fileset => '12buckelyourshoe', 120 126 datetime => '2042-01-01T00:00:00Z', … … 127 133 { 128 134 my $dsp = DataStore::FileSet->new( 129 uri => "http://localhost:$port/ ",135 uri => "http://localhost:$port/index.txt", 130 136 fileset => '12buckelyourshoe', 131 137 datetime => '2042-01-01T00:00:00Z', … … 154 160 eval { 155 161 my $dsf = DataStore::FileSet->new( 156 uri => 'http://example.org/ ',162 uri => 'http://example.org/index.txt', 157 163 fileset => '12buckelyourshoe', 158 164 datetime => '2042-01-01T00:00:00Z',
Note:
See TracChangeset
for help on using the changeset viewer.
