/[webpac2]/trunk/t/7-est.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/7-est.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 458 - (show annotations)
Wed May 10 14:08:15 2006 UTC (17 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1453 byte(s)
 r575@llin:  dpavlin | 2006-05-10 16:10:56 +0200
 use Search::Estraier 0.06 new master API to create nodes, so code here is siplified

1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use Test::More tests => 10;
6 use Test::Exception;
7 use Cwd qw/abs_path/;
8 use File::Temp qw/tempdir/;
9 use Data::Dumper;
10 use blib;
11
12 BEGIN {
13 use_ok( 'WebPAC::Output::Estraier' );
14 use_ok( 'WebPAC::Search::Estraier' );
15 use_ok( 'Log::Log4perl' );
16 }
17
18 Log::Log4perl::init('./conf/log.conf');
19 ok(my $log = Log::Log4perl->get_logger('WebPAC.test'), "get_logger");
20
21 my $config = {
22 masterurl => 'http://localhost:1978/',
23 user => 'admin',
24 passwd => 'admin',
25 database => 'webpac2test',
26 encoding => 'iso-8859-2',
27 log => $log,
28 debug => 0,
29 };
30
31 ok(my $est = new WebPAC::Output::Estraier( %{ $config } ), "new WebPAC::Output::Estraier");
32
33 my $ds = {
34 'Source' => {
35 'name' => 'Izvor: ',
36 'tag' => 'Source',
37 'display' => [ 'foo' ],
38 'search' => [ 'demo source '],
39 },
40 'ID' => {
41 'name' => 'ID',
42 'tag' => 'IDths',
43 'search' => [ 'bar' ],
44 'lookup_key' => [ 'bar' ],
45 },
46 'filename' => [ 'out/thes/001.html' ],
47 'name' => 'filename',
48 'tag' => 'filename'
49 };
50
51 ok($est->add( id => 42, ds => $ds, type => 'search' ), "add");
52
53 ok(my $est_s = new WebPAC::Search::Estraier( %{ $config } ), "new WebPAC::Search::Estraier");
54
55 my $query = 'demo';
56 my $max = 1;
57
58 ok(my @res = $est_s->search(
59 phrase => $query,
60 get_attr => [ qw/ID Source/ ],
61 max => $max,
62 ), "search $query, max: $max");
63
64 cmp_ok(($#res + 1), '==', $max, "$max hits");
65
66 diag Dumper(\@res);
67
68 ok($est->master( action => 'nodedel', name => 'webpac2test' ), "nodedel");
69

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26