New
authorMike Taylor <mike@indexdata.com>
Tue, 17 Oct 2006 16:20:00 +0000 (16:20 +0000)
committerMike Taylor <mike@indexdata.com>
Tue, 17 Oct 2006 16:20:00 +0000 (16:20 +0000)
lib/ZOOM/IRSpy/Test/Search/DBDate.pm [new file with mode: 0644]

diff --git a/lib/ZOOM/IRSpy/Test/Search/DBDate.pm b/lib/ZOOM/IRSpy/Test/Search/DBDate.pm
new file mode 100644 (file)
index 0000000..9005e47
--- /dev/null
@@ -0,0 +1,56 @@
+# $Id: DBDate.pm,v 1.1 2006-10-17 16:20:00 mike Exp $
+
+# This plugin tests searching on BIB-1 access-point 1011 (Date/time
+# added to db), the significance of which is that this search
+# "succeeds" on some of our test databases
+# (e.g. bagel.indexdata.com:210/marc) and fails on others
+# (e.g. z3950.loc.gov:7090/Voyager gives error 114 "Unsupported Use
+# attribute").  This allows us to test IRSpy's differing behaviour
+# when a test succeeds or fails.
+
+package ZOOM::IRSpy::Test::Search::DBDate;
+
+use 5.008;
+use strict;
+use warnings;
+
+use ZOOM::IRSpy::Test;
+our @ISA = qw(ZOOM::IRSpy::Test);
+
+
+sub start {
+    my $class = shift();
+    my($conn) = @_;
+
+    $conn->irspy_search_pqf('@attr 1=1011 mineral', undef,
+                           ZOOM::Event::RECV_SEARCH, \&found,
+                           "exception", \&error);
+}
+
+
+sub found {
+    my($conn, $task, $__UNUSED_udata, $event) = @_;
+
+    my $n = $task->{rs}->size();
+    $conn->log("irspy_test",
+              "DB-date search found $n record", $n==1 ? "" : "s");
+    my $rec = $conn->record();
+    $rec->append_entry("irspy:status", "<irspy:search_dbdate ok='1'>" .
+                      isodate(time()) . "</irspy:search_dbdate>");
+
+    return ZOOM::IRSpy::Status::TASK_DONE;
+}
+
+
+sub error {
+    my($conn, $task, $__UNUSED_udata, $exception) = @_;
+
+    $conn->log("irspy_test", "DB-date search had error: $exception");
+    my $rec = $conn->record();
+    $rec->append_entry("irspy:status", "<irspy:search_dbdate ok='0'>" .
+                      isodate(time()) . "</irspy:search_dbdate>");
+    return ZOOM::IRSpy::Status::TEST_BAD;
+}
+
+
+1;