Changeset 12960 for trunk/Nebulous-Server
- Timestamp:
- Apr 23, 2007, 10:42:29 AM (19 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 3 edited
-
Build.PL (modified) (1 diff)
-
t/03_server_create_object.t (modified) (10 diffs)
-
t/04_server_replicate_object.t (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Build.PL
r12580 r12960 97 97 'File::Temp' => 0, 98 98 'Test::More' => '0.49', 99 'Test::URI' => '1.06', 99 100 }, 100 101 recommends => { -
trunk/Nebulous-Server/t/03_server_create_object.t
r10546 r12960 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 03_server_create_object.t,v 1.1 1 2006-12-08 03:29:19 jhoblitt Exp $5 # $Id: 03_server_create_object.t,v 1.12 2007-04-23 20:42:29 jhoblitt Exp $ 6 6 7 7 use strict; … … 15 15 use Nebulous::Util qw( :standard ); 16 16 use Test::Nebulous; 17 use Test::URI; 18 use URI::Split qw( uri_split ); 17 19 18 20 my $neb = Nebulous::Server->new( … … 26 28 { 27 29 # key 28 my $uri = $neb->create_object( "foo");30 my $uri = $neb->create_object("foo"); 29 31 30 ok( -e _get_file_path( $uri ), "file exists" ); 31 like( $uri, qr/^file:\//, "valid URI" ); 32 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 33 ok(-e $path, "file exists"); 34 uri_scheme_ok($uri, 'file'); 32 35 } 33 36 … … 36 39 { 37 40 # key, class 38 my $uri = $neb->create_object( "foo", 0);41 my $uri = $neb->create_object("foo", 0); 39 42 40 ok( -e _get_file_path( $uri ), "file exists" ); 41 like( $uri, qr/^file:\//, "valid URI" ); 43 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 44 ok(-e $path, "file exists"); 45 uri_scheme_ok($uri, 'file'); 42 46 } 43 47 … … 46 50 { 47 51 # key, class, volume 48 my $uri = $neb->create_object( "foo", 0, "node01");52 my $uri = $neb->create_object("foo", 0, "node01"); 49 53 50 ok( -e _get_file_path( $uri ), "file exists" ); 51 like( $uri, qr/^file:\//, "valid URI" ); 54 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 55 ok(-e $path, "file exists"); 56 uri_scheme_ok($uri, 'file'); 52 57 } 53 58 … … 56 61 { 57 62 # key, class, volume, comment 58 my $uri = $neb->create_object( "foo", 0, "node01", "this is foo");63 my $uri = $neb->create_object("foo", 0, "node01", "this is foo"); 59 64 60 ok( -e _get_file_path( $uri ), "file exists" ); 61 like( $uri, qr/^file:\//, "valid URI" ); 65 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 66 ok(-e $path, "file exists"); 67 uri_scheme_ok($uri, 'file'); 62 68 } 63 69 … … 65 71 66 72 eval { 67 $neb->create_object( "foo");68 $neb->create_object( "foo");73 $neb->create_object("foo"); 74 $neb->create_object("foo"); 69 75 }; 70 like( $@, qr/Duplicate entry/, "object already exists");76 like($@, qr/Duplicate entry/, "object already exists"); 71 77 72 78 Test::Nebulous->setup; 73 79 74 80 { 75 my $uri = $neb->create_object( "foo", 1);81 my $uri = $neb->create_object("foo", 1); 76 82 77 ok( -e _get_file_path( $uri ), "class exists" ); 83 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 84 ok(-e $path, "class exists"); 78 85 } 79 86 … … 81 88 82 89 eval { 83 $neb->create_object( "foo", 99);90 $neb->create_object("foo", 99); 84 91 }; 85 like( $@, qr/did not pass the \'is valid class id\'/, "class doesn't exist");92 like($@, qr/did not pass the \'is valid class id\'/, "class doesn't exist"); 86 93 87 94 Test::Nebulous->setup; 88 95 89 96 eval { 90 $neb->create_object( 1, 0, 'node01', 'x' x 256);97 $neb->create_object(1, 0, 'node01', 'x' x 256); 91 98 }; 92 like( $@, qr/comment length/, "comment is too long");99 like($@, qr/comment length/, "comment is too long"); 93 100 94 101 Test::Nebulous->setup; … … 97 104 $neb->create_object(); 98 105 }; 99 like( $@, qr/2 - 4 were expected/, "no params");106 like($@, qr/2 - 4 were expected/, "no params"); 100 107 101 108 Test::Nebulous->setup; … … 104 111 $neb->create_object( 1, 0, 'node01', 1, 1 ); 105 112 }; 106 like( $@, qr/2 - 4 were expected/, "too many params");113 like($@, qr/2 - 4 were expected/, "too many params"); 107 114 108 115 Test::Nebulous->cleanup; -
trunk/Nebulous-Server/t/04_server_replicate_object.t
r10546 r12960 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 04_server_replicate_object.t,v 1. 6 2006-12-08 03:29:19 jhoblitt Exp $5 # $Id: 04_server_replicate_object.t,v 1.7 2007-04-23 20:42:29 jhoblitt Exp $ 6 6 7 7 use strict; … … 15 15 use Nebulous::Util qw( :standard ); 16 16 use Test::Nebulous; 17 use Test::URI; 18 use URI::Split qw( uri_split ); 17 19 18 20 my $neb = Nebulous::Server->new( … … 26 28 { 27 29 # key 28 $neb->create_object( "foo");29 my $uri = $neb->replicate_object( "foo");30 $neb->create_object("foo"); 31 my $uri = $neb->replicate_object("foo"); 30 32 31 ok( -e _get_file_path( $uri ), "file exists" ); 32 like( $uri, qr/^file:\//, "valid URI" ); 33 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 34 ok(-e $path, "file exists"); 35 uri_scheme_ok($uri, 'file'); 33 36 } 34 37 … … 37 40 { 38 41 # key, $volume 39 $neb->create_object( "foo");40 my $uri = $neb->replicate_object( "foo", "node01");42 $neb->create_object("foo"); 43 my $uri = $neb->replicate_object("foo", "node01"); 41 44 42 ok( -e _get_file_path( $uri ), "file exists" ); 43 like( $uri, qr/^file:\//, "valid URI" ); 45 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 46 ok(-e $path, "file exists"); 47 uri_scheme_ok($uri, 'file'); 44 48 } 45 49 … … 48 52 { 49 53 # key, $volume 50 $neb->create_object( "foo");51 my $uri1 = $neb->replicate_object( "foo", "node01");52 my $uri2 = $neb->replicate_object( "foo", "node02");54 $neb->create_object("foo"); 55 my $uri1 = $neb->replicate_object("foo", "node01"); 56 my $uri2 = $neb->replicate_object("foo", "node02"); 53 57 54 ok( -e _get_file_path( $uri1 ), "file exists" ); 55 ok( -e _get_file_path( $uri2 ), "file exists" ); 56 like( $uri1, qr/^file:\//, "valid URI" ); 57 like( $uri2, qr/^file:\//, "valid URI" ); 58 { 59 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1); 60 ok(-e $path, "file exists"); 61 uri_scheme_ok($uri1, 'file'); 62 } 63 64 { 65 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri2); 66 ok(-e $path, "file exists"); 67 uri_scheme_ok($uri2, 'file'); 68 } 58 69 } 59 70 … … 61 72 62 73 eval { 63 $neb->replicate_object( "foo");74 $neb->replicate_object("foo"); 64 75 }; 65 like( $@, qr/storage object does not exist/, "storage object does not exist");76 like($@, qr/storage object does not exist/, "storage object does not exist"); 66 77 67 78 Test::Nebulous->setup; … … 70 81 $neb->replicate_object(); 71 82 }; 72 like( $@, qr/1 - 2 were expected/, "no params");83 like($@, qr/1 - 2 were expected/, "no params"); 73 84 74 85 Test::Nebulous->setup; 75 86 76 87 eval { 77 $neb->replicate_object( 1, 2, 3);88 $neb->replicate_object(1, 2, 3); 78 89 }; 79 like( $@, qr/1 - 2 were expected/, "too many params");90 like($@, qr/1 - 2 were expected/, "too many params"); 80 91 81 92 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
