source: trunk/soft/ObsData/t/OR-03.t @ 168

Last change on this file since 168 was 168, checked in by thauvin, 18 years ago
  • use ObsData::Event to manage event
  • Property cvs2svn:cvs-rev set to 1.11
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mime-type set to text/x-troff
File size: 1.7 KB
Line 
1# $Id$
2
3use strict;
4use warnings;
5
6use Test::More tests => 14;
7use File::Temp qw(tempdir);
8
9use_ok('ObsData');
10use_ok('ObsData::Repository');
11
12my $o = ObsData->new('testdata/obsdata-conftest', logfile => "testdata/obsdata.log");
13
14{
15    my $or = ObsData::Repository::dir->new(
16        {
17            obsdata => $o,
18            dir => 'testdata/ohp',
19        }
20    );
21
22    isa_ok($or, "ObsData::Repository::dir");
23    ok($or->logging(0, "FOO%s", "FOO") eq "FOOFOO", "logging return the message properly");
24    ok($or->findfile, "can find file");
25}
26
27{
28    my $callbackwhy;
29    my $or = ObsData::Repository::dir::archive->new(
30        {
31            obsdata => $o,
32            dir => 'testdata/ohp',
33            archivefile => 'ozone34.gz',
34            interative_callback => sub {
35                my ($self, $event) = @_;
36                $callbackwhy = $event->id;
37                if ($callbackwhy eq 'overwrite') {
38                    return 1;
39                } else {
40                    return $self->default_choice($event);
41                }
42            },
43        }
44    );
45    isa_ok($or, "ObsData::Repository::dir::archive");
46    ok($or->load_archive, "Can load an archive");
47
48    # ini status checks
49    $or->setvalue('FOO', 'FOO');
50    $or->set_data_value('ozone34', 'BAR', 'BAR');
51    ok($or->getvalue('FOO') eq 'FOO', "can get a value");
52    ok($or->get_data_value('ozone34', 'BAR') eq 'BAR', "can get a value");
53
54    ok($or->do_continue('overwrite', 'a', 'a') eq 1, "Perform do_continue");
55    ok($callbackwhy eq 'overwrite', "arg are properly passed to callback");
56    ok($or->list_archive, "Can list archive content");
57    ok($or->get_data_dest('ozone34'), "Can get data destination");
58    ok($or->extract_data('ozone34', undef, '/dev/null'), "Can extract data");
59}
60
Note: See TracBrowser for help on using the repository browser.