1 # $Id: Fetch.pm,v 1.10 2006-10-26 18:22:41 sondberg Exp $
3 # See the "Main" test package for documentation
5 package ZOOM::IRSpy::Test::Record::Fetch;
11 use ZOOM::IRSpy::Test;
12 our @ISA = qw(ZOOM::IRSpy::Test);
19 # Here I want to get a use attribute from the session, which we've
20 # managed to search for in the Search/Bib1 or Search/Dan1 tests.
21 # But how? So far we search for title: 1=4
22 $conn->irspy_search_pqf("\@attr 1=4 mineral", {}, {},
23 ZOOM::Event::RECV_SEARCH, \&completed_search,
24 exception => \&error);
28 sub completed_search {
29 my($conn, $task, $udata, $event) = @_;
31 $conn->log("irspy_test", "Fetch test search succeeded");
53 #@syntax = qw(grs-1 sutrs usmarc xml); # simplify for debugging
54 foreach my $syntax (@syntax) {
55 $conn->irspy_rs_record($task->{rs}, 0,
56 { syntax => $syntax },
57 { start => 0, count => 1,
58 preferredRecordSyntax => $syntax },
59 ZOOM::Event::RECV_RECORD, \&record,
60 exception => \&error);
63 return ZOOM::IRSpy::Status::TASK_DONE;
68 my($conn, $task, $test_args, $event) = @_;
69 my $syn = $test_args->{'syntax'};
72 $conn->log("irspy_test", "Successfully retrieved a $syn record");
74 print STDERR "Hits: ", $rs->size(), "\n";
75 print STDERR "Syntax: ", $syn, "\n";
76 my $record = _fetch_record($rs, 0, $syn);
77 print STDERR $record->render();
80 $conn->record()->store_result('record_fetch',
84 return ZOOM::IRSpy::Status::TASK_DONE;
89 my($rs, $index0, $syntax) = @_;
91 my $oldSyntax = $rs->option(preferredRecordSyntax => $syntax);
92 my $record = $rs->record(0);
93 $oldSyntax = "" if !defined $oldSyntax;
94 $rs->option(preferredRecordSyntax => $oldSyntax);
101 my($conn, $task, $test_args, $exception) = @_;
102 my $syn = $test_args->{'syntax'};
104 $conn->log("irspy_test", "Retrieval of $syn record failed: ", $exception);
105 $conn->record()->store_result('record_fetch',
108 return ZOOM::IRSpy::Status::TASK_DONE;