remove stale $Id$
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Dan1.pm
1
2 # See the "Main" test package for documentation
3
4 package ZOOM::IRSpy::Test::Search::Dan1;
5
6 use 5.008;
7 use strict;
8 use warnings;
9
10 use ZOOM::IRSpy::Test;
11 our @ISA = qw(ZOOM::IRSpy::Test);
12
13
14 sub start {
15     my $class = shift();
16     my($conn) = @_;
17     my @attrs = ( 1..27            # Dan-1
18                 );
19
20     foreach my $attr (@attrs) {
21         $conn->irspy_search_pqf("\@attr dan1 1=$attr mineral",
22                                 {'attr' => $attr}, {},
23                                 ZOOM::Event::ZEND, \&found,
24                                 exception => \&error);
25     }
26 }
27
28
29 sub found {
30     my($conn, $task, $test_args, $event) = @_;
31     my $attr = $test_args->{'attr'};
32
33     my $n = $task->{rs}->size();
34     $task->{rs}->destroy();
35     $conn->log("irspy_test", "search on access-point $attr found $n record",
36                $n==1 ? "" : "s");
37     update($conn, $attr, 1);
38
39     return ZOOM::IRSpy::Status::TASK_DONE;
40 }
41
42
43 sub error {
44     my($conn, $task, $test_args, $exception) = @_;
45     my $attr = $test_args->{'attr'};
46
47     $task->{rs}->destroy();
48     $conn->log("irspy_test", "search on access-point $attr had error: ",
49                $exception);
50     update($conn, $attr, 0);
51
52     ### How about TEST_BAD if $exception->code() == 121?
53     return ZOOM::IRSpy::Status::TASK_DONE;
54 }
55
56
57 sub update {
58     my ($conn, $attr, $ok) = @_;
59
60     $conn->record()->store_result('search', 'set'       => 'dan-1',
61                                             'ap'        => $attr,
62                                             'ok'        => $ok);
63 }
64
65
66
67
68 1;