Browse Source

Added uri_gen tests for scanners.
Doc cleenup.

Bosko Devetak 4 years ago
parent
commit
32c7e270c2
2 changed files with 25 additions and 54 deletions
  1. 1 53
      lib/HBase/JSONRest/Scanner.pm
  2. 24 1
      t/uri_gen.t

+ 1 - 53
lib/HBase/JSONRest/Scanner.pm

@ -137,7 +137,7 @@ sub _scan_raw {
137 137
    my $hbase = $self->{hbase};
138 138
    $hbase->{last_error} = undef;
139 139
140
    my $scan_uri = $self->_build_scan_uri($params);
140
    my $scan_uri = _build_scan_uri($params);
141 141
142 142
    my $rows = $hbase->_get_tiny($scan_uri);
143 143
@ -145,7 +145,6 @@ sub _scan_raw {
145 145
}
146 146
147 147
sub _build_scan_uri {
148
    my $self   = shift;
149 148
    my $params = shift;
150 149
151 150
    #
@ -269,55 +268,4 @@ Gets the next batch of records
269 268
        ...
270 269
    }
271 270
272
=head1 VERSION
273
274
Current version: 0.030
275
276
=head1 AUTHOR
277
278
bdevetak - Bosko Devetak (cpan:BDEVETAK) <bosko.devetak@gmail.com>
279
280
=head1 CONTRIBUTORS
281
282
theMage, C<<  <cpan:NEVES> >>, <mailto:themage@magick-source.net>
283
284
Sawyer X, C<< <xsawyerx at cpan.org> >>
285
286
Eric Herman, C<< <eherman at cpan.org> >>
287
288
Robert Nilsson, <rn@orbstation.com>
289
290
=head1 COPYRIGHT
291
292
Copyright (c) 2014 the HBase::JSONRest L</AUTHOR> and L</CONTRIBUTORS>
293
as listed above.
294
295
=head1 LICENSE
296
297
This library is free software and may be distributed under the same terms
298
as perl itself. See L<http://dev.perl.org/licenses/>.
299
300
=head1 DISCLAIMER OF WARRANTY
301
302
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
303
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
304
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
305
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
306
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
307
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
308
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
309
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
310
NECESSARY SERVICING, REPAIR, OR CORRECTION.
311
312
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
313
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
314
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
315
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
316
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
317
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
318
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
319
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
320
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
321
SUCH DAMAGES.
322
323 271
=cut

+ 24 - 1
t/uri_gen.t

@ -2,7 +2,7 @@
2 2
use strict;
3 3
use warnings;
4 4
5
use Test::More tests => 8;
5
use Test::More tests => 10;
6 6
7 7
use HBase::JSONRest;
8 8
use HBase::JSONRest::Scanner;
@ -141,3 +141,26 @@ ok(
141 141
    q|Test multiget with versions|
142 142
);
143 143
144
# 9. scan: prefix
145
ok(
146
    HBase::JSONRest::Scanner::_build_scan_uri({
147
        'rowprefix' => '12345;2014-12-19;15',
148
        'limit' => 1,
149
        'table' => 'my_namespace:my_table'
150
    }) eq q|/my_namespace%3Amy_table/12345%3B2014-12-19%3B15*?limit=1&batchsize=10|
151
    ,
152
    q|Test prefix scan|
153
);
154
155
# 10. scan: start row
156
ok(
157
    HBase::JSONRest::Scanner::_build_scan_uri({
158
        'limit' => 1000,
159
        'startrow' => '12345;2014-12-19;15;100587301;0;83547926;0;0',
160
        'table' => 'my_namespace:my_table',
161
        'batchsize' => 50,
162
    }) eq q|/my_namespace%3Amy_table/*?startrow=12345%3B2014-12-19%3B15%3B100587301%3B0%3B83547926%3B0%3B0&limit=1000&batchsize=50|
163
    ,
164
    q|Test startrow scan|
165
);
166