1 # $Id: Named.pm,v 1.1 2006-11-02 11:46:40 sondberg Exp $
3 # See the "Main" test package for documentation
5 package ZOOM::IRSpy::Test::ResultSet::Named;
11 use ZOOM::IRSpy::Test;
12 our @ISA = qw(ZOOM::IRSpy::Test);
19 $conn->log('irspy_test', 'Testing for named resultset support');
21 $conn->irspy_search_pqf("\@attr 1=4 mineral", {},
22 {'setname' => 'a', 'start' => 0, 'count' => 0},
23 ZOOM::Event::RECV_SEARCH, \&completed_search_a,
24 exception => \&error);
28 sub completed_search_a {
29 my ($conn, $task, $test_args, $event) = @_;
32 my $hits = $rs->size();
34 ## How should be handle the situation when there is 0 hits?
36 $record = $rs->record(0)->raw();
39 $conn->irspy_search_pqf("\@attr 1=4 4ds9da94",
40 {'record_a' => $record, 'hits_a' => $hits,
43 ZOOM::Event::RECV_SEARCH, \&completed_search_b,
44 exception => \&error);
46 return ZOOM::IRSpy::Status::TASK_DONE;
50 sub completed_search_b {
51 my($conn, $task, $test_args, $event) = @_;
52 my $rs = $test_args->{rs_a};
58 if ($test_args->{'hits_a'} > 0) {
59 my $hits = $rs->size();
60 my $record = $rs->record(0)->raw();
62 if ($hits != $test_args->{'hits_a'}) {
63 $conn->log('irspy_test', 'Named result set not supported: ',
64 'Mis-matching hit counts');
68 if ($record ne $test_args->{'record_a'}) {
69 $conn->log('irspy_test', 'Named result set not supported: ',
70 'Mis-matching records');
75 update($conn, $error eq '' ? 1 : 0, $error);
77 return ZOOM::IRSpy::Status::TASK_DONE;
82 my($conn, $task, $test_args, $exception) = @_;
84 $conn->log("irspy_test", "Named resultset check failed:", $exception);
85 return ZOOM::IRSpy::Status::TASK_DONE;
90 my ($conn, $ok, $error) = @_;
91 my %args = ('ok' => $ok);
94 $args{'error'} = $error;
97 $conn->record()->store_result('named_resultset', %args);