IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5504


Ignore:
Timestamp:
Nov 10, 2005, 12:07:53 PM (21 years ago)
Author:
jhoblitt
Message:

change Nebulous::Server->create_object() to validate comment length

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server.pm

    r5503 r5504  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.16 2005-11-10 21:57:15 jhoblitt Exp $
     3# $Id: Server.pm,v 1.17 2005-11-10 22:07:53 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    9090        {
    9191            type        => SCALAR,
     92            callbacks   => {
     93                # check that the comment isn't too long
     94                'comment length' => sub { length $_[0] < 256 },
     95            },
    9296            optional    => 1,
    9397        },
     
    99103    # add hooks to make this decision based on avaiable space
    100104    $volume = _get_storage_volume( $volume );
    101 
    102     # check that the comment isn't too long
    103105
    104106    my $uri;
  • trunk/Nebulous-Server/t/03_server_create_object.t

    r5502 r5504  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 03_server_create_object.t,v 1.9 2005-11-10 21:53:56 jhoblitt Exp $
     5# $Id: 03_server_create_object.t,v 1.10 2005-11-10 22:07:53 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 13;
     10use Test::More tests => 14;
    1111
    1212use lib qw( ./t ./lib );
     
    9090
    9191eval {
     92    $neb->create_object( 1, 0, 'node01', 'x' x 256 );
     93};
     94like( $@, qr/comment length/, "comment is too long" );
     95
     96Test::Nebulous->setup;
     97
     98eval {
    9299    $neb->create_object();
    93100};
  • trunk/Nebulous/lib/Nebulous/Server.pm

    r5503 r5504  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.16 2005-11-10 21:57:15 jhoblitt Exp $
     3# $Id: Server.pm,v 1.17 2005-11-10 22:07:53 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    9090        {
    9191            type        => SCALAR,
     92            callbacks   => {
     93                # check that the comment isn't too long
     94                'comment length' => sub { length $_[0] < 256 },
     95            },
    9296            optional    => 1,
    9397        },
     
    99103    # add hooks to make this decision based on avaiable space
    100104    $volume = _get_storage_volume( $volume );
    101 
    102     # check that the comment isn't too long
    103105
    104106    my $uri;
  • trunk/Nebulous/t/03_server_create_object.t

    r5502 r5504  
    33# Copryight (C) 2004-2005  Joshua Hoblitt
    44#
    5 # $Id: 03_server_create_object.t,v 1.9 2005-11-10 21:53:56 jhoblitt Exp $
     5# $Id: 03_server_create_object.t,v 1.10 2005-11-10 22:07:53 jhoblitt Exp $
    66
    77use strict;
    88use warnings FATAL => qw( all );
    99
    10 use Test::More tests => 13;
     10use Test::More tests => 14;
    1111
    1212use lib qw( ./t ./lib );
     
    9090
    9191eval {
     92    $neb->create_object( 1, 0, 'node01', 'x' x 256 );
     93};
     94like( $@, qr/comment length/, "comment is too long" );
     95
     96Test::Nebulous->setup;
     97
     98eval {
    9299    $neb->create_object();
    93100};
Note: See TracChangeset for help on using the changeset viewer.