IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15021


Ignore:
Timestamp:
Sep 25, 2007, 1:50:34 PM (19 years ago)
Author:
jhoblitt
Message:

convert DataStore::FileSet to use URIs that end as /index.txt$ instead of /$

Location:
trunk/DataStore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/DataStore/lib/DataStore/File/Parser.pm

    r7951 r15021  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.11 2006-07-22 01:17:33 smalle Exp $
     3# $Id: Parser.pm,v 1.12 2007-09-25 23:50:34 jhoblitt Exp $
    44
    55package DataStore::File::Parser;
     
    9090                    'is valid http uri' =>
    9191                        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
    9395                },
    9496                default =>  'http://example.org/',
  • trunk/DataStore/lib/DataStore/FileSet.pm

    r11834 r15021  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: FileSet.pm,v 1.12 2007-02-15 22:04:03 jhoblitt Exp $
     3# $Id: FileSet.pm,v 1.13 2007-09-25 23:50:34 jhoblitt Exp $
    44
    55package DataStore::FileSet;
     
    119119                type        => SCALAR,
    120120                callbacks   => {
    121                     'is valid uri dirname'   => sub { $_[0] =~ m|/$| },
     121                    'uri ends with /index.txt'
     122                        => sub { $_[0] =~ m|/index.txt$| },
    122123                }
    123124            },
  • trunk/DataStore/lib/DataStore/FileSet/Parser.pm

    r15020 r15021  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.14 2007-09-25 23:37:44 jhoblitt Exp $
     3# $Id: Parser.pm,v 1.15 2007-09-25 23:50:34 jhoblitt Exp $
    44
    55package DataStore::FileSet::Parser;
     
    193193            type        => $type,
    194194            extra       => \@extra,
    195             uri         => $self->base_uri . $fileset . '/',
     195            uri         => $self->base_uri . $fileset . '/index.txt',
    196196        });
    197197    } continue {
  • trunk/DataStore/lib/DataStore/Product.pm

    r15020 r15021  
    11# Copyright (C) 2006  Joshua Hoblitt
    22#
    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 $
    44
    55package DataStore::Product;
     
    102102                type        => SCALAR,
    103103                callbacks   => {
    104                     'uri ends with /index.txt' => sub { $_[0] =~ m|/index.txt$| },
     104                    'uri ends with /index.txt'
     105                        => sub { $_[0] =~ m|/index.txt$| },
    105106                }
    106107            },
  • trunk/DataStore/t/02_fileset_parse.t

    r15020 r15021  
    33# Copyright (C) 2006  Joshua Hoblitt
    44#
    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 $
    66
    77use strict;
     
    143143    is(@$results[0]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
    144144    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');
    146146
    147147    isa_ok(@$results[1], 'DataStore::FileSet');
     
    149149    is(@$results[1]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
    150150    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');
    152152
    153153    isa_ok(@$results[2], 'DataStore::FileSet');
     
    155155    is(@$results[2]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
    156156    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');
    158158
    159159    isa_ok(@$results[3], 'DataStore::FileSet');
     
    161161    is(@$results[3]->datetime, '2006-01-01T00:03:04Z', 'correct datetime');
    162162    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');
    164164}
    165165
  • trunk/DataStore/t/06_fileset.t

    r8722 r15021  
    33# Copyright (C) 2006  Joshua Hoblitt
    44#
    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 $
    66
    77use strict;
     
    1010use lib qw( ./lib ./t );
    1111
    12 use Test::More tests => 18;
     12use Test::More tests => 19;
    1313
    1414=head1 NAME
     
    3333{
    3434    my $dsf = DataStore::FileSet->new(
    35         uri         => 'http://example.org/',
     35        uri         => 'http://example.org/index.txt',
    3636        fileset     => '12buckelyourshoe',
    3737        datetime    => '2042-01-01T00:00:00Z',
     
    4444eval {
    4545    my $dsf = DataStore::FileSet->new(
    46         uri         => 'http://example.org/',
     46        uri         => 'http://example.org/index.txt',
    4747        fileset     => '12buckelyourshoe',
    4848        datetime    => '2042-01-01T00:00:00Z',
     
    5757    my $dsf = DataStore::FileSet->new( uri => 'http://example.org' );
    5858};
    59 like($@, qr/is valid uri dirname/,
     59like($@, qr/uri ends with \/index.txt/,
    6060    '->new() fails when uri param does not end with /');
    6161
    6262eval {
    63     my $dsf = DataStore::FileSet->new( uri => '://example.org' );
     63    my $dsf = DataStore::FileSet->new( uri => 'http://example.org/index.html' );
     64};
     65like($@, qr/uri ends with \/index.txt/,
     66    '->new() fails when uri param does not end with /');
     67
     68eval {
     69    my $dsf = DataStore::FileSet->new( uri => '://example.org/index.txt' );
    6470};
    6571like($@, qr/is valid http uri/,
     
    105111    print $server->Start(), "\n";
    106112
    107     $server->RegisterURL('/', \&bar);
     113    $server->RegisterURL('/index.txt', \&bar);
    108114    $server->Process();  # Run forever
    109115
     
    116122{
    117123    my $dsp = DataStore::FileSet->new(
    118         uri         => "http://localhost:$port/",
     124        uri         => "http://localhost:$port/index.txt",
    119125        fileset     => '12buckelyourshoe',
    120126        datetime    => '2042-01-01T00:00:00Z',
     
    127133{
    128134    my $dsp = DataStore::FileSet->new(
    129         uri         => "http://localhost:$port/",
     135        uri         => "http://localhost:$port/index.txt",
    130136        fileset     => '12buckelyourshoe',
    131137        datetime    => '2042-01-01T00:00:00Z',
     
    154160eval {
    155161    my $dsf = DataStore::FileSet->new(
    156         uri         => 'http://example.org/',
     162        uri         => 'http://example.org/index.txt',
    157163        fileset     => '12buckelyourshoe',
    158164        datetime    => '2042-01-01T00:00:00Z',
Note: See TracChangeset for help on using the changeset viewer.