4f6048157bbb972b16dc809157c262036d7495c7
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Bib1.pm
1 # $Id: Bib1.pm,v 1.9 2006-10-13 10:03:31 sondberg Exp $
2
3 # See the "Main" test package for documentation
4
5 package ZOOM::IRSpy::Test::Search::Bib1;
6
7 use 5.008;
8 use strict;
9 use warnings;
10
11 use Data::Dumper;
12 use ZOOM::IRSpy::Test;
13 our @ISA = qw(ZOOM::IRSpy::Test);
14
15
16 sub start {
17     my $class = shift();
18     my($conn) = @_;
19
20     my @attrs = (1,             # personal name
21                  4,             # title
22                  52,            # subject
23                  1003,          # author
24                  1016,          # any
25                  );
26     foreach my $attr (@attrs) {
27         $conn->irspy_search_pqf("\@attr 1=$attr mineral",
28                                 {'attr' => $attr},
29                                 ZOOM::Event::RECV_SEARCH, \&found,
30                                 exception => \&error);
31     }
32 }
33
34
35 sub found {
36     my($conn, $task, $test_args, $event) = @_;
37     my $attr = $test_args->{'attr'};
38     my $n = $task->{rs}->size();
39
40     $conn->log("irspy_test", "search on access-point $attr found $n record",
41                $n==1 ? "" : "s");
42     $conn->record()->append_entry("irspy:status",
43                                   "<irspy:search set='bib1' ap='$attr' ok='1'>".
44                                   isodate(time()) .
45                                   "</irspy:search>");
46
47     return ZOOM::IRSpy::Status::TASK_DONE;
48 }
49
50
51 sub error {
52     my($conn, $task, $test_args, $exception) = @_;
53     my $attr = $test_args->{'attr'};
54
55     $conn->log("irspy_test", "search on access-point $attr had error: ",
56                $exception);
57     $conn->record()->append_entry("irspy:status",
58                                   "<irspy:search set='bib1' ap='$attr' ok='0'>".
59                                   isodate(time()) .
60                                   "</irspy:search>");
61     return ZOOM::IRSpy::Status::TASK_DONE;
62 }
63
64
65 1;