From: mike Date: Mon, 29 Sep 2008 15:49:13 +0000 (+0000) Subject: Fix to work with new test server. X-Git-Tag: CPAN_1_26~34 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=a55e279a325eed559eda782f35e9417188fdb07b;p=ZOOM-Perl-moved-to-github.git Fix to work with new test server. --- diff --git a/t/16-packages.t b/t/16-packages.t index 76d5b33..5f3e3f7 100644 --- a/t/16-packages.t +++ b/t/16-packages.t @@ -1,4 +1,4 @@ -# $Id: 16-packages.t,v 1.13 2008-09-26 14:41:34 mike Exp $ +# $Id: 16-packages.t,v 1.14 2008-09-29 15:49:13 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 16-packages.t' @@ -14,7 +14,7 @@ use strict; use warnings; -use Test::More tests => 40; +use Test::More tests => 39; BEGIN { use_ok('Net::Z3950::ZOOM') }; @@ -41,32 +41,32 @@ makedb($conn, $dbname, 223); Net::Z3950::ZOOM::connection_destroy($conn); $conn = makeconn($host, "admin", "fish", 0); Net::Z3950::ZOOM::connection_option_set($conn, databaseName => $dbname); -count_hits($conn, "the", 109); +count_hits($conn, $dbname, "the", 109); # Now create the database and check that it is present but empty makedb($conn, $dbname, 0); -count_hits($conn, "the", 0, 0); +count_hits($conn, $dbname, "the", 114); # Trying to create the same database again will fail EEXIST makedb($conn, $dbname, 224); # Add a single record, and check that it can be found updaterec($conn, 1, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 1); +count_hits($conn, $dbname, "the", 0, 1); # Add the same record with the same ID: overwrite => no change updaterec($conn, 1, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 1); +count_hits($conn, $dbname, "the", 0, 1); # Add it again record with different ID => new copy added updaterec($conn, 2, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 2); +count_hits($conn, $dbname, "the", 0, 2); # Now drop the newly-created database dropdb($conn, $dbname, 0); # A second dropping should fail, as the database is no longer there. -dropdb($conn, $dbname, 10004); +dropdb($conn, $dbname, 235); sub makeconn { @@ -167,7 +167,7 @@ sub updaterec { sub count_hits { - my($conn, $query, $expected_error, $expected_count) = @_; + my($conn, $dbname, $query, $expected_error, $expected_count) = @_; my $rs = Net::Z3950::ZOOM::connection_search_pqf($conn, $query); my($errcode, $errmsg, $addinfo) = (undef, "dummy", "dummy"); diff --git a/t/26-packages.t b/t/26-packages.t index 7624e68..318225c 100644 --- a/t/26-packages.t +++ b/t/26-packages.t @@ -1,17 +1,17 @@ -# $Id: 26-packages.t,v 1.8 2006-06-07 09:58:56 mike Exp $ +# $Id: 26-packages.t,v 1.9 2008-09-29 15:49:18 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 26-packages.t' use strict; use warnings; -use Test::More tests => 40; +use Test::More tests => 39; BEGIN { use_ok('ZOOM') }; # We will create, and destroy, a new database with a random name -my $host = "test.indexdata.com:2118"; +my $host = "z3950.indexdata.com:2100"; my $dbname = join("", map { chr(ord("a") + int(rand(26))) } 1..10); # Connect anonymously, and expect this to fail @@ -32,32 +32,32 @@ makedb($conn, $dbname, 223); $conn->destroy(); $conn = makeconn($host, "admin", "fish", 0); $conn->option(databaseName => $dbname); -count_hits($conn, "the", 109); +count_hits($conn, $dbname, "the", 109); # Now create the database and check that it is present but empty makedb($conn, $dbname, 0); -count_hits($conn, "the", 0, 0); +count_hits($conn, $dbname, "the", 114); # Trying to create the same database again will fail EEXIST makedb($conn, $dbname, 224); # Add a single record, and check that it can be found updaterec($conn, 1, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 1); +count_hits($conn, $dbname, "the", 0, 1); # Add the same record with the same ID: overwrite => no change updaterec($conn, 1, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 1); +count_hits($conn, $dbname, "the", 0, 1); # Add it again record with different ID => new copy added updaterec($conn, 2, content_of("samples/records/esdd0006.grs"), 0); -count_hits($conn, "the", 0, 2); +count_hits($conn, $dbname, "the", 0, 2); # Now drop the newly-created database dropdb($conn, $dbname, 0); # A second dropping should fail, as the database is no longer there. -dropdb($conn, $dbname, 10004); +dropdb($conn, $dbname, 235); sub makeconn { @@ -151,7 +151,7 @@ sub updaterec { sub count_hits { - my($conn, $query, $expected_error, $expected_count) = @_; + my($conn, $dbname, $query, $expected_error, $expected_count) = @_; my $rs; eval { $rs = $conn->search_pqf($query) };