1 |
williamc |
1.1 |
#
|
2 |
|
|
# Tool test suite
|
3 |
|
|
#
|
4 |
|
|
|
5 |
|
|
package Configuration::test::test_ConfigArea;
|
6 |
|
|
require 5.001;
|
7 |
|
|
use Configuration::ConfigureStore;
|
8 |
|
|
use Configuration::ConfigArea;
|
9 |
|
|
use ActiveDoc::ActiveConfig;
|
10 |
|
|
use ActiveDoc::Application;
|
11 |
|
|
|
12 |
|
|
@ISA = ("ActiveDoc::DocTester"); #methods both from the test class
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
sub init {
|
16 |
|
|
my $self=shift;
|
17 |
|
|
$self->initdoc();
|
18 |
|
|
$self->{testfile}=$self->datadir("")."/ConfigAreaDoc";
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
sub test {
|
22 |
|
|
my $self=shift;
|
23 |
|
|
$self->newtest("Initiation test - file not existing");
|
24 |
|
|
$self->newdoc("file:".$self->{testfile});
|
25 |
|
|
$self->newtest("setup");
|
26 |
|
|
$self->testinterface("setup");
|
27 |
williamc |
1.4 |
$self->_areatest();
|
28 |
|
|
my $areadir=$self->testinterface("location");
|
29 |
|
|
$self->verifydir($areadir);
|
30 |
|
|
|
31 |
williamc |
1.3 |
$self->newtest("simple persistence testing");
|
32 |
|
|
$location=$self->temparea("")."/".$self->newfilename();
|
33 |
|
|
$self->testinterface("store", $location);
|
34 |
williamc |
1.2 |
undef $self->{object};
|
35 |
williamc |
1.4 |
$self->_restoreit($location);
|
36 |
|
|
|
37 |
|
|
my $area2=$self->temparea("")."/".$self->newfilename();
|
38 |
|
|
undef $self->{object};
|
39 |
|
|
rename($areadir,$area2);
|
40 |
|
|
$self->newtest("Can we Move ConfigArea?");
|
41 |
|
|
$self->newobject($self->docstore());
|
42 |
|
|
$self->testinterface("bootstrapfromlocation",$area2);
|
43 |
|
|
$self->expect($area2);
|
44 |
|
|
$self->testinterface("location");
|
45 |
|
|
$self->clearexpect();
|
46 |
|
|
$self->_areatest();
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
sub _areatest {
|
50 |
|
|
my $self=shift;
|
51 |
|
|
$self->expect("testname");
|
52 |
|
|
$self->testinterface("name");
|
53 |
|
|
$self->clearexpect();
|
54 |
|
|
$self->expect("version1");
|
55 |
|
|
$self->testinterface("version");
|
56 |
|
|
$self->clearexpect();
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
sub _restoreit {
|
61 |
|
|
my $self=shift;
|
62 |
|
|
my $location=shift;
|
63 |
|
|
|
64 |
williamc |
1.3 |
$self->newobject($self->docstore());
|
65 |
williamc |
1.1 |
$self->testinterface("restore",$location);
|
66 |
williamc |
1.4 |
|
67 |
|
|
# make sure the config items are restored OK
|
68 |
|
|
my @cfitems=$self->testinterface("configitem");
|
69 |
|
|
if ( $cfitems[0]->name() ne "ConfigItemTest") {
|
70 |
|
|
$self->testfail("FAILED: got ".$cfitems[0]->name()." expecting "
|
71 |
|
|
."ConfigItemTest");
|
72 |
|
|
}
|
73 |
|
|
else {
|
74 |
|
|
$self->testpass("Configuration Items Name restored OK");
|
75 |
|
|
}
|
76 |
williamc |
1.1 |
}
|
77 |
williamc |
1.4 |
|
78 |
|
|
|