Changeset 13092
- Timestamp:
- Apr 30, 2007, 4:52:04 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 17 edited
-
Nebulous-Server/Changes (modified) (1 diff)
-
Nebulous-Server/MANIFEST (modified) (1 diff)
-
Nebulous-Server/lib/Nebulous/Server.pm (modified) (5 diffs)
-
Nebulous-Server/lib/Nebulous/Server/SQL.pm (modified) (6 diffs)
-
Nebulous-Server/t/03_server_create_object.t (modified) (4 diffs)
-
Nebulous-Server/t/09_server_is_valid_class_id.t (deleted)
-
Nebulous-Server/t/09_server_stat_object.t (modified) (3 diffs)
-
Nebulous-Server/t/11_server_is_valid_class_id.t (deleted)
-
Nebulous/Changes (modified) (1 diff)
-
Nebulous/MANIFEST (modified) (1 diff)
-
Nebulous/lib/Nebulous/Client.pm (modified) (4 diffs)
-
Nebulous/lib/Nebulous/Server.pm (modified) (5 diffs)
-
Nebulous/lib/Nebulous/Server/SQL.pm (modified) (6 diffs)
-
Nebulous/t/03_server_create_object.t (modified) (4 diffs)
-
Nebulous/t/09_server_is_valid_class_id.t (deleted)
-
Nebulous/t/09_server_stat_object.t (modified) (3 diffs)
-
Nebulous/t/11_server_is_valid_class_id.t (deleted)
-
Nebulous/t/51_client_create.t (modified) (5 diffs)
-
Nebulous/t/51_client_open_create.t (modified) (5 diffs)
-
Nebulous/t/63_client_stat.t (modified) (4 diffs)
-
Nebulous/t/Test/Nebulous.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/Changes
r13087 r13092 2 2 3 3 0.05 4 - remove $class_id & $comment params from Nebulous::Server->create() and 5 Nebulous::Client->create*() and all supporting functions and tests 4 6 - add Nebulous::Server->{setxattr_object, listxattr_object, 5 7 getxattr_object, removexattr_object}() -
trunk/Nebulous-Server/MANIFEST
r13087 r13092 85 85 t/07_server_find_instances.t 86 86 t/08_server_delete_instance.t 87 t/09_server_is_valid_class_id.t88 87 t/09_server_stat_object.t 89 88 t/10_server_is_valid_volume_name.t 90 t/11_server_is_valid_class_id.t91 89 t/12_server_find_objects.t 92 90 t/13_server_rename_object.t -
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r13087 r13092 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.2 7 2007-05-01 02:00:07jhoblitt Exp $3 # $Id: Server.pm,v 1.28 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 123 123 my $self = shift; 124 124 125 my ( $key, $class, $volume, $comment ) = validate_pos( @_, 126 { 127 type => SCALAR, 128 }, 129 { 130 type => SCALAR, 131 callbacks => { 132 'is + integer' => sub { $_[0] =~ /^\d+$/ }, 133 # check that the class requested is valid 134 'is valid class id' => sub { $self->_is_valid_class_id( $_[0] ) }, 135 }, 136 default => 0, 125 my ($key, $volume) = validate_pos(@_, 126 { 127 type => SCALAR, 137 128 }, 138 129 { … … 144 135 optional => 1, 145 136 }, 146 {147 type => SCALAR,148 callbacks => {149 # check that the comment isn't too long150 'comment length' => sub { length $_[0] < 256 },151 },152 optional => 1,153 },154 137 ); 155 138 … … 185 168 # create storage_object_attr 186 169 my $query = $db->prepare_cached( $sql->new_object_attr ); 187 $query->execute( $object_id , $class, $comment);170 $query->execute( $object_id ); 188 171 } 189 172 … … 1070 1053 } 1071 1054 1072 sub _is_valid_class_id {1073 my ($self, $class_id) = @_;1074 1075 my $log = $self->log;1076 my $sql = $self->sql;1077 my $db = $self->db;1078 1079 my $class;1080 eval {1081 my $query = $db->prepare_cached( $sql->get_class_by_id );1082 $query->execute( $class_id );1083 ( $class ) = $query->fetchrow_array;1084 1085 $query->finish;1086 };1087 if ( $@ ) {1088 $db->rollback;1089 $log->logdie( "database error: $@" );1090 }1091 1092 return ( defined $class ) ? 1 : undef;1093 }1094 1095 1055 sub _is_valid_volume_name { 1096 1056 my ($self, $vol_name) = @_; -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r13087 r13092 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1. 29 2007-05-01 02:00:07jhoblitt Exp $3 # $Id: SQL.pm,v 1.30 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 29 29 new_object_attr => qq{ 30 30 INSERT INTO storage_object_attr 31 (so_id, class_id, comment,read_lock, write_lock)32 VALUES (?, ?, ?,0, NULL)31 (so_id, read_lock, write_lock) 32 VALUES (?, 0, NULL) 33 33 }, 34 34 delete_object => qq{ … … 48 48 get_object => qq{ 49 49 SELECT storage_object.so_id, 50 ext_id, class_id, comment,read_lock, write_lock, epoch, mtime50 ext_id, read_lock, write_lock, epoch, mtime 51 51 FROM storage_object 52 52 LEFT JOIN storage_object_attr … … 176 176 INSERT INTO volume (name, path) 177 177 VALUES (?, ?) 178 },179 get_class_by_id => qq{180 SELECT class_id, priority, comment181 FROM class182 WHERE class_id = ?183 178 }, 184 179 get_volume_by_name => qq{ … … 257 252 CREATE TABLE storage_object_attr ( 258 253 so_id BIGINT NOT NULL AUTO_INCREMENT, 259 class_id TINYINT NOT NULL,260 comment VARCHAR(255),261 254 read_lock TINYINT DEFAULT 0 NOT NULL, 262 255 write_lock ENUM( 'write' ), 263 256 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 264 257 mtime TIMESTAMP, 265 PRIMARY KEY(so_id), 266 KEY(class_id) 258 PRIMARY KEY(so_id) 267 259 ) ENGINE=innodb; 268 260 … … 318 310 PRIMARY KEY(mountpoint) 319 311 ) ENGINE=innodb; 320 321 ###322 323 CREATE TABLE class (324 class_id TINYINT NOT NULL,325 priority TINYINT,326 comment VARCHAR(255),327 PRIMARY KEY(class_id)328 ) ENGINE=innodb;329 330 ###331 332 INSERT INTO class VALUES(0,0, 'default class ID');333 312 334 313 ### -
trunk/Nebulous-Server/t/03_server_create_object.t
r12960 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 03_server_create_object.t,v 1.1 2 2007-04-23 20:42:29jhoblitt Exp $5 # $Id: 03_server_create_object.t,v 1.13 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 14;10 use Test::More tests => 8; 11 11 12 12 use lib qw( ./t ./lib ); … … 38 38 39 39 { 40 # key, class 41 my $uri = $neb->create_object("foo", 0); 42 43 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 44 ok(-e $path, "file exists"); 45 uri_scheme_ok($uri, 'file'); 46 } 47 48 Test::Nebulous->setup; 49 50 { 51 # key, class, volume 52 my $uri = $neb->create_object("foo", 0, "node01"); 53 54 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 55 ok(-e $path, "file exists"); 56 uri_scheme_ok($uri, 'file'); 57 } 58 59 Test::Nebulous->setup; 60 61 { 62 # key, class, volume, comment 63 my $uri = $neb->create_object("foo", 0, "node01", "this is foo"); 40 # key, volume 41 my $uri = $neb->create_object("foo", "node01"); 64 42 65 43 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); … … 78 56 Test::Nebulous->setup; 79 57 80 {81 my $uri = $neb->create_object("foo", 1);82 83 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);84 ok(-e $path, "class exists");85 }86 87 Test::Nebulous->setup;88 89 58 eval { 90 59 $neb->create_object("foo", 99); 91 60 }; 92 like($@, qr/did not pass the \'is valid class id\'/, "class doesn't exist"); 93 94 Test::Nebulous->setup; 95 96 eval { 97 $neb->create_object(1, 0, 'node01', 'x' x 256); 98 }; 99 like($@, qr/comment length/, "comment is too long"); 61 like($@, qr/did not pass the \'is valid volume name\'/, "volume name doesn't exist"); 100 62 101 63 Test::Nebulous->setup; … … 104 66 $neb->create_object(); 105 67 }; 106 like($@, qr/ 2 - 4were expected/, "no params");68 like($@, qr/1 - 2 were expected/, "no params"); 107 69 108 70 Test::Nebulous->setup; 109 71 110 72 eval { 111 $neb->create_object( 1, 0, 'node01', 1, 1);73 $neb->create_object(1, "node01", 3); 112 74 }; 113 like($@, qr/ 2 - 4were expected/, "too many params");75 like($@, qr/1 - 2 were expected/, "too many params"); 114 76 115 77 Test::Nebulous->cleanup; -
trunk/Nebulous-Server/t/09_server_stat_object.t
r12646 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 09_server_stat_object.t,v 1. 9 2007-03-28 22:01:37jhoblitt Exp $5 # $Id: 09_server_stat_object.t,v 1.10 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 1 3;10 use Test::More tests => 11; 11 11 12 12 use lib qw( ./t ./lib ); … … 29 29 my $info = $neb->stat_object("foo"); 30 30 31 is(scalar @$info, 8, "number of columns");31 is(scalar @$info, 6, "number of columns"); 32 32 } 33 33 … … 35 35 36 36 { 37 my $uri = $neb->create_object("foo", 0, "node01", "foobar");37 my $uri = $neb->create_object("foo", "node01"); 38 38 39 39 my $info = $neb->stat_object("foo"); 40 40 41 is(scalar @$info, 8, "number of columns");41 is(scalar @$info, 6, "number of columns"); 42 42 is(@$info[0], 1, "so_id"); 43 43 is(@$info[1], "foo", "ext_id"); 44 is(@$info[2], 0, "class_id"); 45 is(@$info[3], "foobar", "comment"); 46 is(@$info[4], 0, "read lock"); 47 is(@$info[5], undef, "write lock"); 48 like(@$info[6], qr/....-..-.. ..:..:../, "epoch"); 49 like(@$info[6], qr/....-..-.. ..:..:../, "mtime"); 44 is(@$info[2], 0, "read lock"); 45 is(@$info[3], undef, "write lock"); 46 like(@$info[4], qr/....-..-.. ..:..:../, "epoch"); 47 like(@$info[5], qr/....-..-.. ..:..:../, "mtime"); 50 48 } 51 49 -
trunk/Nebulous/Changes
r13087 r13092 2 2 3 3 0.05 4 - remove $class_id & $comment params from Nebulous::Server->create() and 5 Nebulous::Client->create*() and all supporting functions and tests 4 6 - add Nebulous::Server->{setxattr_object, listxattr_object, 5 7 getxattr_object, removexattr_object}() -
trunk/Nebulous/MANIFEST
r13087 r13092 85 85 t/07_server_find_instances.t 86 86 t/08_server_delete_instance.t 87 t/09_server_is_valid_class_id.t88 87 t/09_server_stat_object.t 89 88 t/10_server_is_valid_volume_name.t 90 t/11_server_is_valid_class_id.t91 89 t/12_server_find_objects.t 92 90 t/13_server_rename_object.t -
trunk/Nebulous/lib/Nebulous/Client.pm
r13072 r13092 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.2 8 2007-04-28 01:15:38jhoblitt Exp $3 # $Id: Client.pm,v 1.29 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Nebulous::Client; … … 96 96 { 97 97 type => SCALAR, 98 callbacks => {99 'is + integer' => sub { $_[0] =~ /^\d+$/ },100 },101 default => 0,102 },103 {104 type => SCALAR,105 optional => 1,106 },107 {108 type => SCALAR,109 98 optional => 1, 110 99 }, … … 141 130 { 142 131 type => SCALAR, 143 },144 {145 type => SCALAR,146 callbacks => {147 'is + integer' => sub { $_[0] =~ /^\d+$/ },148 },149 default => 0,150 },151 {152 type => SCALAR,153 optional => 1,154 132 }, 155 133 { … … 609 587 my $new_fh; 610 588 if (defined $volume) { 611 $new_fh = $self->open_create( $new_key, 0,$volume );589 $new_fh = $self->open_create( $new_key, $volume ); 612 590 } else { 613 591 $new_fh = $self->open_create( $new_key ); -
trunk/Nebulous/lib/Nebulous/Server.pm
r13087 r13092 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.2 7 2007-05-01 02:00:07jhoblitt Exp $3 # $Id: Server.pm,v 1.28 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 123 123 my $self = shift; 124 124 125 my ( $key, $class, $volume, $comment ) = validate_pos( @_, 126 { 127 type => SCALAR, 128 }, 129 { 130 type => SCALAR, 131 callbacks => { 132 'is + integer' => sub { $_[0] =~ /^\d+$/ }, 133 # check that the class requested is valid 134 'is valid class id' => sub { $self->_is_valid_class_id( $_[0] ) }, 135 }, 136 default => 0, 125 my ($key, $volume) = validate_pos(@_, 126 { 127 type => SCALAR, 137 128 }, 138 129 { … … 144 135 optional => 1, 145 136 }, 146 {147 type => SCALAR,148 callbacks => {149 # check that the comment isn't too long150 'comment length' => sub { length $_[0] < 256 },151 },152 optional => 1,153 },154 137 ); 155 138 … … 185 168 # create storage_object_attr 186 169 my $query = $db->prepare_cached( $sql->new_object_attr ); 187 $query->execute( $object_id , $class, $comment);170 $query->execute( $object_id ); 188 171 } 189 172 … … 1070 1053 } 1071 1054 1072 sub _is_valid_class_id {1073 my ($self, $class_id) = @_;1074 1075 my $log = $self->log;1076 my $sql = $self->sql;1077 my $db = $self->db;1078 1079 my $class;1080 eval {1081 my $query = $db->prepare_cached( $sql->get_class_by_id );1082 $query->execute( $class_id );1083 ( $class ) = $query->fetchrow_array;1084 1085 $query->finish;1086 };1087 if ( $@ ) {1088 $db->rollback;1089 $log->logdie( "database error: $@" );1090 }1091 1092 return ( defined $class ) ? 1 : undef;1093 }1094 1095 1055 sub _is_valid_volume_name { 1096 1056 my ($self, $vol_name) = @_; -
trunk/Nebulous/lib/Nebulous/Server/SQL.pm
r13087 r13092 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1. 29 2007-05-01 02:00:07jhoblitt Exp $3 # $Id: SQL.pm,v 1.30 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 29 29 new_object_attr => qq{ 30 30 INSERT INTO storage_object_attr 31 (so_id, class_id, comment,read_lock, write_lock)32 VALUES (?, ?, ?,0, NULL)31 (so_id, read_lock, write_lock) 32 VALUES (?, 0, NULL) 33 33 }, 34 34 delete_object => qq{ … … 48 48 get_object => qq{ 49 49 SELECT storage_object.so_id, 50 ext_id, class_id, comment,read_lock, write_lock, epoch, mtime50 ext_id, read_lock, write_lock, epoch, mtime 51 51 FROM storage_object 52 52 LEFT JOIN storage_object_attr … … 176 176 INSERT INTO volume (name, path) 177 177 VALUES (?, ?) 178 },179 get_class_by_id => qq{180 SELECT class_id, priority, comment181 FROM class182 WHERE class_id = ?183 178 }, 184 179 get_volume_by_name => qq{ … … 257 252 CREATE TABLE storage_object_attr ( 258 253 so_id BIGINT NOT NULL AUTO_INCREMENT, 259 class_id TINYINT NOT NULL,260 comment VARCHAR(255),261 254 read_lock TINYINT DEFAULT 0 NOT NULL, 262 255 write_lock ENUM( 'write' ), 263 256 epoch TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 264 257 mtime TIMESTAMP, 265 PRIMARY KEY(so_id), 266 KEY(class_id) 258 PRIMARY KEY(so_id) 267 259 ) ENGINE=innodb; 268 260 … … 318 310 PRIMARY KEY(mountpoint) 319 311 ) ENGINE=innodb; 320 321 ###322 323 CREATE TABLE class (324 class_id TINYINT NOT NULL,325 priority TINYINT,326 comment VARCHAR(255),327 PRIMARY KEY(class_id)328 ) ENGINE=innodb;329 330 ###331 332 INSERT INTO class VALUES(0,0, 'default class ID');333 312 334 313 ### -
trunk/Nebulous/t/03_server_create_object.t
r12960 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 03_server_create_object.t,v 1.1 2 2007-04-23 20:42:29jhoblitt Exp $5 # $Id: 03_server_create_object.t,v 1.13 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 14;10 use Test::More tests => 8; 11 11 12 12 use lib qw( ./t ./lib ); … … 38 38 39 39 { 40 # key, class 41 my $uri = $neb->create_object("foo", 0); 42 43 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 44 ok(-e $path, "file exists"); 45 uri_scheme_ok($uri, 'file'); 46 } 47 48 Test::Nebulous->setup; 49 50 { 51 # key, class, volume 52 my $uri = $neb->create_object("foo", 0, "node01"); 53 54 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 55 ok(-e $path, "file exists"); 56 uri_scheme_ok($uri, 'file'); 57 } 58 59 Test::Nebulous->setup; 60 61 { 62 # key, class, volume, comment 63 my $uri = $neb->create_object("foo", 0, "node01", "this is foo"); 40 # key, volume 41 my $uri = $neb->create_object("foo", "node01"); 64 42 65 43 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); … … 78 56 Test::Nebulous->setup; 79 57 80 {81 my $uri = $neb->create_object("foo", 1);82 83 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);84 ok(-e $path, "class exists");85 }86 87 Test::Nebulous->setup;88 89 58 eval { 90 59 $neb->create_object("foo", 99); 91 60 }; 92 like($@, qr/did not pass the \'is valid class id\'/, "class doesn't exist"); 93 94 Test::Nebulous->setup; 95 96 eval { 97 $neb->create_object(1, 0, 'node01', 'x' x 256); 98 }; 99 like($@, qr/comment length/, "comment is too long"); 61 like($@, qr/did not pass the \'is valid volume name\'/, "volume name doesn't exist"); 100 62 101 63 Test::Nebulous->setup; … … 104 66 $neb->create_object(); 105 67 }; 106 like($@, qr/ 2 - 4were expected/, "no params");68 like($@, qr/1 - 2 were expected/, "no params"); 107 69 108 70 Test::Nebulous->setup; 109 71 110 72 eval { 111 $neb->create_object( 1, 0, 'node01', 1, 1);73 $neb->create_object(1, "node01", 3); 112 74 }; 113 like($@, qr/ 2 - 4were expected/, "too many params");75 like($@, qr/1 - 2 were expected/, "too many params"); 114 76 115 77 Test::Nebulous->cleanup; -
trunk/Nebulous/t/09_server_stat_object.t
r12646 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 09_server_stat_object.t,v 1. 9 2007-03-28 22:01:37jhoblitt Exp $5 # $Id: 09_server_stat_object.t,v 1.10 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; 8 8 use warnings FATAL => qw( all ); 9 9 10 use Test::More tests => 1 3;10 use Test::More tests => 11; 11 11 12 12 use lib qw( ./t ./lib ); … … 29 29 my $info = $neb->stat_object("foo"); 30 30 31 is(scalar @$info, 8, "number of columns");31 is(scalar @$info, 6, "number of columns"); 32 32 } 33 33 … … 35 35 36 36 { 37 my $uri = $neb->create_object("foo", 0, "node01", "foobar");37 my $uri = $neb->create_object("foo", "node01"); 38 38 39 39 my $info = $neb->stat_object("foo"); 40 40 41 is(scalar @$info, 8, "number of columns");41 is(scalar @$info, 6, "number of columns"); 42 42 is(@$info[0], 1, "so_id"); 43 43 is(@$info[1], "foo", "ext_id"); 44 is(@$info[2], 0, "class_id"); 45 is(@$info[3], "foobar", "comment"); 46 is(@$info[4], 0, "read lock"); 47 is(@$info[5], undef, "write lock"); 48 like(@$info[6], qr/....-..-.. ..:..:../, "epoch"); 49 like(@$info[6], qr/....-..-.. ..:..:../, "mtime"); 44 is(@$info[2], 0, "read lock"); 45 is(@$info[3], undef, "write lock"); 46 like(@$info[4], qr/....-..-.. ..:..:../, "epoch"); 47 like(@$info[5], qr/....-..-.. ..:..:../, "mtime"); 50 48 } 51 49 -
trunk/Nebulous/t/51_client_create.t
r12960 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 51_client_create.t,v 1. 2 2007-04-23 20:42:29jhoblitt Exp $5 # $Id: 51_client_create.t,v 1.3 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 11;12 plan tests => 7; 13 13 14 14 use lib qw( ./t ./lib ); … … 40 40 41 41 { 42 # key, class42 # key, volume 43 43 my $neb = Nebulous::Client->new( 44 44 proxy => "http://$hostport/nebulous", 45 45 ); 46 46 47 my $uri = $neb->create("foo", 0); 48 49 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 50 ok(-e $path, "good filename"); 51 uri_scheme_ok($uri, 'file'); 52 } 53 54 Test::Nebulous->setup; 55 56 { 57 # key, class, volume 58 my $neb = Nebulous::Client->new( 59 proxy => "http://$hostport/nebulous", 60 ); 61 62 my $uri = $neb->create("foo", 0, "node01"); 63 64 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); 65 ok(-e $path, "good filename"); 66 uri_scheme_ok($uri, 'file'); 67 } 68 69 Test::Nebulous->setup; 70 71 { 72 # key, class, volume, comment 73 my $neb = Nebulous::Client->new( 74 proxy => "http://$hostport/nebulous", 75 ); 76 77 my $uri = $neb->create("foo", 0, "node01", "this is foo"); 47 my $uri = $neb->create("foo", "node01"); 78 48 79 49 my ($scheme, $auth, $path, $query, $frag) = uri_split($uri); … … 102 72 $neb->create(); 103 73 }; 104 like($@, qr/ 2 - 4were expected/, "no params");74 like($@, qr/1 - 2 were expected/, "no params"); 105 75 106 76 Test::Nebulous->setup; … … 111 81 ); 112 82 113 $neb->create(1, 2, 3 , 4, 5);83 $neb->create(1, 2, 3); 114 84 }; 115 like($@, qr/ 2 - 4were expected/, "too many params");85 like($@, qr/1 - 2 were expected/, "too many params"); 116 86 117 87 Test::Nebulous->cleanup; -
trunk/Nebulous/t/51_client_open_create.t
r12960 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 51_client_open_create.t,v 1. 2 2007-04-23 20:42:29jhoblitt Exp $5 # $Id: 51_client_open_create.t,v 1.3 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 7;12 plan tests => 5; 13 13 14 14 use lib qw( ./t ./lib ); … … 36 36 37 37 { 38 # key, class38 # key, volume 39 39 my $neb = Nebulous::Client->new( 40 40 proxy => "http://$hostport/nebulous", 41 41 ); 42 42 43 my $fh = $neb->open_create( "foo", 0 ); 44 45 is(ref $fh, 'GLOB', "good filehandle"); 46 } 47 48 Test::Nebulous->setup; 49 50 { 51 # key, class, volume 52 my $neb = Nebulous::Client->new( 53 proxy => "http://$hostport/nebulous", 54 ); 55 56 my $fh = $neb->open_create("foo", 0, "node01"); 57 58 is(ref $fh, 'GLOB', "good filehandle"); 59 } 60 61 Test::Nebulous->setup; 62 63 { 64 # key, class, volume, comment 65 my $neb = Nebulous::Client->new( 66 proxy => "http://$hostport/nebulous", 67 ); 68 69 my $fh = $neb->open_create("foo", 0, "node01", "this is foo"); 43 my $fh = $neb->open_create("foo", "node01"); 70 44 71 45 is(ref $fh, 'GLOB', "good filehandle"); … … 92 66 $neb->open_create(); 93 67 }; 94 like($@, qr/ 2 - 4were expected/, "no params");68 like($@, qr/1 - 2 were expected/, "no params"); 95 69 96 70 Test::Nebulous->setup; … … 101 75 ); 102 76 103 $neb->open_create(1, 2, 3 , 4, 5);77 $neb->open_create(1, 2, 3); 104 78 }; 105 like($@, qr/ 2 - 4were expected/, "too many params");79 like($@, qr/1 - 2 were expected/, "too many params"); 106 80 107 81 Test::Nebulous->cleanup; -
trunk/Nebulous/t/63_client_stat.t
r5667 r13092 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 63_client_stat.t,v 1. 1 2005-12-03 02:52:31jhoblitt Exp $5 # $Id: 63_client_stat.t,v 1.2 2007-05-01 02:52:04 jhoblitt Exp $ 6 6 7 7 use strict; … … 10 10 use Apache::Test qw( -withtestmore ); 11 11 12 plan tests => 1 3;12 plan tests => 11; 13 13 14 14 use lib qw( ./t ./lib ); … … 30 30 my $info = $neb->stat( "foo" ); 31 31 32 is( scalar @$info, 8, "number of columns" );32 is( scalar @$info, 6, "number of columns" ); 33 33 } 34 34 … … 39 39 proxy => "http://$hostport/nebulous", 40 40 ); 41 $neb->create( "foo", 0, "node01", "foobar" );41 $neb->create( "foo", "node01" ); 42 42 43 43 my $info = $neb->stat( "foo" ); 44 44 45 is( scalar @$info, 8, "number of columns" );45 is( scalar @$info, 6, "number of columns" ); 46 46 is( @$info[0], 1, "so_id" ); 47 47 is( @$info[1], "foo", "ext_id" ); 48 is( @$info[2], 0, "class_id" ); 49 is( @$info[3], "foobar", "comment" ); 50 is( @$info[4], 0, "read lock" ); 51 is( @$info[5], undef, "write lock" ); 52 like( @$info[6], qr/....-..-.. ..:..:../, "epoch" ); 53 like( @$info[6], qr/....-..-.. ..:..:../, "mtime" ); 48 is( @$info[2], 0, "read lock" ); 49 is( @$info[3], undef, "write lock" ); 50 like( @$info[4], qr/....-..-.. ..:..:../, "epoch" ); 51 like( @$info[5], qr/....-..-.. ..:..:../, "mtime" ); 54 52 } 55 53 -
trunk/Nebulous/t/Test/Nebulous.pm
r13045 r13092 1 1 # Copyright (C) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Nebulous.pm,v 1.1 0 2007-04-26 22:27:13jhoblitt Exp $3 # $Id: Nebulous.pm,v 1.11 2007-05-01 02:52:04 jhoblitt Exp $ 4 4 5 5 package Test::Nebulous; … … 42 42 $dbh->do(qq{ INSERT INTO volume VALUES (2,'node02',?) }, undef, $dir2); 43 43 $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e10) }, undef, $dir2); 44 45 # class ID 0 should be setup by default46 # $dbh->do(qq{ INSERT INTO class VALUES (0, 0, "regular data") });47 $dbh->do(qq{ INSERT INTO class VALUES (1, 1, "special data") });48 44 } 49 45
Note:
See TracChangeset
for help on using the changeset viewer.
