1 |
williamc |
1.1 |
#
|
2 |
|
|
# ActiveDoc test suite
|
3 |
|
|
#
|
4 |
|
|
|
5 |
|
|
package ActiveDoc::test::test_ActiveDoc;
|
6 |
|
|
use ActiveDoc::ActiveDoc;
|
7 |
williamc |
1.2 |
use ActiveDoc::ActiveStore;
|
8 |
|
|
use Utilities::TestClass;
|
9 |
|
|
use ObjectUtilities::ObjectStore;
|
10 |
|
|
use URL::URLcache;
|
11 |
|
|
require 5.004;
|
12 |
williamc |
1.1 |
|
13 |
williamc |
1.2 |
@ISA = ("Utilities::TestClass"); #methods both from the test class
|
14 |
williamc |
1.1 |
|
15 |
|
|
sub init {
|
16 |
|
|
my $self=shift;
|
17 |
|
|
$self->{testfile}=$self->datadir()."/ActiveDocTest";
|
18 |
williamc |
1.2 |
$self->{verifyfile}=$self->datadir()."/ActiveDocTest-verify";
|
19 |
williamc |
1.1 |
$self->{configarea}=$self->temparea()."/ActiveDoc";
|
20 |
williamc |
1.2 |
$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 |
williamc |
1.1 |
}
|
25 |
|
|
|
26 |
|
|
sub test {
|
27 |
|
|
my $self=shift;
|
28 |
|
|
$self->{expectedstring}="";
|
29 |
|
|
|
30 |
|
|
$self->newtest("Initiation test");
|
31 |
williamc |
1.2 |
$self->newobject($self->{Ostore});
|
32 |
|
|
$self->testinterface("verbosity",1);
|
33 |
|
|
|
34 |
williamc |
1.1 |
$self->newtest("url test");
|
35 |
|
|
$self->testinterface("url","file:".$self->{testfile});
|
36 |
williamc |
1.2 |
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 |
williamc |
1.1 |
$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 |
|
|
}
|