Index: trunk/Nebulous/t/01_load.t
===================================================================
--- trunk/Nebulous/t/01_load.t	(revision 16354)
+++ trunk/Nebulous/t/01_load.t	(revision 17073)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 01_load.t,v 1.7 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 01_load.t,v 1.8 2008-03-20 23:21:58 jhoblitt Exp $
 
 use strict;
@@ -10,5 +10,5 @@
 use lib qw( ./t ./lib );
 
-use Test::More tests => 8;
+use Test::More tests => 4;
 
 BEGIN { use_ok( 'Nebulous::Client' ); }
@@ -16,6 +16,2 @@
 BEGIN { use_ok( 'Nebulous::Client::HTTP' ); }
 BEGIN { use_ok( 'Nebulous::Util' ); }
-BEGIN { use_ok( 'Nebulous::Server' ); }
-BEGIN { use_ok( 'Nebulous::Server::SQL' ); }
-BEGIN { use_ok( 'Nebulous::Server::Log' ); }
-BEGIN { use_ok( 'Nebulous::Server::SOAP' ); }
Index: trunk/Nebulous/t/02_server_setup.t
===================================================================
--- trunk/Nebulous/t/02_server_setup.t	(revision 16354)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 02_server_setup.t,v 1.6 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings;
-
-use Test::More tests => 2;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Test::Nebulous;
-
-Test::Nebulous->setup;
-
-isa_ok(
-    Nebulous::Server->new(
-        dsn         => $NEB_DB,
-        dbuser      => $NEB_USER,
-        dbpasswd    => $NEB_PASS,
-    ),
-    "Nebulous::Server"
-);
-
-Test::Nebulous->setup;
-
-eval {
-    Nebulous::Server->new(
-        dsn         => "DBI:mysql:database=foobar:host=localhost",
-        dbuser      => "baz",
-        dbpasswd    =>"boo",
-    );
-};
-like( $@, qr/DBI connect.*? failed/, "bad dsn/user/pass" );
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/03_server_create_object.t
===================================================================
--- trunk/Nebulous/t/03_server_create_object.t	(revision 16354)
+++ 	(revision )
@@ -1,352 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 03_server_create_object.t,v 1.24 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 67;
-
-use lib qw( ./t ./lib );
-
-use File::ExtAttr qw( getfattr );
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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
-    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;
-
-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", 'node03');
-};
-like($@, qr/node03 is not available/, "request volume this is full");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object("neb://node03/foo");
-};
-like($@, qr/node03 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;
-
-eval {
-    $neb->create_object("foo", 99);
-};
-like($@, qr/did not pass the \'is 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/t/04_server_replicate_object.t
===================================================================
--- trunk/Nebulous/t/04_server_replicate_object.t	(revision 16354)
+++ 	(revision )
@@ -1,124 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 04_server_replicate_object.t,v 1.11 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 16;
-
-use lib qw( ./t ./lib );
-
-use File::ExtAttr qw( getfattr );
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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
-    $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;
-
-eval {
-    $neb->replicate_object('foo');
-};
-like($@, qr/is valid object key/, 'storage object does not exist');
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-    $neb->replicate_object('foo', 'bar');
-};
-like($@, qr/is 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/t/05_server_lock_object.t
===================================================================
--- trunk/Nebulous/t/05_server_lock_object.t	(revision 16354)
+++ 	(revision )
@@ -1,127 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 05_server_lock_object.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 13;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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/t/06_server_unlock_object.t
===================================================================
--- trunk/Nebulous/t/06_server_unlock_object.t	(revision 16354)
+++ 	(revision )
@@ -1,142 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 06_server_unlock_object.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 14;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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/t/07_server_find_instances.t
===================================================================
--- trunk/Nebulous/t/07_server_find_instances.t	(revision 16354)
+++ 	(revision )
@@ -1,119 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 07_server_find_instances.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 15;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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
-    my $uri1 = $neb->create_object("foo");
-    my $uri2 = $neb->replicate_object("foo");
-
-    my $locations = $neb->find_instances("foo", "node01");
-
-    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 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/t/08_server_delete_instance.t
===================================================================
--- trunk/Nebulous/t/08_server_delete_instance.t	(revision 16354)
+++ 	(revision )
@@ -1,73 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 08_server_delete_instance.t,v 1.9 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 8;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    my $uri = $neb->create_object("foo");
-
-    ok($neb->delete_instance($uri), "delete instance");
-}
-
-Test::Nebulous->setup;
-
-{
-    my $uri1 = $neb->create_object("foo");
-    my $uri2 = $neb->replicate_object("foo");
-
-    ok($neb->delete_instance($uri1), "delete instance");
-
-    my $locations = $neb->find_instances("foo");
-
-    is($locations->[0], $uri2, "instance remains");
-
-    ok($neb->delete_instance( $uri2 ), "delete instance");
-
-    eval {
-        $neb->find_instances("foo");
-    };
-    like($@, qr/is valid object key/, "storage object was deleted");
-}
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->delete_instance("file:/foo");
-};
-like($@, qr/no instance is associated with uri/, "uri does not exist");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->delete_instance();
-};
-like($@, qr/1 was expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->delete_instance("foo", 2);
-};
-like($@, qr/1 was expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/09_server_stat_object.t
===================================================================
--- trunk/Nebulous/t/09_server_stat_object.t	(revision 16354)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 09_server_stat_object.t,v 1.12 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 12;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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 {
-    $neb->stat_object("foo");
-};
-like($@, qr/is valid object key/, "object does not exist");
-
-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/t/10_server_is_valid_volume_name.t
===================================================================
--- trunk/Nebulous/t/10_server_is_valid_volume_name.t	(revision 16354)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 10_server_is_valid_volume_name.t,v 1.4 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 3;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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('node01'), "valid volume name");
-
-Test::Nebulous->setup;
-
-ok($neb->_is_valid_volume_name('node02'), "valid volume name");
-
-Test::Nebulous->setup;
-
-is($neb->_is_valid_volume_name('node99'), undef, "invalid volume name");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/11_server_is_valid_object_key.t
===================================================================
--- trunk/Nebulous/t/11_server_is_valid_object_key.t	(revision 16354)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 11_server_is_valid_object_key.t,v 1.2 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 2;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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/t/12_server_find_objects.t
===================================================================
--- trunk/Nebulous/t/12_server_find_objects.t	(revision 16354)
+++ 	(revision )
@@ -1,68 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2004-2005  Joshua Hoblitt
-#
-# $Id: 12_server_find_objects.t,v 1.2 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 6;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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
-{
-    # key
-    my $uri = $neb->create_object("foo");
-
-    my $keys = $neb->find_objects();
-
-    is(scalar @$keys, 0, 'number of keys found');
-}
-
-Test::Nebulous->setup;
-
-{
-    # key
-    my $uri = $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
-    my $uri1 = $neb->create_object("foo");
-    my $uri2 = $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;
-
-eval {
-    $neb->find_objects("foo", 3);
-};
-like($@, qr/1 was expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/13_server_rename_object.t
===================================================================
--- trunk/Nebulous/t/13_server_rename_object.t	(revision 16354)
+++ 	(revision )
@@ -1,73 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2007  Joshua Hoblitt
-#
-# $Id: 13_server_rename_object.t,v 1.3 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 6;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-use Test::Nebulous;
-
-my $neb = Nebulous::Server->new(
-    dsn         => $NEB_DB,
-    dbuser      => $NEB_USER,
-    dbpasswd    => $NEB_PASS,
-);
-
-Test::Nebulous->setup;
-
-{
-    my $uri = $neb->create_object("foo");
-
-    $neb->rename_object("foo", "bar");
-
-    my $keys = $neb->find_objects('^foo$');
-    is(scalar @$keys, 0, 'number of keys found');
-    $keys = $neb->find_objects('^bar$');
-    is(scalar @$keys, 1, 'number of keys found');
-}
-
-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::Nebulous->cleanup;
Index: trunk/Nebulous/t/14_server_xattr.t
===================================================================
--- trunk/Nebulous/t/14_server_xattr.t	(revision 16354)
+++ 	(revision )
@@ -1,187 +1,0 @@
-#!/usr/bin/perl
-
-# Copryight (C) 2007  Joshua Hoblitt
-#
-# $Id: 14_server_xattr.t,v 1.3 2008-02-02 01:51:29 jhoblitt Exp $
-
-use strict;
-use warnings FATAL => qw( all );
-
-use Test::More tests => 32;
-
-use lib qw( ./t ./lib );
-
-use Nebulous::Server;
-use Nebulous::Util qw( :standard );
-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', 'bar', 'baz', 'create'), 'set object xattr');
-    {
-        my @xattrs = $neb->listxattr_object('foo');
-        is(scalar @xattrs, 1, 'number of xattrs');
-        is($xattrs[0], 'bar', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'bar');
-    is($value, 'baz', 'xattr value');
-
-    ok($neb->removexattr_object('foo', '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', 'bar', 'baz', 'create'), 'set object xattr');
-    ok($neb->setxattr_object('foo', 'bonk', 'quix', 'create'), 'set object xattr');
-    
-    {
-        my @xattrs = $neb->listxattr_object('foo');
-        is(scalar @xattrs, 2, 'number of xattrs');
-        is($xattrs[0], 'bar', 'xattr name');
-        is($xattrs[1], 'bonk', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'bar');
-    is($value, 'baz', 'xattr value');
-    $value = $neb->getxattr_object('foo', 'bonk');
-    is($value, 'quix', 'xattr value');
-
-    ok($neb->removexattr_object('foo', 'bar'), "remove object xattr");
-    ok($neb->removexattr_object('foo', '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', 'bar', 'baz', 'create'), 'set object xattr');
-    ok($neb->setxattr_object('foo', 'bar', 'quix', 'replace'), 're-set object xattr');
-    
-    {
-        my @xattrs = $neb->listxattr_object('foo');
-        is(scalar @xattrs, 1, 'number of xattrs');
-        is($xattrs[0], 'bar', 'xattr name');
-    }
-
-    my $value = $neb->getxattr_object('foo', 'bar');
-    is($value, 'quix', 'xattr value');
-
-    ok($neb->removexattr_object('foo', '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();
-};
-like($@, qr/4 were expected/, "no params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'bar');
-};
-like($@, qr/4 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'bar', 'baz');
-};
-like($@, qr/4 were expected/, "too few params");
-
-Test::Nebulous->setup;
-
-eval {
-    $neb->create_object('foo');
-
-    $neb->setxattr_object('foo', 'bar', 'baz', 'create', 'quix');
-};
-like($@, qr/4 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");
-
-# getxattr_object
-
-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', 'bar', 'baz');
-};
-like($@, qr/2 were expected/, "too many params");
-
-Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/Test/Nebulous.pm
===================================================================
--- trunk/Nebulous/t/Test/Nebulous.pm	(revision 16354)
+++ 	(revision )
@@ -1,94 +1,0 @@
-# Copyright (C) 2004  Joshua Hoblitt
-#
-# $Id: Nebulous.pm,v 1.17 2008-02-07 22:17:45 jhoblitt Exp $
-
-package Test::Nebulous;
-
-use strict;
-
-our $VERSION = '0.01';
-
-use base qw( Exporter );
-
-use DBI;
-use File::Path qw( mkpath rmtree );
-use File::Temp qw( tempdir );
-use Nebulous::Server::SQL;
-
-our @EXPORT = qw( $NEB_DB $NEB_USER $NEB_PASS );
-
-our $NEB_DB     = $ENV{'NEB_DB'}   || "DBI:mysql:database=test:host=localhost";
-our $NEB_USER   = $ENV{'NEB_USER'} || "test";
-our $NEB_PASS   = $ENV{'NEB_PASS'} || '';
-
-my $dbh = DBI->connect( $NEB_DB, $NEB_USER, $NEB_PASS );
-my $sql = Nebulous::Server::SQL->new;
-
-# suppress uninitalized warnings
-my $dir1 = "";
-my $dir2 = "";
-my $dir3 = "";
-my $dir4 = "";
-my $dir5 = "";
-my $dir6 = "";
-
-sub setup {
-    my $self = shift;
-
-    $self->cleanup;
-
-    # create directories after cleanup
-    $dir1 = tempdir( CLEANUP => 0 );
-    $dir2 = tempdir( CLEANUP => 0 );
-    $dir3 = tempdir( CLEANUP => 0 );
-    $dir4 = tempdir( CLEANUP => 0 );
-    $dir5 = tempdir( CLEANUP => 0 );
-    $dir6 = tempdir( CLEANUP => 0 );
-
-    foreach my $statement (@{ $sql->get_db_schema }) {
-        $dbh->do( $statement );
-    }
-
-    # node01/node02: allocate = TRUE
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (1, 'node01', ?, TRUE, TRUE) }, undef, $dir1);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir1);
-
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (2, 'node02', ?, TRUE, TRUE) }, undef, $dir2);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e8) }, undef, $dir2);
-
-    # node03: allocate = TRUE, volume full
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (3, 'node03', ?, TRUE, TRUE) }, undef, $dir3);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e10) }, undef, $dir3);
-
-    # node04: allocate = FALSE, available = FALSE
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (4, 'node04', ?, FALSE, FALSE) }, undef, $dir4);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir4);
-
-    # node05: allocate = FALSE, available = TRUE
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (5, 'node05', ?, FALSE, TRUE) }, undef, $dir5);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir5);
-
-    # node06: allocate = TRUE, available = FALSE
-    $dbh->do(qq{ INSERT INTO volume (vol_id, name, path, allocate, available) VALUES (6, 'node06', ?, TRUE, FALSE) }, undef, $dir4);
-    $dbh->do(qq{ INSERT INTO mount VALUES (?, 10e10, 10e7) }, undef, $dir6);
-
-    $dbh->do(qq{ call getmountedvol() });
-}
-
-sub cleanup {
-    foreach my $statement (@{ $sql->get_db_clear }) {
-        $dbh->do( $statement );
-    }
-
-    # on the first call to setup the $dir[12] will be ""
-    rmtree([$dir1], 0, 1) if -e $dir1;
-    rmtree([$dir2], 0, 1) if -e $dir2;
-    rmtree([$dir3], 0, 1) if -e $dir3;
-    rmtree([$dir4], 0, 1) if -e $dir4;
-    rmtree([$dir5], 0, 1) if -e $dir5;
-    rmtree([$dir6], 0, 1) if -e $dir6;
-}
-
-1;
-
-__END__
