Scan feature added, not documented yet
[idzebra-moved-to-github.git] / perl / t / 02_directory_update.t
1 #!perl
2 # =============================================================================
3 # $Id: 02_directory_update.t,v 1.2 2003-03-04 19:33:53 pop Exp $
4 #
5 # Perl API header
6 # =============================================================================
7 BEGIN {
8     if ($ENV{PERL_CORE}) {
9         chdir 't' if -d 't';
10     }
11     push (@INC,'demo','blib/lib','blib/arch');
12 }
13
14 use strict;
15 use warnings;
16
17 use Test::More tests => 9;
18
19 # ----------------------------------------------------------------------------
20 # Session opening and closing
21 BEGIN {
22     use_ok('IDZebra');
23     IDZebra::logFile("test.log");
24     use_ok('IDZebra::Session'); 
25     use_ok('pod');
26 }
27
28
29 # ----------------------------------------------------------------------------
30 # Session opening and closing
31 my $sess = IDZebra::Session->open(configFile => 'demo/zebra.cfg',
32                                   groupName => 'demo2');
33 isa_ok($sess,"IDZebra::Session");
34
35 SKIP: {
36     skip "Takes a while", 5 if (0);
37
38 # ----------------------------------------------------------------------------
39 # init repository
40 $sess->init();
41
42 # ----------------------------------------------------------------------------
43 # repository upadte
44
45 our $filecount = 8;
46 $sess->begin_trans;
47 $sess->update(path      =>  'lib');
48 my $stat = $sess->end_trans;
49
50 ok(($stat->{inserted} == $filecount), 
51    "Inserted $stat->{inserted}/$filecount records");
52
53 $sess->begin_trans;
54 $sess->update(groupName => 'demo1',
55               path      =>  'lib');
56
57 $stat = $sess->end_trans;
58 ok(($stat->{inserted} == $filecount), 
59    "Inserted $stat->{inserted}/$filecount records");
60
61 $sess->begin_trans;
62 $sess->delete(groupName => 'demo1',
63               path      =>  'lib');
64 $stat = $sess->end_trans;
65 ok(($stat->{deleted} == $filecount), 
66    "Deleted $stat->{deleted}/$filecount records");
67
68 $sess->begin_trans;
69 $sess->update(groupName => 'demo1',
70               path      =>  'lib');
71
72 $stat = $sess->end_trans;
73 ok(($stat->{inserted} == $filecount), 
74    "Inserted $stat->{inserted}/$filecount records");
75
76 ok(($sess->group->{databaseName} eq "demo2"),"Original group is selected");
77
78 # ----------------------------------------------------------------------------
79 # Close session
80 }
81 $sess->close;