Related to IR-365 ("Investigate, possibly remove "skipped records" in IRSpy toroid")
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Record / Fetch.pm
index af0b529..c8a8fbd 100644 (file)
@@ -17,31 +17,41 @@ my @queries = (
               "\@attr 1=4 computer",
               "\@attr 1=44 mineral", # Smithsonian doesn't support AP 4!
               "\@attr 1=1016 water", # Connector Framework only does 1016
+              "\@attr 1=1016 \@attr 2=103 x", # Find all records
               ### We can add more queries here
               );
 
+# Certain fetch attempts cause the connection to be lost (e.g. the
+# decoding of OPAC records fails for the National Library of
+# Education, Denmark (grundtvig.dpu.dk:2100/S), after which all
+# subsequent fetches fail -- see bug #3548.  To amerliorate the
+# consequences of this, we check the record syntaxes in order of
+# importance and likelihood of not causing the connection to be
+# dropped.  Of course, for well-behaved servers, this makes no
+# difference at all.
+
+#@syntax = qw(grs-1 sutrs usmarc xml); # simplify for debugging
 my @syntax = (
+              'usmarc',
               'canmarc',
               'danmarc',
-              'grs-1',
               'ibermarc',
               'intermarc',
               'jpmarc',
               'librismarc',
               'mab',
               'normarc',
-              'opac',
               'picamarc',
               'rusmarc',
-              'summary',
-              'sutrs',
               'swemarc',
               'ukmarc',
               'unimarc',
-              'usmarc',
-              'xml'
+              'sutrs',
+              'xml',
+              'grs-1',
+              'summary',
+              'opac',
            );
-#@syntax = qw(grs-1 sutrs usmarc xml); # simplify for debugging
 
 
 sub start {
@@ -112,13 +122,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;
+           }
        }
     }