1 |
#
|
2 |
# ActiveDoc test suite
|
3 |
#
|
4 |
|
5 |
package ActiveDoc::test::test_ActiveDoc;
|
6 |
use ActiveDoc::ActiveDoc;
|
7 |
use ActiveDoc::ActiveStore;
|
8 |
use Utilities::TestClass;
|
9 |
use ObjectUtilities::ObjectStore;
|
10 |
use URL::URLcache;
|
11 |
require 5.004;
|
12 |
|
13 |
@ISA = ("Utilities::TestClass"); #methods both from the test class
|
14 |
|
15 |
sub init {
|
16 |
my $self=shift;
|
17 |
$self->{testfile}=$self->datadir()."/ActiveDocTest";
|
18 |
$self->{verifyfile}=$self->datadir()."/ActiveDocTest-verify";
|
19 |
$self->{configarea}=$self->temparea()."/ActiveDoc";
|
20 |
$self->{Ostore}=ActiveDoc::ActiveStore->new($self->{configarea});
|
21 |
# $self->{db}=ObjectUtilities::ObjectStore->new(
|
22 |
# $self->{configarea}."/db");
|
23 |
# $self->{cache}=URL::URLcache->new($self->{configarea}."/cache");
|
24 |
}
|
25 |
|
26 |
sub test {
|
27 |
my $self=shift;
|
28 |
$self->{expectedstring}="";
|
29 |
|
30 |
$self->newtest("Initiation test");
|
31 |
$self->newobject($self->{Ostore});
|
32 |
$self->testinterface("verbosity",1);
|
33 |
|
34 |
$self->newtest("url test");
|
35 |
$self->testinterface("url","file:".$self->{testfile});
|
36 |
my $file=$self->testinterface("ProcessFile");
|
37 |
$self->verify($self->{verifyfile},$file);
|
38 |
$self->newtest("url called twice");
|
39 |
$self->testinterface("url","file:".$self->{testfile});
|
40 |
|
41 |
$self->newtest("direct use of getfile");
|
42 |
$file=$self->testinterface("getfile","file:".$self->{testfile});
|
43 |
|
44 |
$self->newtest("line matching");
|
45 |
my ($line,$fileobj)=$self->testinterface(line,10);
|
46 |
$self->cmpstring("2",$line);
|
47 |
$self->cmpstring("cvs://cmscvs.cern.ch/cvs_server/repositories/SCRAM?auth=pserver&module=test/testinclude2&passkey=AA_:yZZ3e&user=anonymous",$fileobj->url());
|
48 |
|
49 |
$self->newtest("activatedoc test");
|
50 |
$self->testinterface("activatedoc","file:".$self->{testfile});
|
51 |
}
|
52 |
|
53 |
sub printout {
|
54 |
my $self=shift; # This self not necessarily that of the rest of obj!
|
55 |
my $name=shift;
|
56 |
my $string=shift;
|
57 |
|
58 |
print " ++++++++++++++++++++ Printing ++++++++++++++++++++ ";
|
59 |
print $string;
|
60 |
if ( $self->{expectedstring} ne "" ) {
|
61 |
if ( $string=~/$self->{expectedstring}/ ) {
|
62 |
TestClass->testpass("Test Passed");
|
63 |
}
|
64 |
else {
|
65 |
TestClass->testfail("Expecting $self->{expectedstring}, got $string");
|
66 |
}
|
67 |
}
|
68 |
}
|