Resolve
authorMike Taylor <mike@indexdata.com>
Wed, 19 Dec 2012 10:04:25 +0000 (10:04 +0000)
committerMike Taylor <mike@indexdata.com>
Wed, 19 Dec 2012 10:04:25 +0000 (10:04 +0000)
Changes
README
lib/ZOOM/IRSpy/Test/Record/Fetch.pm
lib/ZOOM/IRSpy/Test/Record/OPAC.pm

diff --git a/Changes b/Changes
index 27a870e..dc1415c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -22,6 +22,8 @@ Revision history for Perl extension ZOOM::IRSpy.
          dozen elements.
        - New script bin/irspy-xpath.pl -- a simple wrapper for
          running an XPath with IRSpy-related namespaces established.
+       - Record::Fetch test registers a fail when the syntax actually
+         retrieved does not match that requested. Fixes bug IR-324.
        - Add new test, Record::PiggyBack, with support for viewing,
          editing and storing results. Fixes bug IR-333.
        - IDs used in URLs for full-record links are properly
diff --git a/README b/README
index 8020b8d..93d10aa 100644 (file)
--- a/README
+++ b/README
@@ -18,7 +18,7 @@ package store, using apt-get:
 
 sudo apt-get install \
        libnet-z3950-zoom-perl \
-       libxml-libxml-common-perl \
+       libxml-libxml-perl \
        liburi-perl \
        libxml-libxml-perl \
        libapache2-mod-perl2 \
index 5e62a96..f12d137 100644 (file)
@@ -121,13 +121,18 @@ sub record {
                   defined $record ? $record->exception() :
                                     $conn->exception());
     } else {
-       $ok = 1;
-       my $text = $record->render();
-       $conn->log("irspy_test", "Successfully retrieved a $syn record");
-       if (0) {
-           print STDERR "Hits: ", $rs->size(), "\n";
-           print STDERR "Syntax: ", $syn, "\n";
-           print STDERR $text;
+       my $actual = $record->get("syntax");
+       if (lc($actual) ne lc($syn)) {
+           $conn->log("irspy_test", "requested $syn record, but got $actual");
+       } else {
+           $ok = 1;
+           my $text = $record->render();
+           $conn->log("irspy_test", "Successfully retrieved a $syn record ($actual)");
+           if (0) {
+               print STDERR "Hits: ", $rs->size(), "\n";
+               print STDERR "Syntax: ", $syn, "\n";
+               print STDERR $text;
+           }
        }
     }
 
index 4045201..caca4ce 100644 (file)
@@ -75,8 +75,16 @@ sub completed_search {
     # We have a result-set of three of more records, and we requested
     # that those records be included in the Search Response using
     # piggybacking.  Was it done?
+    my $ok = 0;
     my $rec = $task->{rs}->record_immediate(2);
-    my $ok = defined $rec && $rec->error() == 0;
+    if (defined $rec) {
+       my $syntax = $rec->get("syntax");
+       if (lc($syntax) ne "opac") {
+           $conn->log("irspy_test", "requested OPAC record, but got $syntax");
+       } else {
+           $ok = $rec->error() == 0;
+       }
+    }
 
     $task->{rs}->destroy();
     $conn->record()->store_result('multiple_opac', 'ok' => $ok);