line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Cmis::Test::Folder; |
2
|
1
|
|
|
1
|
|
629
|
use base qw(WebService::Cmis::Test); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
597
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
|
|
|
|
|
|
use warnings; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Test::More; |
8
|
|
|
|
|
|
|
use Error qw(:try); |
9
|
|
|
|
|
|
|
use WebService::Cmis qw(:collections :utils :relations :namespaces :contenttypes); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub test_Folder_getChildrenLink : Test { |
12
|
|
|
|
|
|
|
my $this = shift; |
13
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
14
|
|
|
|
|
|
|
my $root = $repo->getRootFolder(); |
15
|
|
|
|
|
|
|
my $childrenLink = $root->getChildrenLink(); |
16
|
|
|
|
|
|
|
note("childrenLink=$childrenLink"); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $href = $this->{config}{url}; |
19
|
|
|
|
|
|
|
$href =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
20
|
|
|
|
|
|
|
$childrenLink =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
like($childrenLink, qr"^$href"); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub test_Folder_getChildren : Tests { |
26
|
|
|
|
|
|
|
my $this = shift; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
29
|
|
|
|
|
|
|
my $root = $repo->getRootFolder(); |
30
|
|
|
|
|
|
|
my $children = $root->getChildren(); |
31
|
|
|
|
|
|
|
note("children=$children"); |
32
|
|
|
|
|
|
|
while(my $obj = $children->getNext) { |
33
|
|
|
|
|
|
|
note($obj->getPath ."(".$obj->getTypeId.")"); |
34
|
|
|
|
|
|
|
isa_ok($obj, 'WebService::Cmis::Object'); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub test_Folder_getDescendantsLink : Test { |
39
|
|
|
|
|
|
|
my $this = shift; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
42
|
|
|
|
|
|
|
my $root = $repo->getRootFolder(); |
43
|
|
|
|
|
|
|
my $descendantsLink = $root->getDescendantsLink(); |
44
|
|
|
|
|
|
|
note("descendantsLink=$descendantsLink"); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $href = $this->{config}{url}; |
47
|
|
|
|
|
|
|
$href =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
48
|
|
|
|
|
|
|
$descendantsLink =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
like($descendantsLink, qr"^$href"); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub test_Folder_getDescendants : Tests { |
54
|
|
|
|
|
|
|
my $this = shift; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
57
|
|
|
|
|
|
|
my $root = $repo->getRootFolder(); |
58
|
|
|
|
|
|
|
my $descendants; |
59
|
|
|
|
|
|
|
my $exceptionOk = 0; |
60
|
|
|
|
|
|
|
my $error; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
try { |
63
|
|
|
|
|
|
|
$descendants = $root->getDescendants(depth=>2); |
64
|
|
|
|
|
|
|
} catch WebService::Cmis::NotSupportedException with { |
65
|
|
|
|
|
|
|
$error = shift; |
66
|
|
|
|
|
|
|
like($error, "This repository does not support getDescendants"); |
67
|
|
|
|
|
|
|
$exceptionOk = 1; |
68
|
|
|
|
|
|
|
}; |
69
|
|
|
|
|
|
|
return $error if $exceptionOk; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
note("found ".$descendants->getSize." descdendants at ".$root->getName); |
72
|
|
|
|
|
|
|
while(my $obj = $descendants->getNext) { |
73
|
|
|
|
|
|
|
note("path=".($obj->getPath||'').", title=".$obj->getTitle.", summary=".$obj->getSummary.", url=".$obj->getSelfLink); |
74
|
|
|
|
|
|
|
ok(defined $obj); |
75
|
|
|
|
|
|
|
isa_ok($obj, "WebService::Cmis::Object"); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub test_Folder_getFolderTree : Tests { |
80
|
|
|
|
|
|
|
my $this = shift; |
81
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
82
|
|
|
|
|
|
|
my $root = $repo->getRootFolder; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $tree = $root->getFolderTree(depth=>2); |
85
|
|
|
|
|
|
|
note("found ".$tree->getSize." objects"); |
86
|
|
|
|
|
|
|
while(my $obj = $tree->getNext) { |
87
|
|
|
|
|
|
|
note("obj=$obj, name=".$obj->getName.", id=".$obj->getId.", url=".$obj->getSelfLink); |
88
|
|
|
|
|
|
|
isa_ok($obj, 'WebService::Cmis::Folder'); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |