ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Configuration/test/test_ConfigArea.pm
Revision: 1.7
Committed: Mon Aug 28 08:35:14 2000 UTC (24 years, 8 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: v102p1, V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V0_18_2, V0_18_1
Branch point for: V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B
Changes since 1.6: +101 -50 lines
Log Message:
remove Interface.pm

File Contents

# User Rev Content
1 williamc 1.1 #
2     # Tool test suite
3     #
4    
5     package Configuration::test::test_ConfigArea;
6     require 5.001;
7     use Configuration::ConfigArea;
8    
9 williamc 1.7 @ISA = ("Utilities::TestClass"); #methods both from the test class
10 williamc 1.1
11    
12     sub init {
13     my $self=shift;
14 williamc 1.7 $self->{arealoc}=$self->temparea("")."/ConfigArea";
15 williamc 1.1 }
16    
17     sub test {
18     my $self=shift;
19     $self->newtest("Initiation test - file not existing");
20 williamc 1.7 $self->newobject();
21    
22     $self->newtest("name and version setting");
23     $self->{name}="testproject";
24     $self->{version}="testversion";
25     $self->testinterface("name",$self->{name});
26     $self->testinterface("version",$self->{version});
27 williamc 1.4 $self->_areatest();
28 williamc 1.7
29     $self->newtest("setup test");
30     $self->testinterface("setup",$self->{arealoc});
31     my $area=$self->{arealoc}."/".$self->{name}."_".$self->{version};
32     $self->_teststructure($area);
33    
34     $self->newtest("location method test");
35     $self->expect($area);
36     $self->testinterface("location");
37     $self->clearexpect();
38    
39     $self->newtest("setting requirementsdoc test");
40     $self->expect($area."/reqdoc");
41     $self->testinterface("requirementsdoc","reqdoc");
42     $self->clearexpect();
43     $self->testinterface("save");
44 williamc 1.4
45 williamc 1.3 $self->newtest("simple persistence testing");
46 williamc 1.2 undef $self->{object};
47 williamc 1.7 $self->newobject();
48     $self->testinterface("verbosity",1);
49     $self->testinterface("bootstrapfromlocation",$area);
50     $self->expect($area);
51     my $location=$self->testinterface("location");
52     $self->clearexpect();
53     $self->_areatest();
54     $self->_testlink();
55     $self->expect($area."/reqdoc");
56     $self->testinterface("requirementsdoc");
57     $self->clearexpect();
58    
59     $self->newtest("setup test - specify dir name");
60     $self->testinterface("setup",$self->{arealoc},"fred");
61     my $area2=$self->{arealoc}."/fred";
62     $self->_teststructure($area2);
63 williamc 1.4
64     $self->newtest("Can we Move ConfigArea?");
65 williamc 1.7 $self->newobject();
66     my $area3=$self->{arealoc}."/copy".$self->{name}."_".$self->{version};
67     rename($area,$area3);
68     $self->testinterface("bootstrapfromlocation",$area3);
69     $self->expect($area3);
70 williamc 1.4 $self->testinterface("location");
71     $self->clearexpect();
72     $self->_areatest();
73 williamc 1.7 $self->_teststructure($area3);
74    
75     $self->newtest("Area linking Test");
76     $self->testinterface("linkto", $area2);
77     $self->testinterface("save");
78     $self->_testlink($area2);
79     $self->newobject();
80     $self->testinterface("bootstrapfromlocation",$area3);
81     $self->_areatest();
82     $self->_testlink($area2);
83    
84     $self->newtest("Area unlinking Test");
85     $self->testinterface("unlinkarea");
86     $self->_testlink("");
87     $self->newobject();
88     $self->testinterface("bootstrapfromlocation",$area3);
89     $self->_testlink();
90 williamc 1.6
91     $self->newtest("Make a satelite area");
92 williamc 1.7 my $satarea=$self->{arealoc}."/sat";
93     $self->testinterface("satellite",$self->{arealoc},"sat");
94     $self->_teststructure($satarea);
95     $self->newobject();
96     $self->testinterface("bootstrapfromlocation",$satarea);
97     $self->_testlink($area3);
98 williamc 1.6
99 williamc 1.4 }
100    
101 williamc 1.7
102 williamc 1.4 sub _areatest {
103     my $self=shift;
104 williamc 1.7 $self->expect($self->{name});
105     $self->testinterface("name");
106     $self->clearexpect();
107     $self->expect($self->{version});
108     $self->testinterface("version");
109     $self->clearexpect();
110 williamc 1.4 }
111    
112 williamc 1.7 sub _teststructure {
113 williamc 1.4 my $self=shift;
114 williamc 1.7 my $areadir=shift;
115     my $workdir=$areadir."/".$self->{object}->{admindir};
116 williamc 1.4
117 williamc 1.7 $self->verifydir($areadir);
118     $self->verifydir($workdir);
119     $self->verifydir($workdir."/".$self->{object}->{cachedir});
120     $self->verifyexists($workdir."/Environment");
121     }
122 williamc 1.4
123 williamc 1.7 sub _testlink {
124     my $self=shift;
125     my $areadir=shift;
126     my $ret=$self->testinterface("linkarea");
127     if ( (! defined $areadir) || ($areadir eq "" ) ) {
128     if ( ! defined $ret ) {
129     $self->testpass("No area linked as expected");
130     }
131     else {
132     $self->testfail("area returned when none expected - link failed");
133     }
134 williamc 1.4 }
135     else {
136 williamc 1.7 if ( (! defined $ret ) || ($ret->location() ne $areadir)) {
137     $self->testfail("wrong area returned - link failed");
138     }
139     else {
140     $self->testpass("area linked OK ($areadir)");
141     }
142 williamc 1.4 }
143 williamc 1.1 }