Updated documentation, ERADME, scanning, sorting and filter virtual file handles...
[idzebra-moved-to-github.git] / perl / t / 02_directory_update.t
1 #!perl
2 # =============================================================================
3 # $Id: 02_directory_update.t,v 1.3 2003-03-05 13:55:22 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 # repository upadte
43
44 our $filecount = 8;
45 $sess->begin_trans;
46 $sess->update(path      =>  'lib');
47 my $stat = $sess->end_trans;
48
49 ok(($stat->{inserted} == $filecount), 
50    "Inserted $stat->{inserted}/$filecount records");
51
52 $sess->begin_trans;
53 $sess->update(groupName => 'demo1',
54               path      =>  'lib');
55
56 $stat = $sess->end_trans;
57 ok(($stat->{inserted} == $filecount), 
58    "Inserted $stat->{inserted}/$filecount records");
59
60 $sess->begin_trans;
61 $sess->delete(groupName => 'demo1',
62               path      =>  'lib');
63 $stat = $sess->end_trans;
64 ok(($stat->{deleted} == $filecount), 
65    "Deleted $stat->{deleted}/$filecount records");
66
67 $sess->begin_trans;
68 $sess->update(groupName => 'demo1',
69               path      =>  'lib');
70
71 $stat = $sess->end_trans;
72 ok(($stat->{inserted} == $filecount), 
73    "Inserted $stat->{inserted}/$filecount records with shadow");
74
75 ok(($sess->group->{databaseName} eq "demo2"),"Original group is selected");
76
77 # ----------------------------------------------------------------------------
78 # Close session
79 }
80 $sess->close;