Getting ready to test available record formats.
authorAnders S. Mortensen <sondberg@indexdata.dk>
Mon, 23 Oct 2006 13:54:52 +0000 (13:54 +0000)
committerAnders S. Mortensen <sondberg@indexdata.dk>
Mon, 23 Oct 2006 13:54:52 +0000 (13:54 +0000)
lib/ZOOM/IRSpy/Test/Main.pm
lib/ZOOM/IRSpy/Test/Record/Fetch.pm [new file with mode: 0644]
lib/ZOOM/IRSpy/Test/Record/Main.pm [new file with mode: 0644]

index 5df65b8..7a01951 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Main.pm,v 1.9 2006-10-12 16:54:13 mike Exp $
+# $Id: Main.pm,v 1.10 2006-10-23 13:54:52 sondberg Exp $
 
 package ZOOM::IRSpy::Test::Main;
 
 
 package ZOOM::IRSpy::Test::Main;
 
@@ -24,7 +24,7 @@ I<## To follow>
 
 =cut
 
 
 =cut
 
-sub subtests { qw(Ping Search::Main) }
+sub subtests { qw(Ping Search::Main Record::Main) }
 
 sub start {
     my $class = shift();
 
 sub start {
     my $class = shift();
diff --git a/lib/ZOOM/IRSpy/Test/Record/Fetch.pm b/lib/ZOOM/IRSpy/Test/Record/Fetch.pm
new file mode 100644 (file)
index 0000000..ee29f08
--- /dev/null
@@ -0,0 +1,84 @@
+# $Id: Fetch.pm,v 1.1 2006-10-23 13:54:52 sondberg Exp $
+
+# See the "Main" test package for documentation
+
+package ZOOM::IRSpy::Test::Record::Fetch;
+
+use 5.008;
+use strict;
+use warnings;
+
+use ZOOM::IRSpy::Test;
+our @ISA = qw(ZOOM::IRSpy::Test);
+
+
+sub start {
+    print STDERR "Got here\n";
+    exit 1;
+    my $class = shift();
+    my($conn) = @_;
+    my @syntax = ( 'canmarc',
+                   'danmarc',
+                   'grs-1',
+                   'ibermarc',
+                   'intermarc',
+                   'jpmarc',
+                   'librismarc',
+                   'mab',
+                   'normarc',
+                   'opac',
+                   'picamarc',
+                   'rusmarc',
+                   'summary',
+                   'sutrs',
+                   'swemarc'
+                   'ukmarc',
+                   'unimarc',
+                   'usmarc',
+                   'xml',
+                );
+
+    foreach my $syn (@syntax) {
+        $conn->option('preferredRecordSyntax' => $syn);
+        $conn->option('start'   => 0);
+        $conn->option('count'   => 1);
+
+        ## Here I want to get a use attribute from the session, which we've
+        ## managed to search for in the Search/Bib1 or Search/Dan1 tests. But
+        ## how? So far we search for title: 1=4
+       $conn->irspy_search_pqf("\@attr 1=4 mineral",
+                                {'syntax' => $syn},
+                                ZOOM::Event::RECV_RECORD, \&record,
+                               exception => \&error);
+    }
+}
+
+
+sub record {
+    my($conn, $task, $test_args, $event) = @_;
+    my $syn = $test_args->{'syn'};
+
+    $conn->log("irspy_test", "search on access-point $attr found $n record",
+              $n==1 ? "" : "s");
+    $conn->record()->store_result('record_fetch',
+                                  'syntax'   => $syn,
+                                  'ok'       => 1);
+
+    return ZOOM::IRSpy::Status::TASK_DONE;
+}
+
+
+sub error {
+    my($conn, $task, $test_args, $exception) = @_;
+    my $syn = $test_args->{'syn'};
+
+    $conn->log("irspy_test", "search on access-point $attr had error: ",
+              $exception);
+    $conn->record()->store_result('record_fetch',
+                                  'syntax'       => $syn,
+                                  'ok'        => 0);
+    return ZOOM::IRSpy::Status::TASK_DONE;
+}
+
+
+1;
diff --git a/lib/ZOOM/IRSpy/Test/Record/Main.pm b/lib/ZOOM/IRSpy/Test/Record/Main.pm
new file mode 100644 (file)
index 0000000..67bd259
--- /dev/null
@@ -0,0 +1,56 @@
+# $Id: Main.pm,v 1.1 2006-10-23 13:54:52 sondberg Exp $
+
+package ZOOM::IRSpy::Test::Record::Main;
+
+use 5.008;
+use strict;
+use warnings;
+
+use ZOOM::IRSpy::Test;
+our @ISA = qw(ZOOM::IRSpy::Test);
+
+
+=head1 NAME
+
+ZOOM::IRSpy::Test::Main - a single test for IRSpy
+
+=head1 SYNOPSIS
+
+ ## To follow
+
+=head1 DESCRIPTION
+
+I<## To follow>
+
+=cut
+
+sub subtests { qw(Record::Fetch) }
+
+sub start {
+    my $class = shift();
+    my($conn) = @_;
+
+    $conn->log("irspy_test", "Main test no-opping");
+    # Do nothing -- this test is just a subtest container
+}
+
+
+=head1 SEE ALSO
+
+ZOOM::IRSpy
+
+=head1 AUTHOR
+
+Mike Taylor, E<lt>mike@indexdata.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006 by Index Data ApS.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.7 or,
+at your option, any later version of Perl 5 you may have available.
+
+=cut
+
+1;