Index: trunk/Nebulous/t/62_client_delete_instance.t
===================================================================
--- trunk/Nebulous/t/62_client_delete_instance.t	(revision 22716)
+++ trunk/Nebulous/t/62_client_delete_instance.t	(revision 23934)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 62_client_delete_instance.t,v 1.3 2008-12-14 22:48:35 eugene Exp $
+# $Id: 62_client_delete_instance.t,v 1.1.38.1 2008-12-14 22:03:08 eugene Exp $
 
 use strict;
@@ -10,5 +10,5 @@
 use Apache::Test qw( -withtestmore );
 
-plan tests => 9;
+plan tests => 11;
 
 use lib qw( ./t ./lib );
@@ -26,9 +26,11 @@
         proxy => "http://$hostport/nebulous",
     );
-    $neb->create( "foo" );
 
-    my $locations = $neb->find_instances( "foo" );
+    my $key = "foo";
+    $neb->create($key);
 
-    my $uri = $neb->delete_instance( @$locations[0] );
+    my $locations = $neb->find_instances($key);
+
+    my $uri = $neb->delete_instance($key, @$locations[0]);
 
     is( $uri, @$locations[0], "delete instance" );
@@ -43,10 +45,11 @@
         proxy => "http://$hostport/nebulous",
     );
-    $neb->create( "foo" );
-    $neb->replicate( "foo" );
+    my $key = "foo";
+    $neb->create($key);
+    $neb->replicate($key);
 
     my $uri1 = $neb->find_instances( "foo" )->[0];
 
-    ok( $neb->delete_instance( $uri1 ), "delete instance" );
+    ok( $neb->delete_instance($key, $uri1), "delete instance" );
 
     my $uri2 = $neb->find_instances( "foo" )->[0];
@@ -54,10 +57,12 @@
     isnt( $uri1, $uri2, "other instance remains" );
 
-    ok( $neb->delete_instance( $uri2 ), "delete instance" );
+    ok( $neb->delete_instance($key, $uri2), "delete instance" );
 
     my $locations = $neb->find_instances( "foo" );
 
-    is( $locations, undef, "no remaning instances" );
+    is( $locations, undef, "no remaining instances" );
 }
+
+Test::Nebulous->setup;
 
 {
@@ -65,5 +70,7 @@
         proxy => "http://$hostport/nebulous",
     );
-    my $uri = $neb->delete_instance( "file:/foo" );
+    my $key = "foo";
+    $neb->create($key);
+    my $uri = $neb->delete_instance($key, "file:/foo" );
 
     is( $uri, undef, "uri does not exist" );
@@ -76,7 +83,7 @@
         proxy => "http://$hostport/nebulous",
     );
-    $neb->delete_instance();
+    my $uri = $neb->delete_instance("foo", "file:/foo" );
 };
-like( $@, qr/1 was expected/, "no params" );
+like( $@, qr/is valid object key/, "bad object key" );
 
 Test::Nebulous->setup;
@@ -86,7 +93,27 @@
         proxy => "http://$hostport/nebulous",
     );
-    $neb->delete_instance( "foo", 2 );
+    my $uri = $neb->delete_instance("foo");
 };
-like( $@, qr/1 was expected/, "too many params" );
+like( $@, qr/2 were expected/, "missing second param" );
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->delete_instance();
+};
+like( $@, qr/2 were expected/, "no params" );
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+    $neb->delete_instance("foo", 2, 3);
+};
+like( $@, qr/2 were expected/, "too many params" );
 
 Test::Nebulous->cleanup;
Index: trunk/Nebulous/t/70_neb-ls.t
===================================================================
--- trunk/Nebulous/t/70_neb-ls.t	(revision 23934)
+++ trunk/Nebulous/t/70_neb-ls.t	(revision 23934)
@@ -0,0 +1,206 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2009  Joshua Hoblitt
+
+=head1 NAME
+
+t/70_neb-ls.t - tests neb-ls
+
+=head1 SYNOPSIS
+    
+    prove t/70_neb-ls.t
+
+=cut
+
+use strict;
+use warnings;
+
+use Apache::Test qw( -withtestmore );
+plan tests => 31;
+
+use lib qw( ./lib ./t );
+
+use Test::Cmd;
+use Nebulous::Client;
+use Test::Nebulous;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+my $neb_url  = "http://$hostport/nebulous";
+
+
+my $cmd = 'bin/neb-ls';
+
+# last ditch effort to make sure dsget is executable
+chmod 0755, 'bin/neb-ls';
+
+my $test = Test::Cmd->new(prog => $cmd, workdir => '');
+isa_ok($test, 'Test::Cmd');
+
+# NEB_SERVER env var not set
+Test::Nebulous->setup;
+
+{
+    $test->run(args => '');
+    missing_args(2, "Required options: --server");
+}
+
+# NEB_SERVER set
+Test::Nebulous->setup;
+
+{
+    $ENV{NEB_SERVER} = $neb_url;
+
+    $test->run(args => '');
+    is($? >> 8, 0, "exit code");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo$/,      "stdout");
+    like($test->stderr, qr/^$/,         "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo bar$/,  "stdout");
+    like($test->stderr, qr/^$/,         "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '-l');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('foo');
+    $neb->create('bar');
+
+    $test->run(args => '-1');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr/^foo\nbar\n$/,   "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+
+    $test->run(args => '');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr||,               "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('a/bar');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo a/bar$|,  "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => $neb_url,
+    );
+    $neb->create('a/foo');
+    $neb->create('a/b/foo');
+
+    $test->run(args => 'a');
+
+    is($? >> 8, 0, "exit code");
+    like($test->stdout, qr|^a/foo$|,        "stdout");
+    like($test->stderr, qr/^$/,             "stderr");
+}
+
+Test::Nebulous->cleanup;
+
+sub missing_args
+{
+    my ($exit, $errstr) = @_;
+
+    is($? >> 8, $exit, "error code is: $exit");
+    like($test->stderr, qr/$errstr/, "error string is: $errstr");
+}
Index: trunk/Nebulous/t/conf/startup.pl.in
===================================================================
--- trunk/Nebulous/t/conf/startup.pl.in	(revision 22716)
+++ trunk/Nebulous/t/conf/startup.pl.in	(revision 23934)
@@ -12,11 +12,25 @@
 use Test::Nebulous;
 
+#$Apache::DBI::DEBUG = 1;
 Apache::DBI->connect_on_init( $NEB_DB, $NEB_USER, $NEB_PASS );
-Nebulous::Server::SOAP->new_on_init(
+Apache::DBI->setPingTimeOut($NEB_DB, 10);
+
+my $config = Nebulous::Server::Config->new(
+    trace       => 'all',
+);
+$config->add_db(
+    dbindex     => 0,
     dsn         => $NEB_DB,
     dbuser      => $NEB_USER,
     dbpasswd    => $NEB_PASS,
-    log_level   => 'all',
 );
+#$config->add_db(
+#    dbindex     => 1,
+#    dsn         => 'DBI:mysql:database=nebulous1:host=localhost',
+#    dbuser      => $dbuser,
+#    dbpasswd    => $dbpasswd,
+#);
+
+Nebulous::Server::SOAP->new_on_init($config);
 
 1;
