Using store_result method to update zebra.
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Test / Search / Dan1.pm
1 # $Id: Dan1.pm,v 1.2 2006-10-23 12:23:29 sondberg Exp $
2
3 # See the "Main" test package for documentation
4
5 package ZOOM::IRSpy::Test::Search::Dan1;
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
15 sub start {
16     my $class = shift();
17     my($conn) = @_;
18     my @attrs = ( 1..27            # Dan-1
19                 );
20
21     foreach my $attr (@attrs) {
22         $conn->irspy_search_pqf("\@attr dan1 1=$attr mineral",
23                                 {'attr' => $attr},
24                                 ZOOM::Event::RECV_SEARCH, \&found,
25                                 exception => \&error);
26     }
27 }
28
29
30 sub found {
31     my($conn, $task, $test_args, $event) = @_;
32     my $attr = $test_args->{'attr'};
33     my $n = $task->{rs}->size();
34
35     $conn->log("irspy_test", "search on access-point $attr found $n record",
36                $n==1 ? "" : "s");
37     $conn->record()->store_result('search', 'set'       => 'dan1',
38                                             'ap'        => $attr,
39                                             'ok'        => 1);
40
41     return ZOOM::IRSpy::Status::TASK_DONE;
42 }
43
44
45 sub error {
46     my($conn, $task, $test_args, $exception) = @_;
47     my $attr = $test_args->{'attr'};
48
49     $conn->log("irspy_test", "search on access-point $attr had error: ",
50                $exception);
51     $conn->record()->store_result('search', 'set'       => 'dan1',
52                                             'ap'        => $attr,
53                                             'ok'        => 0);
54
55     return ZOOM::IRSpy::Status::TASK_DONE;
56 }
57
58
59 1;