86f5aecab2ed7412bcdb4b0dbf31e63aab7355eb
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Title.pm
1 # $Id: Title.pm,v 1.10 2007-02-23 15:03:44 mike Exp $
2
3 # See the "Main" test package for documentation
4
5 package ZOOM::IRSpy::Test::Search::Title;
6
7 use 5.008;
8 use strict;
9 use warnings;
10
11 use ZOOM::IRSpy::Test;
12 our @ISA = qw(ZOOM::IRSpy::Test);
13
14 use ZOOM::IRSpy::Utils qw(isodate);
15
16
17 sub start {
18     my $class = shift();
19     my($conn) = @_;
20
21     $conn->irspy_search_pqf('@attr 1=4 mineral', undef, {},
22                             ZOOM::Event::ZEND, \&found,
23                             "exception", \&error);
24 }
25
26
27 sub found {
28     my($conn, $task, $__UNUSED_udata, $event) = @_;
29
30     my $n = $task->{rs}->size();
31     $conn->log("irspy_test",
32                "title search found $n record", $n==1 ? "" : "s");
33     my $rec = $conn->record();
34     $rec->append_entry("irspy:status", "<irspy:search_title ok='1'>" .
35                        isodate(time()) . "</irspy:search_title>");
36
37     return ZOOM::IRSpy::Status::TASK_DONE;
38 }
39
40
41 sub error {
42     my($conn, $task, $__UNUSED_udata, $exception) = @_;
43
44     $conn->log("irspy_test", "title search had error: $exception");
45     my $rec = $conn->record();
46     $rec->append_entry("irspy:status", "<irspy:search_title ok='0'>" .
47                        isodate(time()) . "</irspy:search_title>");
48     return ZOOM::IRSpy::Status::TEST_BAD;
49 }
50
51
52 1;