2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 51; |
use Test::More tests => 75; |
6 |
use Test::Exception; |
use Test::Exception; |
7 |
use File::Temp qw/ :mktemp /; |
use File::Temp qw/ :mktemp /; |
8 |
use blib; |
use blib; |
101 |
|
|
102 |
ok(my $result = $results->NextResult, "get result"); |
ok(my $result = $results->NextResult, "get result"); |
103 |
|
|
104 |
cmp_ok($result->Property('swishdocpath'), '==', $path, "correct swishdocpath") if ($path); |
SKIP: { |
105 |
cmp_ok($result->Property('swishdocsize'), '==', $size, "correct swishdocsize") if (defined($size)); |
skip "no results found, skipping property test", 3 unless ($result); |
106 |
cmp_ok($result->Property($prop), '==', $val, "correct data") if (defined($prop) && defined($val)); |
|
107 |
|
cmp_ok($result->Property('swishdocpath'), '==', $path, "correct swishdocpath") if ($path); |
108 |
|
cmp_ok($result->Property('swishdocsize'), '==', $size, "correct swishdocsize") if (defined($size)); |
109 |
|
cmp_ok($result->Property($prop), '==', $val, "correct data") if (defined($prop) && defined($val)); |
110 |
|
} |
111 |
} |
} |
112 |
|
|
113 |
swish_search($test_index, "foo=(bar)", 1, "testpath", length($xml), "foo", "bar"); |
swish_search($test_index, "foo=(bar)", 1, "testpath", length($xml), "foo", "bar"); |
116 |
|
|
117 |
# now, test slice handling |
# now, test slice handling |
118 |
|
|
119 |
ok(my $slice = $i->create_slice('testpath'), "create_slice"); |
ok($s = $i->create_slice('testpath'), "create_slice $s"); |
120 |
|
|
121 |
ok($i->put_slice('testpath', $xml), "put_slice"); |
ok($s = $i->put_slice('testpath', $xml), "put_slice $s"); |
122 |
|
|
123 |
ok($i->close_slice($slice), "close_slice"); |
ok($i->close_slice($s), "close_slice $s"); |
124 |
|
|
125 |
swish_search($param{'index'}."/$slice", "foo=(bar)", 1, "testpath", length($xml)+1, "foo", "bar"); |
swish_search($param{'index'}."/$s", "foo=(bar)", 1, "testpath", length($xml)+1, "foo", "bar"); |
126 |
|
|
127 |
diag "slice handling o.k."; |
diag "slice $s handling o.k."; |
128 |
|
|
129 |
ok($i->add('testpath',{ foo => 'bar' }),"add foo"); |
my %slice_files; |
130 |
|
ok($s = $i->add('testpath',{ foo => 'bar' }),"add foo [slice $s]"); |
131 |
|
$slice_files{$s}++; |
132 |
|
|
133 |
foreach (1..$param{'slices'} * 3) { |
foreach (1..$param{'slices'} * 10) { |
134 |
ok($i->add('testpath'.$_,{ 'foo' => 'bar'.$_ }), "add $_"); |
ok($s = $i->add('testpath'.$_,{ 'foo' => sprintf("bar%04d", $_) }), "add $_ [slice $s]"); |
135 |
|
$slice_files{$s}++; |
136 |
} |
} |
137 |
|
|
138 |
cmp_ok($i->done, '==', 3, "finish"); |
cmp_ok($i->done, '==', 3, "finish"); |
139 |
|
|
140 |
|
foreach (1..$param{'slices'}) { |
141 |
|
swish_search( $param{'index'}."/$_", "foo=(bar*)", $slice_files{$_}, "testpath", length($xml)+4, "foo", "bar"); |
142 |
|
} |
143 |
|
|
144 |
#diag "$out"; |
#diag "$out"; |