Index: trunk/Nebulous-Server/t/02_server_setup.t
===================================================================
--- trunk/Nebulous-Server/t/02_server_setup.t	(revision 24355)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 02_server_setup.t,v 1.8 2008-12-14 22:54:25 eugene Exp $
-
-use strict;
-use warnings;
-
-use Test::More tests => 6;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-Test::Nebulous->setup;
-
-# ->new()
-
-{
-    my $neb = Nebulous::Server->new(
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-    );
-
-    ok($neb, "set database");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $neb = Nebulous::Server->new(
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-        trace       => 'off',
-    );
-
-    ok($neb, "set log level");
-}
-
-Test::Nebulous->setup;
-
-# add dbs after ->new()
-{
-    my $config = Nebulous::Server::Config->new;
-
-    ok($config->add_db(
-        dbindex    => 0,
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-    ), "add db");
-    
-    ok($config->add_db(
-        dbindex    => 1,
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-    ), "add dbs");
-
-    is($config->n_db, 2, "n dbs");
-
-    my $neb = Nebulous::Server->new_from_config($config);
-     
-    isa_ok($neb, 'Nebulous::Server');
-}
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/03_server_create_object.t
===================================================================
--- trunk/Nebulous-Server/t/03_server_create_object.t	(revision 24355)
+++ 	(revision )
@@ -1,615 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 03_server_create_object.t,v 1.30 2008-09-11 22:35:52 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 99;
-
-use lib qw( ./t ./lib );
-
-use File::Basename qw( basename );
-use File::ExtAttr qw( getfattr );
-use Nebulous::Server;
-use Test::Nebulous;
-use Test::URI;
-use URI::Split qw( uri_split );
-
-my $test_xattr = undef;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("neb:/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("neb://node01/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("neb://node02/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), '/foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-{
-    # key
-    my $uri = $neb->create_object("neb:///foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("/foo/");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("neb:/foo/");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("foo/");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo/', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("foo/bar");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo/bar"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo/bar', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("/foo/bar");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo/bar"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), '/foo/bar', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, volume
-    my $uri = $neb->create_object("foo", "node01");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # volume name override
-    my $uri = $neb->create_object("neb://node02/foo", "node01");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # volume name override 
-    # OK because the volume arg overrides the key's  implied volume
-    my $uri = $neb->create_object("neb://99/foo", "node01");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # undef volume name
-    # OK because the undef is ignored
-    my $uri = $neb->create_object("neb://node01/foo", undef);
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # soft volume name request
-    my $uri = $neb->create_object("neb://~node01/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # soft volume name request
-    my $uri = $neb->create_object("neb://node01/foo", "~node02");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # any volume name request
-    my $uri = $neb->create_object("neb://any/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # any volume name request
-    my $uri = $neb->create_object("neb://~any/foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # any volume name request
-    my $uri = $neb->create_object("neb://node01/foo", "any");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-Test::Nebulous->setup;
-
-{
-    # any volume name request
-    my $uri = $neb->create_object("neb://node01/foo", "~any");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    ok($neb->find_instances("foo"), 'object key exists');
-    uri_scheme_ok($uri, 'file');
-}
-
-# test for properly row creation in the directories table
-
-Test::Nebulous->setup;
-
-{
-    my $key = "foo";
-    $neb->create_object($key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key, dir_id => 1],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "a/foo";
-    $neb->create_object($key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 2],
-    );
-
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "a/b/foo";
-    $neb->create_object($key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 3],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "a/b/c/foo";
-    $neb->create_object($key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 4],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "a/foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 2],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "d/foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-        directory       => [dir_id => 5, dirname => 'd', parent_id => 1],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "a/d/foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-        directory       => [dir_id => 5, dirname => 'd', parent_id => 2],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "d/a/foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-        directory       => [dir_id => 5, dirname => 'd', parent_id => 1],
-        directory       => [dir_id => 6, dirname => 'a', parent_id => 5],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 6],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "a/b/c/foo";
-    my $key2 = "a/b/c/d/foo";
-    $neb->create_object($key1);
-    $neb->create_object($key2);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
-        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
-        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
-        directory       => [dir_id => 5, dirname => 'd', parent_id => 4],
-        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
-    );
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-    $neb->create_object("foo");
-};
-like($@, qr/Duplicate entry/, "object already exists");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb:/foo");
-    $neb->create_object("neb:/foo");
-};
-like($@, qr/Duplicate entry/, "object already exists");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo", '~node07');
-};
-like($@, qr/node07 is not available/, "request volume this is full");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://~node07/foo");
-};
-like($@, qr/node07 is not available/, "request volume this is full");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo", '~node04');
-};
-like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://~node04/foo");
-};
-like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo", '~node05');
-};
-like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://~node05/foo");
-};
-like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo", '~node06');
-};
-like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://~node06/foo");
-};
-like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE");
-
-Test::Nebulous->setup;
-
-{
-    ok($neb->create_object("foo", 99));
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo", "~99");
-};
-like($@, qr/is not a valid volume name/, "volume name doesn't exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://~99/foo");
-};
-like($@, qr/is not a valid volume name/, "volume name doesn't exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object();
-};
-like($@, qr/1 - 2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object(1, "node01", 3);
-};
-like($@, qr/1 - 2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/03_server_setup.t
===================================================================
--- trunk/Nebulous-Server/t/03_server_setup.t	(revision 24356)
+++ trunk/Nebulous-Server/t/03_server_setup.t	(revision 24356)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 02_server_setup.t,v 1.8 2008-12-14 22:54:25 eugene Exp $
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+Test::Nebulous->setup;
+
+# ->new()
+
+{
+    my $neb = Nebulous::Server->new(
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+    );
+
+    ok($neb, "set database");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Server->new(
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+        trace       => 'off',
+    );
+
+    ok($neb, "set log level");
+}
+
+Test::Nebulous->setup;
+
+# add dbs after ->new()
+{
+    my $config = Nebulous::Server::Config->new;
+
+    ok($config->add_db(
+        dbindex    => 0,
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+    ), "add db");
+    
+    ok($config->add_db(
+        dbindex    => 1,
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+    ), "add dbs");
+
+    is($config->n_db, 2, "n dbs");
+
+    my $neb = Nebulous::Server->new_from_config($config);
+     
+    isa_ok($neb, 'Nebulous::Server');
+}
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/04_server_create_object.t
===================================================================
--- trunk/Nebulous-Server/t/04_server_create_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/04_server_create_object.t	(revision 24356)
@@ -0,0 +1,615 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 03_server_create_object.t,v 1.30 2008-09-11 22:35:52 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 99;
+
+use lib qw( ./t ./lib );
+
+use File::Basename qw( basename );
+use File::ExtAttr qw( getfattr );
+use Nebulous::Server;
+use Test::Nebulous;
+use Test::URI;
+use URI::Split qw( uri_split );
+
+my $test_xattr = undef;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("neb:/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("neb://node01/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("neb://node02/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), '/foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+{
+    # key
+    my $uri = $neb->create_object("neb:///foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("/foo/");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("neb:/foo/");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), '/foo/', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("foo/");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo/', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("foo/bar");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo/bar"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo/bar', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("/foo/bar");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo/bar"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), '/foo/bar', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, volume
+    my $uri = $neb->create_object("foo", "node01");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # volume name override
+    my $uri = $neb->create_object("neb://node02/foo", "node01");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # volume name override 
+    # OK because the volume arg overrides the key's  implied volume
+    my $uri = $neb->create_object("neb://99/foo", "node01");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # undef volume name
+    # OK because the undef is ignored
+    my $uri = $neb->create_object("neb://node01/foo", undef);
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # soft volume name request
+    my $uri = $neb->create_object("neb://~node01/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # soft volume name request
+    my $uri = $neb->create_object("neb://node01/foo", "~node02");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # any volume name request
+    my $uri = $neb->create_object("neb://any/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # any volume name request
+    my $uri = $neb->create_object("neb://~any/foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # any volume name request
+    my $uri = $neb->create_object("neb://node01/foo", "any");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+Test::Nebulous->setup;
+
+{
+    # any volume name request
+    my $uri = $neb->create_object("neb://node01/foo", "~any");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    ok($neb->find_instances("foo"), 'object key exists');
+    uri_scheme_ok($uri, 'file');
+}
+
+# test for properly row creation in the directories table
+
+Test::Nebulous->setup;
+
+{
+    my $key = "foo";
+    $neb->create_object($key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key, dir_id => 1],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "a/foo";
+    $neb->create_object($key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 2],
+    );
+
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "a/b/foo";
+    $neb->create_object($key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 3],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "a/b/c/foo";
+    $neb->create_object($key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 4],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "a/foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 2],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "d/foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+        directory       => [dir_id => 5, dirname => 'd', parent_id => 1],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "a/d/foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+        directory       => [dir_id => 5, dirname => 'd', parent_id => 2],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "d/a/foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+        directory       => [dir_id => 5, dirname => 'd', parent_id => 1],
+        directory       => [dir_id => 6, dirname => 'a', parent_id => 5],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 6],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "a/b/c/foo";
+    my $key2 = "a/b/c/d/foo";
+    $neb->create_object($key1);
+    $neb->create_object($key2);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        directory       => [dir_id => 3, dirname => 'b', parent_id => 2],
+        directory       => [dir_id => 4, dirname => 'c', parent_id => 3],
+        storage_object  => [so_id => 1, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 4],
+        directory       => [dir_id => 5, dirname => 'd', parent_id => 4],
+        storage_object  => [so_id => 2, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 5],
+    );
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+    $neb->create_object("foo");
+};
+like($@, qr/Duplicate entry/, "object already exists");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb:/foo");
+    $neb->create_object("neb:/foo");
+};
+like($@, qr/Duplicate entry/, "object already exists");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo", '~node07');
+};
+like($@, qr/node07 is not available/, "request volume this is full");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb://~node07/foo");
+};
+like($@, qr/node07 is not available/, "request volume this is full");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo", '~node04');
+};
+like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb://~node04/foo");
+};
+like($@, qr/node04 is not available/, "request volume with allocate = FALSE, available = FALSE");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo", '~node05');
+};
+like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb://~node05/foo");
+};
+like($@, qr/node05 is not available/, "request volume with allocate = FALSE , available = TRUE");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo", '~node06');
+};
+like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb://~node06/foo");
+};
+like($@, qr/node06 is not available/, "request volume with allocate = TRUE, available = FALSE");
+
+Test::Nebulous->setup;
+
+{
+    ok($neb->create_object("foo", 99));
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo", "~99");
+};
+like($@, qr/is not a valid volume name/, "volume name doesn't exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("neb://~99/foo");
+};
+like($@, qr/is not a valid volume name/, "volume name doesn't exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object();
+};
+like($@, qr/1 - 2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object(1, "node01", 3);
+};
+like($@, qr/1 - 2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/04_server_replicate_object.t
===================================================================
--- trunk/Nebulous-Server/t/04_server_replicate_object.t	(revision 24355)
+++ 	(revision )
@@ -1,185 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 04_server_replicate_object.t,v 1.16 2008-09-11 22:35:52 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 26;
-
-use lib qw( ./t ./lib );
-
-use File::ExtAttr qw( getfattr );
-use Nebulous::Server;
-use Test::Nebulous;
-use Test::URI;
-use URI::Split qw( uri_split );
-
-my $test_xattr = undef;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    # key
-    $neb->create_object("foo");
-    my $uri = $neb->replicate_object("foo");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, $volume
-    $neb->create_object("foo");
-    my $uri = $neb->replicate_object("foo", "node01");
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, $volume is undef
-    $neb->create_object("foo");
-    my $uri = $neb->replicate_object("foo", undef);
-
-    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
-    ok(-e $path, "file exists");
-    uri_scheme_ok($uri, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, $volume
-    $neb->create_object("foo");
-    my $uri1 = $neb->replicate_object("foo", "~node01");
-    my $uri2 = $neb->replicate_object("foo", "~node02");
-
-    {
-        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
-        ok(-e $path, "file exists");
-        uri_scheme_ok($uri1, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-    }
-
-    {
-        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri2);
-        ok(-e $path, "file exists");
-        uri_scheme_ok($uri2, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-    }
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, $volume
-    $neb->create_object("foo");
-    my $uri1 = $neb->replicate_object("foo", "any");
-
-    {
-        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
-        ok(-e $path, "file exists");
-        uri_scheme_ok($uri1, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-    }
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, $volume
-    $neb->create_object("foo");
-    my $uri1 = $neb->replicate_object("foo", "~any");
-
-    {
-        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
-        ok(-e $path, "file exists");
-        uri_scheme_ok($uri1, 'file');
-
-SKIP: {
-    skip "requires xattr support", 1 unless $test_xattr;
-        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
-}
-    }
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->replicate_object('foo');
-};
-like($@, qr/is valid object key/, 'storage object does not exist');
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    ok($neb->replicate_object('foo', 'bar'),'soft fake storage volume');
-};
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->replicate_object('foo', '~bar');
-};
-like($@, qr/is not a valid volume name/, 'storage volume does not exist');
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->replicate_object();
-};
-like($@, qr/1 - 2 were expected/, 'no params');
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->replicate_object('foo', 'node01', 3);
-};
-like($@, qr/1 - 2 were expected/, 'too many params');
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/05_server_lock_object.t
===================================================================
--- trunk/Nebulous-Server/t/05_server_lock_object.t	(revision 24355)
+++ 	(revision )
@@ -1,126 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 05_server_lock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 13;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    ok($neb->lock_object("foo", "read"), "read lock");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    ok($neb->lock_object("foo", "read"), "read lock");
-    ok($neb->lock_object("foo", "read"), "read lock");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    ok($neb->lock_object("foo", "write"), "write lock");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->lock_object("foo", "read");
-};
-like($@, qr/is valid object key/, "storage object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->lock_object("foo", "write");
-};
-like($@, qr/is valid object key/, "storage object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "write");
-    $neb->lock_object("foo", "write");
-};
-like($@, qr/can not write lock twice/, "can not write lock twice");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "read");
-    $neb->lock_object("foo", "write");
-};
-like($@, qr/can not write lock after read lock/, "can not write lock after read lock");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "write");
-    $neb->lock_object("foo", "read");
-};
-like($@, qr/can not read lock after write lock/, "can not read lock after write lock");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->lock_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo");
-};
-like($@, qr/2 were expected/, "not enough params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "both");
-};
-like($@, qr/is read or write/, "not read or write");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", 'read', 3);
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/05_server_replicate_object.t
===================================================================
--- trunk/Nebulous-Server/t/05_server_replicate_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/05_server_replicate_object.t	(revision 24356)
@@ -0,0 +1,185 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 04_server_replicate_object.t,v 1.16 2008-09-11 22:35:52 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 26;
+
+use lib qw( ./t ./lib );
+
+use File::ExtAttr qw( getfattr );
+use Nebulous::Server;
+use Test::Nebulous;
+use Test::URI;
+use URI::Split qw( uri_split );
+
+my $test_xattr = undef;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    # key
+    $neb->create_object("foo");
+    my $uri = $neb->replicate_object("foo");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, $volume
+    $neb->create_object("foo");
+    my $uri = $neb->replicate_object("foo", "node01");
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, $volume is undef
+    $neb->create_object("foo");
+    my $uri = $neb->replicate_object("foo", undef);
+
+    my ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
+    ok(-e $path, "file exists");
+    uri_scheme_ok($uri, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+    is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, $volume
+    $neb->create_object("foo");
+    my $uri1 = $neb->replicate_object("foo", "~node01");
+    my $uri2 = $neb->replicate_object("foo", "~node02");
+
+    {
+        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
+        ok(-e $path, "file exists");
+        uri_scheme_ok($uri1, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+    }
+
+    {
+        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri2);
+        ok(-e $path, "file exists");
+        uri_scheme_ok($uri2, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+    }
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, $volume
+    $neb->create_object("foo");
+    my $uri1 = $neb->replicate_object("foo", "any");
+
+    {
+        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
+        ok(-e $path, "file exists");
+        uri_scheme_ok($uri1, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+    }
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, $volume
+    $neb->create_object("foo");
+    my $uri1 = $neb->replicate_object("foo", "~any");
+
+    {
+        my ($scheme, $auth, $path, $query, $frag) = uri_split($uri1);
+        ok(-e $path, "file exists");
+        uri_scheme_ok($uri1, 'file');
+
+SKIP: {
+    skip "requires xattr support", 1 unless $test_xattr;
+        is(getfattr($path, 'user.nebulous_key'), 'foo', 'user.nebulous_key xattr');
+}
+    }
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->replicate_object('foo');
+};
+like($@, qr/is valid object key/, 'storage object does not exist');
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    ok($neb->replicate_object('foo', 'bar'),'soft fake storage volume');
+};
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->replicate_object('foo', '~bar');
+};
+like($@, qr/is not a valid volume name/, 'storage volume does not exist');
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->replicate_object();
+};
+like($@, qr/1 - 2 were expected/, 'no params');
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->replicate_object('foo', 'node01', 3);
+};
+like($@, qr/1 - 2 were expected/, 'too many params');
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/06_server_lock_object.t
===================================================================
--- trunk/Nebulous-Server/t/06_server_lock_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/06_server_lock_object.t	(revision 24356)
@@ -0,0 +1,126 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 05_server_lock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 13;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    ok($neb->lock_object("foo", "read"), "read lock");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    ok($neb->lock_object("foo", "read"), "read lock");
+    ok($neb->lock_object("foo", "read"), "read lock");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    ok($neb->lock_object("foo", "write"), "write lock");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->lock_object("foo", "read");
+};
+like($@, qr/is valid object key/, "storage object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->lock_object("foo", "write");
+};
+like($@, qr/is valid object key/, "storage object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "write");
+    $neb->lock_object("foo", "write");
+};
+like($@, qr/can not write lock twice/, "can not write lock twice");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "read");
+    $neb->lock_object("foo", "write");
+};
+like($@, qr/can not write lock after read lock/, "can not write lock after read lock");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "write");
+    $neb->lock_object("foo", "read");
+};
+like($@, qr/can not read lock after write lock/, "can not read lock after write lock");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->lock_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo");
+};
+like($@, qr/2 were expected/, "not enough params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "both");
+};
+like($@, qr/is read or write/, "not read or write");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", 'read', 3);
+};
+like($@, qr/2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/06_server_unlock_object.t
===================================================================
--- trunk/Nebulous-Server/t/06_server_unlock_object.t	(revision 24355)
+++ 	(revision )
@@ -1,141 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 06_server_unlock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 14;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "read");
-
-    ok($neb->unlock_object("foo", "read"), "read unlock");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "read");
-    $neb->lock_object("foo", "read");
-
-    ok($neb->unlock_object("foo", "read"), "read unlock");
-    ok($neb->unlock_object("foo", "read"), "read unlock");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    $neb->lock_object("foo", "write");
-
-    ok($neb->unlock_object("foo", "write"), "write unlock");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->unlock_object("foo", "read");
-};
-like($@, qr/is valid object key/, "storage object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->unlock_object("foo", "write");
-};
-like($@, qr/is valid object key/, "storage object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->unlock_object("foo", "read");
-};
-like($@, qr/can not remove non-existant read lock/, "no lock set");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->unlock_object("foo", "write");
-};
-like($@, qr/can not remove non-existant write lock/, "no lock set");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-    $neb->lock_object("foo", "write");
-
-    $neb->unlock_object("foo", "read");
-};
-like($@, qr/can not have a read lock under a write lock/, "read unlock under write lock");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-    $neb->lock_object("foo", "read");
-
-    $neb->unlock_object("foo", "write");
-};
-like($@, qr/can not have a write lock under a read lock/, "write unlock under read lock");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->unlock_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->unlock_object("foo");
-};
-like($@, qr/2 were expected/, "not enough params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->unlock_object("foo", "both");
-};
-like($@, qr/is read or write/, "not read or write");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->unlock_object("foo", 'read', 3);
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/07_server_find_instances.t
===================================================================
--- trunk/Nebulous-Server/t/07_server_find_instances.t	(revision 24355)
+++ 	(revision )
@@ -1,142 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 07_server_find_instances.t,v 1.16 2008-09-11 22:35:52 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 19;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::URI;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $neb->create_object("foo");
-
-    my $locations = $neb->find_instances("foo");
-
-    uri_scheme_ok($locations->[0], 'file');
-    is($uri, $locations->[0], "URIs match");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri1 = $neb->create_object("foo");
-    my $uri2 = $neb->replicate_object("foo");
-
-    my $locations = $neb->find_instances("foo");
-
-    uri_scheme_ok($locations->[0], 'file');
-    uri_scheme_ok($locations->[1], 'file');
-    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, volume
-    my $uri = $neb->create_object('foo', 'node01');
-
-    my $locations = $neb->find_instances('foo', 'node01');
-
-    uri_scheme_ok($locations->[0], 'file');
-    is($uri, $locations->[0], "URIs match");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, volume
-    my $uri = $neb->create_object('foo', 'node01');
-
-    my $locations = $neb->find_instances('foo', undef);
-
-    uri_scheme_ok($locations->[0], 'file');
-    is($uri, $locations->[0], "URIs match");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key, volume
-    my $uri = $neb->create_object('foo', 'node01');
-
-    my $locations = $neb->find_instances('neb://node02/foo', "~any");
-
-    uri_scheme_ok($locations->[0], 'file');
-    is($uri, $locations->[0], "URIs match");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri1 = $neb->create_object("foo");
-    my $uri2 = $neb->replicate_object("foo");
-
-    my $locations = $neb->find_instances("foo", "~any");
-
-    uri_scheme_ok($locations->[0], 'file');
-    uri_scheme_ok($locations->[1], 'file');
-    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
-}
-
-# object exists but instance is on a different volume
-Test::Nebulous->setup;
-
-eval {
-    # key, volume
-    my $uri = $neb->create_object('foo', '~node01');
-
-    my $locations = $neb->find_instances('foo', '~node02');
-};
-like($@, qr/no instances on storage volume/, 'instances on a different volume');
-
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->find_instances('foo');
-};
-like($@, qr/is valid object key/, "storage object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->find_instances('foo', '~bar');
-};
-like($@, qr/is not a valid volume name/, "storage volume does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->find_instances();
-};
-like($@, qr/1 - 2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->find_instances('foo', 'node01', 3);
-};
-like($@, qr/1 - 2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/07_server_unlock_object.t
===================================================================
--- trunk/Nebulous-Server/t/07_server_unlock_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/07_server_unlock_object.t	(revision 24356)
@@ -0,0 +1,141 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 06_server_unlock_object.t,v 1.10 2008-03-20 21:10:14 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 14;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "read");
+
+    ok($neb->unlock_object("foo", "read"), "read unlock");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "read");
+    $neb->lock_object("foo", "read");
+
+    ok($neb->unlock_object("foo", "read"), "read unlock");
+    ok($neb->unlock_object("foo", "read"), "read unlock");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    $neb->lock_object("foo", "write");
+
+    ok($neb->unlock_object("foo", "write"), "write unlock");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->unlock_object("foo", "read");
+};
+like($@, qr/is valid object key/, "storage object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->unlock_object("foo", "write");
+};
+like($@, qr/is valid object key/, "storage object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->unlock_object("foo", "read");
+};
+like($@, qr/can not remove non-existant read lock/, "no lock set");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->unlock_object("foo", "write");
+};
+like($@, qr/can not remove non-existant write lock/, "no lock set");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+    $neb->lock_object("foo", "write");
+
+    $neb->unlock_object("foo", "read");
+};
+like($@, qr/can not have a read lock under a write lock/, "read unlock under write lock");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+    $neb->lock_object("foo", "read");
+
+    $neb->unlock_object("foo", "write");
+};
+like($@, qr/can not have a write lock under a read lock/, "write unlock under read lock");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->unlock_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->unlock_object("foo");
+};
+like($@, qr/2 were expected/, "not enough params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->unlock_object("foo", "both");
+};
+like($@, qr/is read or write/, "not read or write");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->unlock_object("foo", 'read', 3);
+};
+like($@, qr/2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/08_server_delete_instance.t
===================================================================
--- trunk/Nebulous-Server/t/08_server_delete_instance.t	(revision 24355)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 08_server_delete_instance.t,v 1.10.22.1 2008-12-14 22:52:37 eugene Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 8;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    my $key = "foo";
-    my $uri = $neb->create_object($key);
-
-    ok($neb->delete_instance($key, $uri), "delete instance");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "foo";
-    my $uri1 = $neb->create_object($key);
-    my $uri2 = $neb->replicate_object($key);
-
-    ok($neb->delete_instance($key, $uri1), "delete instance");
-
-    my $locations = $neb->find_instances($key);
-
-    is($locations->[0], $uri2, "instance remains");
-
-    ok($neb->delete_instance($key, $uri2), "delete instance");
-
-    eval {
-        $neb->find_instances($key);
-    };
-    like($@, qr/is valid object key/, "storage object was deleted");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    my $key = "foo";
-    my $uri1 = $neb->create_object($key);
-
-    $neb->delete_instance($key, "file:/foo");
-};
-like($@, qr/no instance is associated with uri/, "uri does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->delete_instance();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    my $key = "foo";
-    my $uri1 = $neb->create_object($key);
-
-    $neb->delete_instance("foo", 2, 3);
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/08_server_find_instances.t
===================================================================
--- trunk/Nebulous-Server/t/08_server_find_instances.t	(revision 24356)
+++ trunk/Nebulous-Server/t/08_server_find_instances.t	(revision 24356)
@@ -0,0 +1,142 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 07_server_find_instances.t,v 1.16 2008-09-11 22:35:52 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 19;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::URI;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri = $neb->create_object("foo");
+
+    my $locations = $neb->find_instances("foo");
+
+    uri_scheme_ok($locations->[0], 'file');
+    is($uri, $locations->[0], "URIs match");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri1 = $neb->create_object("foo");
+    my $uri2 = $neb->replicate_object("foo");
+
+    my $locations = $neb->find_instances("foo");
+
+    uri_scheme_ok($locations->[0], 'file');
+    uri_scheme_ok($locations->[1], 'file');
+    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, volume
+    my $uri = $neb->create_object('foo', 'node01');
+
+    my $locations = $neb->find_instances('foo', 'node01');
+
+    uri_scheme_ok($locations->[0], 'file');
+    is($uri, $locations->[0], "URIs match");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, volume
+    my $uri = $neb->create_object('foo', 'node01');
+
+    my $locations = $neb->find_instances('foo', undef);
+
+    uri_scheme_ok($locations->[0], 'file');
+    is($uri, $locations->[0], "URIs match");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, volume
+    my $uri = $neb->create_object('foo', 'node01');
+
+    my $locations = $neb->find_instances('neb://node02/foo', "~any");
+
+    uri_scheme_ok($locations->[0], 'file');
+    is($uri, $locations->[0], "URIs match");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $uri1 = $neb->create_object("foo");
+    my $uri2 = $neb->replicate_object("foo");
+
+    my $locations = $neb->find_instances("foo", "~any");
+
+    uri_scheme_ok($locations->[0], 'file');
+    uri_scheme_ok($locations->[1], 'file');
+    ok(eq_set([$uri1, $uri2], $locations), "URIs match");
+}
+
+# object exists but instance is on a different volume
+Test::Nebulous->setup;
+
+eval {
+    # key, volume
+    my $uri = $neb->create_object('foo', '~node01');
+
+    my $locations = $neb->find_instances('foo', '~node02');
+};
+like($@, qr/no instances on storage volume/, 'instances on a different volume');
+
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->find_instances('foo');
+};
+like($@, qr/is valid object key/, "storage object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->find_instances('foo', '~bar');
+};
+like($@, qr/is not a valid volume name/, "storage volume does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->find_instances();
+};
+like($@, qr/1 - 2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->find_instances('foo', 'node01', 3);
+};
+like($@, qr/1 - 2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/09_server_delete_instance.t
===================================================================
--- trunk/Nebulous-Server/t/09_server_delete_instance.t	(revision 24356)
+++ trunk/Nebulous-Server/t/09_server_delete_instance.t	(revision 24356)
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 08_server_delete_instance.t,v 1.10.22.1 2008-12-14 22:52:37 eugene Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 8;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    my $key = "foo";
+    my $uri = $neb->create_object($key);
+
+    ok($neb->delete_instance($key, $uri), "delete instance");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "foo";
+    my $uri1 = $neb->create_object($key);
+    my $uri2 = $neb->replicate_object($key);
+
+    ok($neb->delete_instance($key, $uri1), "delete instance");
+
+    my $locations = $neb->find_instances($key);
+
+    is($locations->[0], $uri2, "instance remains");
+
+    ok($neb->delete_instance($key, $uri2), "delete instance");
+
+    eval {
+        $neb->find_instances($key);
+    };
+    like($@, qr/is valid object key/, "storage object was deleted");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    my $key = "foo";
+    my $uri1 = $neb->create_object($key);
+
+    $neb->delete_instance($key, "file:/foo");
+};
+like($@, qr/no instance is associated with uri/, "uri does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->delete_instance();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    my $key = "foo";
+    my $uri1 = $neb->create_object($key);
+
+    $neb->delete_instance("foo", 2, 3);
+};
+like($@, qr/2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/09_server_stat_object.t
===================================================================
--- trunk/Nebulous-Server/t/09_server_stat_object.t	(revision 24355)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 09_server_stat_object.t,v 1.15 2008-05-16 20:29:19 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 12;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-{
-    $neb->create_object("foo");
-
-    my $info = $neb->stat_object("foo");
-
-    is(scalar @$info, 7, "number of columns");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo", "node01");
-
-    my $info = $neb->stat_object("foo");
-
-    is(scalar @$info, 7,                       "number of columns");
-    is(@$info[0], 1,                           "so_id");
-    is(@$info[1], "foo",                       "ext_id");
-    is(@$info[2], 0,                           "read lock");
-    is(@$info[3], undef,                       "write lock");
-    like(@$info[4], qr/....-..-.. ..:..:../,   "epoch");
-    like(@$info[5], qr/....-..-.. ..:..:../,   "mtime");
-    is(@$info[6], 1,                           "instances");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    my $stat = $neb->stat_object("foo");
-};
-like($@, qr/is valid object key/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->stat_object();
-};
-like($@, qr/1 was expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-    $neb->stat_object("foo", 2);
-};
-like($@, qr/1 was expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t
===================================================================
--- trunk/Nebulous-Server/t/10_server_is_valid_volume_name.t	(revision 24355)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 10_server_is_valid_volume_name.t,v 1.7 2008-12-14 22:54:25 eugene Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 3;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-ok($neb->_is_valid_volume_name('foo', 'node01'), "valid volume name");
-
-Test::Nebulous->setup;
-
-ok($neb->_is_valid_volume_name('foo', 'node02'), "valid volume name");
-
-Test::Nebulous->setup;
-
-is($neb->_is_valid_volume_name('foo', 'node99'), undef, "invalid volume name");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/10_server_stat_object.t
===================================================================
--- trunk/Nebulous-Server/t/10_server_stat_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/10_server_stat_object.t	(revision 24356)
@@ -0,0 +1,71 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 09_server_stat_object.t,v 1.15 2008-05-16 20:29:19 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 12;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+{
+    $neb->create_object("foo");
+
+    my $info = $neb->stat_object("foo");
+
+    is(scalar @$info, 7, "number of columns");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo", "node01");
+
+    my $info = $neb->stat_object("foo");
+
+    is(scalar @$info, 7,                       "number of columns");
+    is(@$info[0], 1,                           "so_id");
+    is(@$info[1], "foo",                       "ext_id");
+    is(@$info[2], 0,                           "read lock");
+    is(@$info[3], undef,                       "write lock");
+    like(@$info[4], qr/....-..-.. ..:..:../,   "epoch");
+    like(@$info[5], qr/....-..-.. ..:..:../,   "mtime");
+    is(@$info[6], 1,                           "instances");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    my $stat = $neb->stat_object("foo");
+};
+like($@, qr/is valid object key/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->stat_object();
+};
+like($@, qr/1 was expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+    $neb->stat_object("foo", 2);
+};
+like($@, qr/1 was expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/11_server_is_valid_object_key.t
===================================================================
--- trunk/Nebulous-Server/t/11_server_is_valid_object_key.t	(revision 24355)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 11_server_is_valid_object_key.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 2;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object('foo');
-
-    ok($neb->_is_valid_object_key('foo'), "valid object key");
-}
-
-Test::Nebulous->setup;
-
-{
-    ok(!$neb->_is_valid_object_key('foo'), "invalid object key");
-}
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/11_server_is_valid_volume_name.t
===================================================================
--- trunk/Nebulous-Server/t/11_server_is_valid_volume_name.t	(revision 24356)
+++ trunk/Nebulous-Server/t/11_server_is_valid_volume_name.t	(revision 24356)
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 10_server_is_valid_volume_name.t,v 1.7 2008-12-14 22:54:25 eugene Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 3;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+ok($neb->_is_valid_volume_name('foo', 'node01'), "valid volume name");
+
+Test::Nebulous->setup;
+
+ok($neb->_is_valid_volume_name('foo', 'node02'), "valid volume name");
+
+Test::Nebulous->setup;
+
+is($neb->_is_valid_volume_name('foo', 'node99'), undef, "invalid volume name");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/12_server_find_objects.t
===================================================================
--- trunk/Nebulous-Server/t/12_server_find_objects.t	(revision 24355)
+++ 	(revision )
@@ -1,180 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 12_server_find_objects.t,v 1.4 2008-05-16 20:29:19 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 28;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-# search for a regex of '' should match nothing
-eval {
-    $neb->create_object("foo");
-
-    my $keys = $neb->find_objects();
-};
-like($@, qr/no keys found/, "no keys found");
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("foo");
-
-    my $keys = $neb->find_objects("foo");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    $neb->create_object("foo");
-    $neb->replicate_object("foo");
-
-    my $keys = $neb->find_objects("foo");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    $neb->create_object("foo");
-    $neb->create_object("bar");
-
-    my $keys = $neb->find_objects("foo");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-}
-
-# test recursive dir searching
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-
-    my $keys = $neb->find_objects("a");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "a/foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("b/foo");
-
-    my $keys = $neb->find_objects("a");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "a/foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("a/b/foo");
-
-    my $keys = $neb->find_objects("a");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "a/foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("a/bar");
-
-    my $keys = $neb->find_objects("a");
-
-    is(scalar @$keys, 2, 'number of keys found');
-    is($keys->[0], "a/foo", "key name");
-    is($keys->[1], "a/bar", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("bar");
-
-    my $keys = $neb->find_objects("a");
-
-    is(scalar @$keys, 1, 'number of keys found');
-    is($keys->[0], "a/foo", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("foo");
-    $neb->create_object("bar");
-
-    my $keys = $neb->find_objects("/");
-
-    is(scalar @$keys, 2, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-    is($keys->[1], "bar", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("foo");
-    $neb->create_object("bar");
-
-    my $keys = $neb->find_objects(".");
-
-    is(scalar @$keys, 2, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-    is($keys->[1], "bar", "key name");
-}
-
-Test::Nebulous->setup;
-
-{
-    $neb->create_object("a/foo");
-    $neb->create_object("foo");
-    $neb->create_object("bar");
-
-    my $keys = $neb->find_objects("..");
-
-    is(scalar @$keys, 2, 'number of keys found');
-    is($keys->[0], "foo", "key name");
-    is($keys->[1], "bar", "key name");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->find_objects("foo", 3);
-};
-like($@, qr/1 was expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/12_server_is_valid_object_key.t
===================================================================
--- trunk/Nebulous-Server/t/12_server_is_valid_object_key.t	(revision 24356)
+++ trunk/Nebulous-Server/t/12_server_is_valid_object_key.t	(revision 24356)
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 11_server_is_valid_object_key.t,v 1.3 2008-03-20 21:10:14 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 2;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object('foo');
+
+    ok($neb->_is_valid_object_key('foo'), "valid object key");
+}
+
+Test::Nebulous->setup;
+
+{
+    ok(!$neb->_is_valid_object_key('foo'), "invalid object key");
+}
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/13_server_find_objects.t
===================================================================
--- trunk/Nebulous-Server/t/13_server_find_objects.t	(revision 24356)
+++ trunk/Nebulous-Server/t/13_server_find_objects.t	(revision 24356)
@@ -0,0 +1,180 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 12_server_find_objects.t,v 1.4 2008-05-16 20:29:19 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 28;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+# search for a regex of '' should match nothing
+eval {
+    $neb->create_object("foo");
+
+    my $keys = $neb->find_objects();
+};
+like($@, qr/no keys found/, "no keys found");
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("foo");
+
+    my $keys = $neb->find_objects("foo");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    $neb->create_object("foo");
+    $neb->replicate_object("foo");
+
+    my $keys = $neb->find_objects("foo");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    # key
+    $neb->create_object("foo");
+    $neb->create_object("bar");
+
+    my $keys = $neb->find_objects("foo");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+}
+
+# test recursive dir searching
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+
+    my $keys = $neb->find_objects("a");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "a/foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("b/foo");
+
+    my $keys = $neb->find_objects("a");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "a/foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("a/b/foo");
+
+    my $keys = $neb->find_objects("a");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "a/foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("a/bar");
+
+    my $keys = $neb->find_objects("a");
+
+    is(scalar @$keys, 2, 'number of keys found');
+    is($keys->[0], "a/foo", "key name");
+    is($keys->[1], "a/bar", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("bar");
+
+    my $keys = $neb->find_objects("a");
+
+    is(scalar @$keys, 1, 'number of keys found');
+    is($keys->[0], "a/foo", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("foo");
+    $neb->create_object("bar");
+
+    my $keys = $neb->find_objects("/");
+
+    is(scalar @$keys, 2, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+    is($keys->[1], "bar", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("foo");
+    $neb->create_object("bar");
+
+    my $keys = $neb->find_objects(".");
+
+    is(scalar @$keys, 2, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+    is($keys->[1], "bar", "key name");
+}
+
+Test::Nebulous->setup;
+
+{
+    $neb->create_object("a/foo");
+    $neb->create_object("foo");
+    $neb->create_object("bar");
+
+    my $keys = $neb->find_objects("..");
+
+    is(scalar @$keys, 2, 'number of keys found');
+    is($keys->[0], "foo", "key name");
+    is($keys->[1], "bar", "key name");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->find_objects("foo", 3);
+};
+like($@, qr/1 was expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/13_server_rename_object.t
===================================================================
--- trunk/Nebulous-Server/t/13_server_rename_object.t	(revision 24355)
+++ 	(revision )
@@ -1,122 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2007  Joshua Hoblitt
-#
-# $Id: 13_server_rename_object.t,v 1.5 2008-05-16 20:29:19 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 8;
-
-use lib qw( ./t ./lib );
-
-use File::Basename qw( basename );
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
-
-Test::Nebulous->setup;
-
-{
-    my $key = "bar";
-    my $uri = $neb->create_object("foo");
-
-    $neb->rename_object("foo", $key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "a/bar";
-    my $uri = $neb->create_object("foo");
-
-    $neb->rename_object("foo", $key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 2],
-    );
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key = "bar";
-    my $uri = $neb->create_object("a/foo");
-
-    $neb->rename_object("a/foo", $key);
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
-    );
-}
-
-Test::Nebulous->setup;
-
-# destination key exists
-eval {
-    $neb->create_object('foo');
-    $neb->create_object('bar');
-
-    $neb->rename_object('foo', 'bar');
-};
-like($@, qr/is not valid object key/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->rename_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->rename_object("foo");
-};
-like($@, qr/2 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->rename_object("foo", "bar", "baz");
-};
-like($@, qr/2 were expected/, "too many params");
-
-# test attempting to rename a key in such a way to cause the distributed
-# storage db to change
-# this must be the last test as we're messing with the $neb object
-eval {
-    $neb->config->add_db(
-        dbindex     => 1,
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-    );
-
-    $neb->create_object("a/foo");
-    $neb->rename_object("a/foo", "g/bar");
-};
-like($@, qr/rename objects across distributed database boundaries/, "rename between databases");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/14_server_rename_object.t
===================================================================
--- trunk/Nebulous-Server/t/14_server_rename_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/14_server_rename_object.t	(revision 24356)
@@ -0,0 +1,122 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2007  Joshua Hoblitt
+#
+# $Id: 13_server_rename_object.t,v 1.5 2008-05-16 20:29:19 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 8;
+
+use lib qw( ./t ./lib );
+
+use File::Basename qw( basename );
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
+
+Test::Nebulous->setup;
+
+{
+    my $key = "bar";
+    my $uri = $neb->create_object("foo");
+
+    $neb->rename_object("foo", $key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "a/bar";
+    my $uri = $neb->create_object("foo");
+
+    $neb->rename_object("foo", $key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 2],
+    );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key = "bar";
+    my $uri = $neb->create_object("a/foo");
+
+    $neb->rename_object("a/foo", $key);
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key, ext_id_basename => basename($key), dir_id => 1],
+    );
+}
+
+Test::Nebulous->setup;
+
+# destination key exists
+eval {
+    $neb->create_object('foo');
+    $neb->create_object('bar');
+
+    $neb->rename_object('foo', 'bar');
+};
+like($@, qr/is not valid object key/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->rename_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->rename_object("foo");
+};
+like($@, qr/2 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->rename_object("foo", "bar", "baz");
+};
+like($@, qr/2 were expected/, "too many params");
+
+# test attempting to rename a key in such a way to cause the distributed
+# storage db to change
+# this must be the last test as we're messing with the $neb object
+eval {
+    $neb->config->add_db(
+        dbindex     => 1,
+        dsn         => $NEB_DB,
+        dbuser      => $NEB_USER,
+        dbpasswd    => $NEB_PASS,
+    );
+
+    $neb->create_object("a/foo");
+    $neb->rename_object("a/foo", "g/bar");
+};
+like($@, qr/rename objects across distributed database boundaries/, "rename between databases");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/14_server_xattr.t
===================================================================
--- trunk/Nebulous-Server/t/14_server_xattr.t	(revision 24355)
+++ 	(revision )
@@ -1,286 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2007  Joshua Hoblitt
-#
-# $Id: 14_server_xattr.t,v 1.8 2008-07-09 23:32:35 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 44;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-# 1 key / xattr
-
-Test::Nebulous->setup;
-
-{
-    my $uri = $neb->create_object('foo');
-
-    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 1, 'number of xattrs');
-        is(@$xattrs[0], 'user.bar', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'user.bar');
-    is($value, 'baz', 'xattr value');
-
-    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 0, 'number of xattrs');
-    }
-}
-
-# multiple xattrs
-
-Test::Nebulous->setup;
-
-{
-    my $uri = $neb->create_object('foo');
-
-    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
-    ok($neb->setxattr_object('foo', 'user.bonk', 'quix', 'create'), 'set object xattr');
-    
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 2, 'number of xattrs');
-        is(@$xattrs[0], 'user.bar', 'xattr name');
-        is(@$xattrs[1], 'user.bonk', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'user.bar');
-    is($value, 'baz', 'xattr value');
-    $value = $neb->getxattr_object('foo', 'user.bonk');
-    is($value, 'quix', 'xattr value');
-
-    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
-    ok($neb->removexattr_object('foo', 'user.bonk'), "remove object xattr");
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 0, 'number of xattrs');
-    }
-}
-
-# replace xattrs
-
-Test::Nebulous->setup;
-
-{
-    my $uri = $neb->create_object('foo');
-
-    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
-    ok($neb->setxattr_object('foo', 'user.bar', 'quix', 'replace'), 're-set object xattr');
-    
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 1, 'number of xattrs');
-        is(@$xattrs[0], 'user.bar', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'user.bar');
-    is($value, 'quix', 'xattr value');
-
-    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
-    {
-        my $xattrs = $neb->listxattr_object('foo');
-        is(scalar @$xattrs, 0, 'number of xattrs');
-    }
-}
-
-# setxattr_object
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->setxattr_object('foo', 'user.bar', 'baz', 'create');
-};
-like($@, qr/is valid object key/, "create xattr on non-existant key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'luser.bar', 'baz', 'create');
-};
-like($@, qr/xattr is in user. namespace/, "user. namspace");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->setxattr_object('foo', 'user.bar', 'baz', 'replace');
-};
-like($@, qr/is valid object key/, "replace xattr on non-existant key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->setxattr_object();
-};
-like($@, qr/4 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'user.bar');
-};
-like($@, qr/4 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'user.bar', 'baz');
-};
-like($@, qr/4 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'user.bar', 'baz', 'create', 'quix');
-};
-like($@, qr/4 were expected/, "too many params");
-
-# getxattr_object
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->getxattr_object('foo', 'bar');
-};
-like($@, qr/is valid object key/, "get xattr from non-existant nebulous key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->getxattr_object('foo', 'luser.bar');
-};
-like($@, qr/xattr is in user. namespace/, "user. namespace");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->getxattr_object('foo', 'user.bar');
-};
-like($@, qr|xattr neb:///foo:user.bar does not exist|,
-    "get xattr from non-existant xattr key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->getxattr_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->getxattr_object('foo');
-};
-like($@, qr/2 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->getxattr_object('foo', 'user.bar', 'baz');
-};
-like($@, qr/2 were expected/, "too many params");
-
-# listxattr_object
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->listxattr_object();
-};
-like($@, qr/1 was expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->listxattr_object('foo', 'bar');
-};
-like($@, qr/1 was expected/, "too many params");
-
-# removexattr_object
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->removexattr_object('foo', 'user.bar');
-};
-like($@, qr/is valid object key/, "remove xattr from non-existant nebulous key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->getxattr_object('foo', 'luser.bar');
-};
-like($@, qr/xattr is in user. namespace/, "user. namespace");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->removexattr_object('foo', 'user.bar');
-};
-like($@, qr|xattr neb:///foo:user.bar does not exist|,
-    "remove xattr from non-existant xattr key");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->removexattr_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->removexattr_object('foo');
-};
-like($@, qr/2 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->removexattr_object('foo', 'user.bar', 'baz');
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/15_mounts.t
===================================================================
--- trunk/Nebulous-Server/t/15_mounts.t	(revision 24355)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2008  Joshua Hoblitt
-#
-# $Id: 15_mounts.t,v 1.3 2008-09-11 22:35:52 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 18;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::URI;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $mounts = $neb->mounts();
-
-    is(scalar @$mounts, 7, "number of rows");
-
-    my %row;
-    # first row
-    @row{qw(mountpoint total used vol_id name host path allocate available xattr)}
-        = @{$mounts->[0]};
-    
-    is($row{total},     100000000000);
-    is($row{used},      100000000);
-    is($row{vol_id},    1);
-    is($row{name},      "node01");
-    is($row{host},      "node01");
-    is($row{allocate},  1);
-    is($row{available}, 1);
-    is($row{xattr},     0);
-
-    # 2nd row
-    @row{qw(mountpoint total used vol_id name host path allocate available xattr)}
-        = @{$mounts->[1]};
-
-    is($row{total},     100000000000);
-    is($row{used},      1000000000);
-    is($row{vol_id},    2);
-    is($row{name},      "node02");
-    is($row{host},      "node02");
-    is($row{allocate},  1);
-    is($row{available}, 1);
-    is($row{xattr},     0);
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->mounts("foo");
-};
-like($@, qr/0 were expected/, "no params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/15_server_xattr.t
===================================================================
--- trunk/Nebulous-Server/t/15_server_xattr.t	(revision 24356)
+++ trunk/Nebulous-Server/t/15_server_xattr.t	(revision 24356)
@@ -0,0 +1,286 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2007  Joshua Hoblitt
+#
+# $Id: 14_server_xattr.t,v 1.8 2008-07-09 23:32:35 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 44;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+# 1 key / xattr
+
+Test::Nebulous->setup;
+
+{
+    my $uri = $neb->create_object('foo');
+
+    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 1, 'number of xattrs');
+        is(@$xattrs[0], 'user.bar', 'xattr name');
+    }
+
+    my $value = $neb->getxattr_object('foo', 'user.bar');
+    is($value, 'baz', 'xattr value');
+
+    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 0, 'number of xattrs');
+    }
+}
+
+# multiple xattrs
+
+Test::Nebulous->setup;
+
+{
+    my $uri = $neb->create_object('foo');
+
+    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
+    ok($neb->setxattr_object('foo', 'user.bonk', 'quix', 'create'), 'set object xattr');
+    
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 2, 'number of xattrs');
+        is(@$xattrs[0], 'user.bar', 'xattr name');
+        is(@$xattrs[1], 'user.bonk', 'xattr name');
+    }
+
+    my $value = $neb->getxattr_object('foo', 'user.bar');
+    is($value, 'baz', 'xattr value');
+    $value = $neb->getxattr_object('foo', 'user.bonk');
+    is($value, 'quix', 'xattr value');
+
+    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
+    ok($neb->removexattr_object('foo', 'user.bonk'), "remove object xattr");
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 0, 'number of xattrs');
+    }
+}
+
+# replace xattrs
+
+Test::Nebulous->setup;
+
+{
+    my $uri = $neb->create_object('foo');
+
+    ok($neb->setxattr_object('foo', 'user.bar', 'baz', 'create'), 'set object xattr');
+    ok($neb->setxattr_object('foo', 'user.bar', 'quix', 'replace'), 're-set object xattr');
+    
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 1, 'number of xattrs');
+        is(@$xattrs[0], 'user.bar', 'xattr name');
+    }
+
+    my $value = $neb->getxattr_object('foo', 'user.bar');
+    is($value, 'quix', 'xattr value');
+
+    ok($neb->removexattr_object('foo', 'user.bar'), "remove object xattr");
+    {
+        my $xattrs = $neb->listxattr_object('foo');
+        is(scalar @$xattrs, 0, 'number of xattrs');
+    }
+}
+
+# setxattr_object
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->setxattr_object('foo', 'user.bar', 'baz', 'create');
+};
+like($@, qr/is valid object key/, "create xattr on non-existant key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->setxattr_object('foo', 'luser.bar', 'baz', 'create');
+};
+like($@, qr/xattr is in user. namespace/, "user. namspace");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->setxattr_object('foo', 'user.bar', 'baz', 'replace');
+};
+like($@, qr/is valid object key/, "replace xattr on non-existant key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->setxattr_object();
+};
+like($@, qr/4 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->setxattr_object('foo', 'user.bar');
+};
+like($@, qr/4 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->setxattr_object('foo', 'user.bar', 'baz');
+};
+like($@, qr/4 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->setxattr_object('foo', 'user.bar', 'baz', 'create', 'quix');
+};
+like($@, qr/4 were expected/, "too many params");
+
+# getxattr_object
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->getxattr_object('foo', 'bar');
+};
+like($@, qr/is valid object key/, "get xattr from non-existant nebulous key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->getxattr_object('foo', 'luser.bar');
+};
+like($@, qr/xattr is in user. namespace/, "user. namespace");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->getxattr_object('foo', 'user.bar');
+};
+like($@, qr|xattr neb:///foo:user.bar does not exist|,
+    "get xattr from non-existant xattr key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->getxattr_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->getxattr_object('foo');
+};
+like($@, qr/2 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->getxattr_object('foo', 'user.bar', 'baz');
+};
+like($@, qr/2 were expected/, "too many params");
+
+# listxattr_object
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->listxattr_object();
+};
+like($@, qr/1 was expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->listxattr_object('foo', 'bar');
+};
+like($@, qr/1 was expected/, "too many params");
+
+# removexattr_object
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->removexattr_object('foo', 'user.bar');
+};
+like($@, qr/is valid object key/, "remove xattr from non-existant nebulous key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->getxattr_object('foo', 'luser.bar');
+};
+like($@, qr/xattr is in user. namespace/, "user. namespace");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+    $neb->removexattr_object('foo', 'user.bar');
+};
+like($@, qr|xattr neb:///foo:user.bar does not exist|,
+    "remove xattr from non-existant xattr key");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->removexattr_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->removexattr_object('foo');
+};
+like($@, qr/2 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->removexattr_object('foo', 'user.bar', 'baz');
+};
+like($@, qr/2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/16_mounts.t
===================================================================
--- trunk/Nebulous-Server/t/16_mounts.t	(revision 24356)
+++ trunk/Nebulous-Server/t/16_mounts.t	(revision 24356)
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2008  Joshua Hoblitt
+#
+# $Id: 15_mounts.t,v 1.3 2008-09-11 22:35:52 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 18;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::URI;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $mounts = $neb->mounts();
+
+    is(scalar @$mounts, 7, "number of rows");
+
+    my %row;
+    # first row
+    @row{qw(mountpoint total used vol_id name host path allocate available xattr)}
+        = @{$mounts->[0]};
+    
+    is($row{total},     100000000000);
+    is($row{used},      100000000);
+    is($row{vol_id},    1);
+    is($row{name},      "node01");
+    is($row{host},      "node01");
+    is($row{allocate},  1);
+    is($row{available}, 1);
+    is($row{xattr},     0);
+
+    # 2nd row
+    @row{qw(mountpoint total used vol_id name host path allocate available xattr)}
+        = @{$mounts->[1]};
+
+    is($row{total},     100000000000);
+    is($row{used},      1000000000);
+    is($row{vol_id},    2);
+    is($row{name},      "node02");
+    is($row{host},      "node02");
+    is($row{allocate},  1);
+    is($row{available}, 1);
+    is($row{xattr},     0);
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->mounts("foo");
+};
+like($@, qr/0 were expected/, "no params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/16_server_swap_objects.t
===================================================================
--- trunk/Nebulous-Server/t/16_server_swap_objects.t	(revision 24355)
+++ 	(revision )
@@ -1,117 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2007  Joshua Hoblitt
-#
-# $Id: 16_server_swap_objects.t,v 1.1 2008-10-13 20:41:17 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 13;
-
-use lib qw( ./t ./lib );
-
-use File::Basename qw( basename );
-use Nebulous::Server;
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "foo1";
-    my $key2 = "foo2";
-    my $uri1 = $neb->create_object($key1);
-    my $uri2 = $neb->create_object($key2);
-
-    ok($neb->swap_objects($key1, $key2), "swap succeeded");
-
-    my $new_uri1 = ($neb->find_instances($key1))->[0];
-    my $new_uri2 = ($neb->find_instances($key2))->[0];
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 1],
-        storage_object  => [so_id => 2, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 1],
-    );
-
-    is($uri1, $new_uri2, "key1 -> key2");
-    is($uri2, $new_uri1, "key2 -> key1");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $key1 = "foo1";
-    my $key2 = "a/foo2";
-    my $uri1 = $neb->create_object($key1);
-    my $uri2 = $neb->create_object($key2);
-
-    ok($neb->swap_objects($key1, $key2), "swap succeeded");
-
-    my $new_uri1 = ($neb->find_instances($key1))->[0];
-    my $new_uri2 = ($neb->find_instances($key2))->[0];
-
-    expected_dataset_ok(
-        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
-        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
-        storage_object  => [so_id => 1, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 2],
-        storage_object  => [so_id => 2, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 1],
-    );
-
-    is($uri1, $new_uri2, "key1 -> key2");
-    is($uri2, $new_uri1, "key2 -> key1");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('bar');
-
-    $neb->swap_objects('foo', 'bar');
-};
-like($@, qr/is valid object key/, "key1 doesn't exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->swap_objects('foo', 'bar');
-};
-like($@, qr/is valid object key/, "key2 doesn't exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->swap_objects();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->swap_objects("foo");
-};
-like($@, qr/2 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-    $neb->create_object("bar");
-
-    $neb->swap_objects("foo", "bar", "baz");
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/17_server_chmod_object.t
===================================================================
--- trunk/Nebulous-Server/t/17_server_chmod_object.t	(revision 24355)
+++ 	(revision )
@@ -1,111 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2009  Joshua Hoblitt
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 13;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::URI;
-use Test::Nebulous;
-use URI;
-use File::stat;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-# object with one instance
-{
-    my $key = "foo";
-    my $uri = $neb->create_object($key);
-
-    my $path = URI->new($uri)->path;
-    my $st1 = stat($path);
-
-    my $mode = $neb->chmod_object($key, 0440);
-    my $st2 = stat($path);
-
-    is($st2->mode &07777, 0440, "chmod() single instance");
-    is($mode, 0440, "returned mode");
-    is($neb->getxattr_object($key, 'user.mode'), 0440, "xattr user.mode");
-}
-
-Test::Nebulous->setup;
-
-# object with two instances
-{
-    my $key = "foo";
-    my $uri1 = $neb->create_object($key);
-    my $uri2 = $neb->replicate_object($key);
-
-    my $mode = $neb->chmod_object($key, 0440);
-
-    my $st1 = stat(URI->new($uri1)->path);
-    my $st2 = stat(URI->new($uri2)->path);
-
-    is($st1->mode &07777, 0440, "chmod() first instance");
-    is($st2->mode &07777, 0440, "chmod() second instance");
-    is($mode, 0440, "returned mode");
-    is($neb->getxattr_object($key, 'user.mode'), 0440, "xattr user.mode");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->chmod_object("foo", 0644);
-};
-like($@, qr/valid object/, "object does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->chmod_object("foo", 0640);
-};
-like($@, qr/allowable mode/, "mode is not 0400");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->chmod_object("foo", 99999);
-};
-like($@, qr/allowable mode/, "bad mode");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->chmod_object();
-};
-like($@, qr/2 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->chmod_object("foo");
-};
-like($@, qr/2 were expected/, "one param");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("foo");
-
-    $neb->chmod_object("foo", 0440, 2);
-};
-like($@, qr/2 were expected/, "three params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/17_server_swap_objects.t
===================================================================
--- trunk/Nebulous-Server/t/17_server_swap_objects.t	(revision 24356)
+++ trunk/Nebulous-Server/t/17_server_swap_objects.t	(revision 24356)
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2007  Joshua Hoblitt
+#
+# $Id: 16_server_swap_objects.t,v 1.1 2008-10-13 20:41:17 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 13;
+
+use lib qw( ./t ./lib );
+
+use File::Basename qw( basename );
+use Nebulous::Server;
+use Test::Nebulous;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+use Test::DBUnit dsn => $NEB_DB, username => $NEB_USER, password => $NEB_PASS;
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "foo1";
+    my $key2 = "foo2";
+    my $uri1 = $neb->create_object($key1);
+    my $uri2 = $neb->create_object($key2);
+
+    ok($neb->swap_objects($key1, $key2), "swap succeeded");
+
+    my $new_uri1 = ($neb->find_instances($key1))->[0];
+    my $new_uri2 = ($neb->find_instances($key2))->[0];
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 1],
+        storage_object  => [so_id => 2, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 1],
+    );
+
+    is($uri1, $new_uri2, "key1 -> key2");
+    is($uri2, $new_uri1, "key2 -> key1");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $key1 = "foo1";
+    my $key2 = "a/foo2";
+    my $uri1 = $neb->create_object($key1);
+    my $uri2 = $neb->create_object($key2);
+
+    ok($neb->swap_objects($key1, $key2), "swap succeeded");
+
+    my $new_uri1 = ($neb->find_instances($key1))->[0];
+    my $new_uri2 = ($neb->find_instances($key2))->[0];
+
+    expected_dataset_ok(
+        directory       => [dir_id => 1, dirname => '/', parent_id => 1],
+        directory       => [dir_id => 2, dirname => 'a', parent_id => 1],
+        storage_object  => [so_id => 1, ext_id => $key2, ext_id_basename => basename($key2), dir_id => 2],
+        storage_object  => [so_id => 2, ext_id => $key1, ext_id_basename => basename($key1), dir_id => 1],
+    );
+
+    is($uri1, $new_uri2, "key1 -> key2");
+    is($uri2, $new_uri1, "key2 -> key1");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('bar');
+
+    $neb->swap_objects('foo', 'bar');
+};
+like($@, qr/is valid object key/, "key1 doesn't exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object('foo');
+
+    $neb->swap_objects('foo', 'bar');
+};
+like($@, qr/is valid object key/, "key2 doesn't exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->swap_objects();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->swap_objects("foo");
+};
+like($@, qr/2 were expected/, "too few params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+    $neb->create_object("bar");
+
+    $neb->swap_objects("foo", "bar", "baz");
+};
+like($@, qr/2 were expected/, "too many params");
+
+Test::Nebulous->cleanup;
Index: trunk/Nebulous-Server/t/18_server_chmod_object.t
===================================================================
--- trunk/Nebulous-Server/t/18_server_chmod_object.t	(revision 24356)
+++ trunk/Nebulous-Server/t/18_server_chmod_object.t	(revision 24356)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2009  Joshua Hoblitt
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Test::More tests => 13;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Server;
+use Test::URI;
+use Test::Nebulous;
+use URI;
+use File::stat;
+
+my $neb = Nebulous::Server->new(
+    dsn         => $NEB_DB,
+    dbuser      => $NEB_USER,
+    dbpasswd    => $NEB_PASS,
+);
+
+Test::Nebulous->setup;
+
+# object with one instance
+{
+    my $key = "foo";
+    my $uri = $neb->create_object($key);
+
+    my $path = URI->new($uri)->path;
+    my $st1 = stat($path);
+
+    my $mode = $neb->chmod_object($key, 0440);
+    my $st2 = stat($path);
+
+    is($st2->mode &07777, 0440, "chmod() single instance");
+    is($mode, 0440, "returned mode");
+    is($neb->getxattr_object($key, 'user.mode'), 0440, "xattr user.mode");
+}
+
+Test::Nebulous->setup;
+
+# object with two instances
+{
+    my $key = "foo";
+    my $uri1 = $neb->create_object($key);
+    my $uri2 = $neb->replicate_object($key);
+
+    my $mode = $neb->chmod_object($key, 0440);
+
+    my $st1 = stat(URI->new($uri1)->path);
+    my $st2 = stat(URI->new($uri2)->path);
+
+    is($st1->mode &07777, 0440, "chmod() first instance");
+    is($st2->mode &07777, 0440, "chmod() second instance");
+    is($mode, 0440, "returned mode");
+    is($neb->getxattr_object($key, 'user.mode'), 0440, "xattr user.mode");
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->chmod_object("foo", 0644);
+};
+like($@, qr/valid object/, "object does not exist");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->chmod_object("foo", 0640);
+};
+like($@, qr/allowable mode/, "mode is not 0400");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->chmod_object("foo", 99999);
+};
+like($@, qr/allowable mode/, "bad mode");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->chmod_object();
+};
+like($@, qr/2 were expected/, "no params");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->chmod_object("foo");
+};
+like($@, qr/2 were expected/, "one param");
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object("foo");
+
+    $neb->chmod_object("foo", 0440, 2);
+};
+like($@, qr/2 were expected/, "three params");
+
+Test::Nebulous->cleanup;
