/[Search-Estraier]/trunk/t/5_Node.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

Annotation of /trunk/t/5_Node.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 41 - (hide annotations)
Thu Jan 5 23:32:31 2006 UTC (18 years, 1 month ago) by dpavlin
File MIME type: application/x-troff
File size: 1544 byte(s)
out_doc, out_doc_by_uri
1 dpavlin 28 #!/usr/bin/perl -w
2    
3     use strict;
4     use blib;
5    
6 dpavlin 41 use Test::More tests => 34;
7 dpavlin 28 use Test::Exception;
8     use Data::Dumper;
9    
10     BEGIN { use_ok('Search::Estraier') };
11    
12 dpavlin 41 my $debug = 0;
13 dpavlin 40
14 dpavlin 35 # name of node for test
15     my $test_node = 'Search-Estraier';
16    
17 dpavlin 40 ok(my $node = new Search::Estraier::Node($debug), 'new');
18 dpavlin 28 isa_ok($node, 'Search::Estraier::Node');
19    
20 dpavlin 40 ok($node->set_url('http://localhost:1978/node/searchestraier'), 'set_url');
21 dpavlin 29
22 dpavlin 38 ok($node->set_proxy('', 8080), 'set_proxy');
23 dpavlin 30 throws_ok {$node->set_proxy('proxy.example.com', 'foo') } qr/port/, 'set_proxy port NaN';
24    
25     ok($node->set_timeout(42), 'set_timeout');
26     throws_ok {$node->set_timeout('foo') } qr/timeout/, 'set_timeout NaN';
27 dpavlin 31
28 dpavlin 39 ok($node->set_auth('admin','admin'), 'set_auth');
29 dpavlin 32
30     cmp_ok($node->status, '==', -1, 'status');
31 dpavlin 35
32 dpavlin 38 my @res = ( -1, 200 );
33    
34 dpavlin 35 my $nodelist;
35 dpavlin 39 foreach my $url (qw{?action=nodelist http://localhost:1978/master?action=nodelist}) {
36 dpavlin 37 cmp_ok(
37     $node->shuttle_url( $url, 'text/plain', undef, \$nodelist)
38 dpavlin 38 ,'==', shift @res, 'nodelist');
39 dpavlin 37 }
40 dpavlin 35
41     my $draft = <<'_END_OF_DRAFT_';
42     @uri=data001
43     @title=Material Girl
44    
45     Living in a material world
46     And I am a material girl
47     You know that we are living in a material world
48     And I am a material girl
49     _END_OF_DRAFT_
50    
51 dpavlin 40 #diag "draft:\n$draft";
52     ok(my $doc = new Search::Estraier::Document($draft), 'new doc from draft');
53    
54 dpavlin 41 for ( 1 .. 10 ) {
55     $doc->add_attr('@uri', 'test' . $_);
56     ok( $node->put_doc($doc), "put_doc test$_");
57     #diag $doc->dump_draft;
58     }
59    
60     ok( $node->out_doc( 0 ), 'out_doc');
61    
62     for ( 1 .. 10 ) {
63     ok( $node->out_doc_by_uri( 'test' .$_ ), "out_doc_by_uri test$_");
64     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26