ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/test/test_URLcache.pm
Revision: 1.3.2.1
Committed: Fri Aug 4 09:14:56 2000 UTC (24 years, 9 months ago) by williamc
Content type: text/plain
Branch: HPWbranch
CVS Tags: BuildSystemProto1, V0_18_0, V0_18_0model, V0_17_1, V0_18_0alpha, V0_17_0, V0_16_4, V0_16_3, V0_16_2, V0_16_1, V0_16_0, V0_15_1, V0_15_0, V0_15_0beta, V0_14_0
Branch point for: V0_17branch, V0_16branch, V0_15branch
Changes since 1.3: +0 -0 lines
Log Message:
add from dev

File Contents

# Content
1 #
2 # URLcache test suite
3 #
4
5 package URL::test::test_URLcache;
6 use URL::URLcache;
7 require 5.001;
8 @ISA = ("Utilities::TestClass"); #methods both from the test class
9
10 sub test {
11 my $self=shift;
12
13 # test 1
14 $self->newtest("New Object");
15 $self->newobject($self->temparea()."/cacheindex");
16 $self->newtest("Request filename when empty");
17 $filename=$self->testinterface("filename", "url-nonexistant");
18 print "returned $filename\n";
19 $self->newtest("Store some urls");
20 $self->testinterface("store", "url1", "file1");
21 $self->testinterface("store", "url2", "file2");
22 $self->testinterface("store", "url3", "file3");
23
24 $self->newtest("filestore test");
25 $self->expect($self->temparea()."/cacheindex/files");
26 $self->testinterface("filestore");
27 $self->clearexpect();
28 $self->{myfilestore}=$self->testinterface("filestore");;
29
30 $self->newtest("Close Down and Restore");
31 # kill off the old object and attempt a restore
32 undef $self->{object};
33 $self->newobject($self->temparea()."/cacheindex");
34 $self->datacheck();
35
36 # Test the filename function
37 $self->newtest("test filename(url) interface");
38 $self->expect($self->{myfilestore}."/file1");
39 $self->testinterface("filename", "url1");
40 $self->clearexpect();
41 my $temp=$self->testinterface("filename", "url-random");
42 $self->testinterface("store", "url-random", $temp);
43 $self->expect($temp);
44 $temp=$self->testinterface("filename", "url-random");
45 $self->clearexpect();
46
47 # Test the update function
48 $self->newtest("test sequence number change on updates");
49 $self->expect(1);
50 $self->testinterface("updatenumber", "url1");
51 $self->clearexpect();
52 $numb=$self->testinterface("store", "url1", "file1");
53 $self->expect($numb+1);
54 $self->testinterface("updatenumber", "url1");
55 $self->clearexpect();
56 }
57
58 sub datacheck {
59 my $self=shift;
60 $self->newtest("Get a URL");
61 $self->expect($self->{myfilestore}."/file2");
62 print $self->{myfilestore}."/file2";
63 $self->testinterface("file","url2");
64 $self->clearexpect();
65 }