| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Cmis::Test::Repository; |
|
2
|
1
|
|
|
1
|
|
1287
|
use base qw(WebService::Cmis::Test); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
512
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
|
5
|
|
|
|
|
|
|
use warnings; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Error qw(:try); |
|
8
|
|
|
|
|
|
|
use Test::More; |
|
9
|
|
|
|
|
|
|
use WebService::Cmis qw(:collections :utils :relations :namespaces :contenttypes); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub test_Repository_getRepositoryName : Test { |
|
12
|
|
|
|
|
|
|
my $this = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
15
|
|
|
|
|
|
|
my $name = $repo->getRepositoryName; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
note("repository name=$name"); |
|
18
|
|
|
|
|
|
|
ok($name); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub test_Repository_getRepositoryId : Test(3) { |
|
22
|
|
|
|
|
|
|
my $this = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
25
|
|
|
|
|
|
|
my $id1 = $repo->getRepositoryId; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
note("id1=$id1"); |
|
28
|
|
|
|
|
|
|
ok($id1); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $repo2 = $this->getRepository($id1); |
|
31
|
|
|
|
|
|
|
my $id2 = $repo2->getRepositoryId; |
|
32
|
|
|
|
|
|
|
ok($id2); |
|
33
|
|
|
|
|
|
|
note("id2=$id2"); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
is($id1, $id2); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub test_Repository_getRepository_unknown : Test { |
|
39
|
|
|
|
|
|
|
my $this = shift; |
|
40
|
|
|
|
|
|
|
my $client = $this->getClient; |
|
41
|
|
|
|
|
|
|
my $repo = $client->getRepository("foobarbaz"); |
|
42
|
|
|
|
|
|
|
ok(!defined $repo); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub test_Repository_getRepositoryInfo : Test(5) { |
|
46
|
|
|
|
|
|
|
my $this = shift; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $info = $repo->getRepositoryInfo; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
ok(!defined $info->{capabilities}) or diag("capabilities should not be listed in repository info"); |
|
53
|
|
|
|
|
|
|
ok(!defined $info->{aclCapability}) or diag("aclCapabilities should not be listed in repository info"); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
note("repositoryInfo :\n".join("\n", map(" ".$_.'='.$info->{$_}, keys %$info))); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# include |
|
58
|
|
|
|
|
|
|
# SMELL: what's the absolute minimum? |
|
59
|
|
|
|
|
|
|
foreach my $key (qw(repositoryName repositoryId rootFolderId)) { |
|
60
|
|
|
|
|
|
|
note("$key=$info->{$key}"); |
|
61
|
|
|
|
|
|
|
ok($info->{$key}); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub test_Repository_getCapabilities : Test(28) { |
|
66
|
|
|
|
|
|
|
my $this = shift; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $caps = $repo->getCapabilities; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# no capabilities at all |
|
73
|
|
|
|
|
|
|
SKIP: { |
|
74
|
|
|
|
|
|
|
skip "repository does not support capabilities", 28 unless scalar keys %$caps; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
note("caps:\n".join("\n", map(" ".$_.'='.$caps->{$_}, keys %$caps))); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
foreach my $key (qw( Renditions Multifiling ContentStreamUpdatability Unfiling |
|
79
|
|
|
|
|
|
|
GetFolderTree AllVersionsSearchable Changes Join ACL Query PWCSearchable |
|
80
|
|
|
|
|
|
|
PWCUpdatable VersionSpecificFiling GetDescendants)) { |
|
81
|
|
|
|
|
|
|
my $val = $caps->{"$key"}; |
|
82
|
|
|
|
|
|
|
note("$key=$val"); |
|
83
|
|
|
|
|
|
|
ok(defined $val) or diag("capability $key not found"); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub test_Repository_getSupportedPermissions : Test(1) { |
|
89
|
|
|
|
|
|
|
my $this = shift; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
92
|
|
|
|
|
|
|
my $canACL = $repo->getCapabilities()->{'ACL'}; |
|
93
|
|
|
|
|
|
|
SKIP: { |
|
94
|
|
|
|
|
|
|
skip "not able to manage ACLs",1 unless $canACL eq 'manage'; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $perms = $repo->getSupportedPermissions; |
|
97
|
|
|
|
|
|
|
note("perms='$perms'"); |
|
98
|
|
|
|
|
|
|
like($perms, qr/^(basic|repository|both)$/); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub test_Repository_getPermissionDefinitions : Tests { |
|
103
|
|
|
|
|
|
|
my $this = shift; |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
106
|
|
|
|
|
|
|
my $canACL = $repo->getCapabilities()->{'ACL'}; |
|
107
|
|
|
|
|
|
|
SKIP: { |
|
108
|
|
|
|
|
|
|
skip "not able to manage ACLs" unless $canACL eq 'manage'; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $permDefs = $repo->getPermissionDefinitions; |
|
111
|
|
|
|
|
|
|
my $numPermDefs = scalar(keys %$permDefs); |
|
112
|
|
|
|
|
|
|
$this->num_tests($numPermDefs+4); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
ok(defined $permDefs) or diag("no permission definitions found"); |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $foundCmisRead; |
|
117
|
|
|
|
|
|
|
my $foundCmisWrite; |
|
118
|
|
|
|
|
|
|
foreach my $key (keys %$permDefs) { |
|
119
|
|
|
|
|
|
|
#print STDERR "$key = $permDefs->{$key}\n"; |
|
120
|
|
|
|
|
|
|
like($key, qr'{http://|cmis:'); |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# SMELL: nuxeo calls the basic cmis permissions "basic"... oh well |
|
123
|
|
|
|
|
|
|
$foundCmisRead = 1 if $key =~ /cmis:(read|basic)/; |
|
124
|
|
|
|
|
|
|
$foundCmisWrite = 1 if $key =~ /cmis:(write|basic)/; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
ok(defined $foundCmisRead) or diag("cmis:read not found in permission definition"); |
|
127
|
|
|
|
|
|
|
ok(defined $foundCmisWrite) or diag("cmis:write not found in permission definition"); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub test_Repository_getPermissionMap : Test(32) { |
|
132
|
|
|
|
|
|
|
my $this = shift; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
135
|
|
|
|
|
|
|
my $canACL = $repo->getCapabilities()->{'ACL'}; |
|
136
|
|
|
|
|
|
|
SKIP: { |
|
137
|
|
|
|
|
|
|
skip "not able to manage ACLs", 32 unless $canACL eq 'manage'; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my $permMap = $repo->getPermissionMap; |
|
140
|
|
|
|
|
|
|
ok($permMap) or diag("no permission map found"); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
note("perms=".join(' ', keys %$permMap)); |
|
143
|
|
|
|
|
|
|
my $permMapCount = scalar(keys %$permMap); |
|
144
|
|
|
|
|
|
|
note("found $permMapCount permission mappings"); |
|
145
|
|
|
|
|
|
|
foreach my $perm (keys %$permMap) { |
|
146
|
|
|
|
|
|
|
note("$perm=".join(', ', @{$permMap->{$perm}})); |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
# SMELL: which of these are standard, which are nice to have? |
|
150
|
|
|
|
|
|
|
my $knownMapCount = 0; |
|
151
|
|
|
|
|
|
|
foreach my $perm (qw(canSetContent.Document canDeleteTree.Folder |
|
152
|
|
|
|
|
|
|
canAddPolicy.Object canAddPolicy.Policy canGetChildren.Folder |
|
153
|
|
|
|
|
|
|
canGetAllVersions.VersionSeries canCancelCheckout.Document canApplyACL.Object |
|
154
|
|
|
|
|
|
|
canMove.Target canGetDescendents.Folder canRemovePolicy.Policy |
|
155
|
|
|
|
|
|
|
canCreateFolder.Folder canGetParents.Folder canGetFolderParent.Object |
|
156
|
|
|
|
|
|
|
canGetAppliedPolicies.Object canUpdateProperties.Object canMove.Object |
|
157
|
|
|
|
|
|
|
canDeleteContent.Document canCheckout.Document canDelete.Object |
|
158
|
|
|
|
|
|
|
canRemoveFromFolder.Object canCreateDocument.Folder canGetProperties.Object |
|
159
|
|
|
|
|
|
|
canAddToFolder.Folder canRemovePolicy.Object canCheckin.Document |
|
160
|
|
|
|
|
|
|
canAddToFolder.Object canGetACL.Object canViewContent.Object)) { |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$knownMapCount++; |
|
163
|
|
|
|
|
|
|
note($knownMapCount.": $perm=".join(", ", @{$permMap->{$perm}})); |
|
164
|
|
|
|
|
|
|
ok($permMap->{$perm}) or diag("permission $perm not defined"); |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
note("knownMapCount=$knownMapCount"); |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
is($permMapCount, $knownMapCount); |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub test_Repository_getPropagation : Test { |
|
173
|
|
|
|
|
|
|
my $this = shift; |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
176
|
|
|
|
|
|
|
my $canACL = $repo->getCapabilities()->{'ACL'}; |
|
177
|
|
|
|
|
|
|
SKIP: { |
|
178
|
|
|
|
|
|
|
skip "not able to manage ACLs", 1 unless $canACL eq 'manage'; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
my $prop = $repo->getPropagation; |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
note("prop=$prop"); |
|
183
|
|
|
|
|
|
|
like($prop, qr'objectonly|propagate|repositorydetermined'); |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
} |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub test_Repository_getRootFolderId : Test { |
|
188
|
|
|
|
|
|
|
my $this = shift; |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
191
|
|
|
|
|
|
|
my $rootFolderId = $repo->getRepositoryInfo->{'rootFolderId'}; |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
note("rootFolderId=$rootFolderId"); |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
ok($rootFolderId) or diag("no rootFolder found"); |
|
196
|
|
|
|
|
|
|
} |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub test_Repository_getUriTemplates : Test(4) { |
|
199
|
|
|
|
|
|
|
my $this = shift; |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
my $uriTemplates = $repo->getUriTemplates; |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
note("types=".join(' ', keys %$uriTemplates)); |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
foreach my $type (qw(objectbypath query objectbyid typebyid)) { |
|
208
|
|
|
|
|
|
|
ok(defined $uriTemplates->{$type}) or diag("no uri template for $type"); |
|
209
|
|
|
|
|
|
|
note("type=$type, mediatype=$uriTemplates->{$type}{mediatype}, template=$uriTemplates->{$type}{template}"); |
|
210
|
|
|
|
|
|
|
} |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub test_Repository_getUriTemplate : Test(4) { |
|
214
|
|
|
|
|
|
|
my $this = shift; |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
foreach my $type (qw(objectbypath query objectbyid typebyid)) { |
|
219
|
|
|
|
|
|
|
my $template = $repo->getUriTemplate($type); |
|
220
|
|
|
|
|
|
|
note("template=$template"); |
|
221
|
|
|
|
|
|
|
ok(defined $template) or diag("no uri template for $type"); |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub test_Repository_getCollectionLink : Test(8) { |
|
226
|
|
|
|
|
|
|
my $this = shift; |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
my $href = $this->{config}{url}; |
|
231
|
|
|
|
|
|
|
$href =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
# UNFILED_COLL not supported by all repositories; |
|
234
|
|
|
|
|
|
|
# SMELL: test for unfiled capability |
|
235
|
|
|
|
|
|
|
foreach my $collectionType (QUERY_COLL, TYPES_COLL, CHECKED_OUT_COLL, ROOT_COLL) { |
|
236
|
|
|
|
|
|
|
my $link = $repo->getCollectionLink($collectionType); |
|
237
|
|
|
|
|
|
|
note("type=$collectionType, link=".($link||'')); |
|
238
|
|
|
|
|
|
|
ok(defined $link); |
|
239
|
|
|
|
|
|
|
$link =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
|
240
|
|
|
|
|
|
|
like($link, qr/^$href/); |
|
241
|
|
|
|
|
|
|
} |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub test_Repository_getCollection : Tests { |
|
245
|
|
|
|
|
|
|
my $this = shift; |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# QUERY_COLL |
|
250
|
|
|
|
|
|
|
my $error; |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
try { |
|
253
|
|
|
|
|
|
|
$repo->getCollection(QUERY_COLL); |
|
254
|
|
|
|
|
|
|
} catch Error::Simple with { |
|
255
|
|
|
|
|
|
|
$error = shift; |
|
256
|
|
|
|
|
|
|
like($error, qr'^query collection not supported'); |
|
257
|
|
|
|
|
|
|
}; |
|
258
|
|
|
|
|
|
|
ok(defined $error); |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
# TYPES_COLL |
|
261
|
|
|
|
|
|
|
my $typeDefs = $repo->getCollection(TYPES_COLL); |
|
262
|
|
|
|
|
|
|
isa_ok($typeDefs, 'WebService::Cmis::AtomFeed::ObjectTypes'); |
|
263
|
|
|
|
|
|
|
while (my $typeDef = $typeDefs->getNext) { |
|
264
|
|
|
|
|
|
|
isa_ok($typeDef, 'WebService::Cmis::ObjectType'); |
|
265
|
|
|
|
|
|
|
note("typeDef=".$typeDef->toString); |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
# other collections |
|
269
|
|
|
|
|
|
|
# SMELL: nuxeo throws a 405 on CHECKED_OUT |
|
270
|
|
|
|
|
|
|
# UNFILED_COLL not allowed for non-admins |
|
271
|
|
|
|
|
|
|
foreach my $collectionType (CHECKED_OUT_COLL, ROOT_COLL) { |
|
272
|
|
|
|
|
|
|
my $result = $repo->getCollection($collectionType); |
|
273
|
|
|
|
|
|
|
note("collectionType=$collectionType, result=$result, nrObjects=".$result->getSize); |
|
274
|
|
|
|
|
|
|
ok(defined $result); |
|
275
|
|
|
|
|
|
|
} |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub test_Repository_getTypeDefinition : Test(5) { |
|
279
|
|
|
|
|
|
|
my $this = shift; |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
282
|
|
|
|
|
|
|
my $objectType = $repo->getTypeDefinition('cmis:folder'); |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
#print "id=".$objectType->getId.", displayName=".$objectType->getDisplayName.", description=".$objectType->getDescription.", link=".$objectType->getLink."\n"; |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
ok(defined $objectType->getId); |
|
287
|
|
|
|
|
|
|
ok(defined $objectType->getDisplayName); |
|
288
|
|
|
|
|
|
|
ok(defined $objectType->getQueryName); |
|
289
|
|
|
|
|
|
|
ok(defined $objectType->{xmlDoc}); |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
is($objectType->toString, 'cmis:folder'); |
|
292
|
|
|
|
|
|
|
} |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub test_Repository_getRootFolder : Test(3) { |
|
295
|
|
|
|
|
|
|
my $this = shift; |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
298
|
|
|
|
|
|
|
my $obj = $repo->getRootFolder; |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
ok(defined $obj) or diag("can't fetch root folder"); |
|
301
|
|
|
|
|
|
|
note("obj=".$obj->toString." ($obj)"); |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
my $props = $obj->getProperties; |
|
304
|
|
|
|
|
|
|
note($props->{"cmis:path"}{displayName}."=".$props->{"cmis:path"}->getValue); |
|
305
|
|
|
|
|
|
|
is("/", $props->{"cmis:path"}->getValue); |
|
306
|
|
|
|
|
|
|
is("", $props->{"cmis:parentId"}->getValue||""); |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub test_Repository_getObjectByPath : Test(2) { |
|
310
|
|
|
|
|
|
|
my $this = shift; |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
313
|
|
|
|
|
|
|
my $root = $repo->getRootFolder; |
|
314
|
|
|
|
|
|
|
my $obj = $repo->getObjectByPath; |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
ok(defined $root) or diag("no root folder found"); |
|
317
|
|
|
|
|
|
|
note("obj=".$obj->getId.", name=".$obj->getName.", path=".$obj->getPath); |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
is($root->getId, $obj->getId); |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub test_Repository_getObjectByPath_Sites : Test(2) { |
|
323
|
|
|
|
|
|
|
my $this = shift; |
|
324
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
my $examplePath = $this->{testRoot}; |
|
327
|
|
|
|
|
|
|
my $obj = $repo->getObjectByPath($examplePath); |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
note("obj=".$obj->getId.", name=".$obj->getName.", path=".$obj->getPath); |
|
330
|
|
|
|
|
|
|
ok(defined $obj) or diag("$examplePath not found"); |
|
331
|
|
|
|
|
|
|
is($examplePath, $obj->getPath); |
|
332
|
|
|
|
|
|
|
} |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
sub test_Repository_getObjectByPath_Unknown : Test(3) { |
|
335
|
|
|
|
|
|
|
my $this = shift; |
|
336
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
my $obj; |
|
339
|
|
|
|
|
|
|
my $error; |
|
340
|
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
try { |
|
342
|
|
|
|
|
|
|
$obj = $repo->getObjectByPath('/This/Folder/Does/Not/Exist'); |
|
343
|
|
|
|
|
|
|
} catch WebService::Cmis::ClientException with { |
|
344
|
|
|
|
|
|
|
$error = shift; |
|
345
|
|
|
|
|
|
|
ok(defined $error); |
|
346
|
|
|
|
|
|
|
like($error, '^404 Not Found'); |
|
347
|
|
|
|
|
|
|
}; |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
ok(!defined $obj); |
|
350
|
|
|
|
|
|
|
} |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
sub test_Repository_getObject : Test { |
|
353
|
|
|
|
|
|
|
my $this = shift; |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
356
|
|
|
|
|
|
|
my $root = $repo->getRootFolder; |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
my $obj = $repo->getObject($root->getId); |
|
359
|
|
|
|
|
|
|
is($root->getId, $obj->getId); |
|
360
|
|
|
|
|
|
|
} |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub test_Repository_getLink : Test(8) { |
|
363
|
|
|
|
|
|
|
my $this = shift; |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
366
|
|
|
|
|
|
|
# $repo->reload unless defined $repo->{xmlDoc}; |
|
367
|
|
|
|
|
|
|
# my $linkNodes = $repo->{xmlDoc}->findnodes('//atom:link'); |
|
368
|
|
|
|
|
|
|
# print STDERR "found ".$linkNodes->size." links\n"; |
|
369
|
|
|
|
|
|
|
# print STDERR $_->toString."\n", foreach $linkNodes->get_nodelist; |
|
370
|
|
|
|
|
|
|
# print STDERR "\n"; |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
my $repoUrl = $this->{config}{url}; |
|
373
|
|
|
|
|
|
|
$repoUrl =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
my @rels = (FOLDER_TREE_REL, ROOT_DESCENDANTS_REL, TYPE_DESCENDANTS_REL); |
|
376
|
|
|
|
|
|
|
push @rels, CHANGE_LOG_REL if $repo->getCapabilities()->{'Changes'} && $repo->getCapabilities()->{'Changes'} ne 'none'; |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
foreach my $rel (@rels) { |
|
379
|
|
|
|
|
|
|
my $href = $repo->getLink($rel); |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
ok(defined $href) or diag("link for $rel not found"); |
|
382
|
|
|
|
|
|
|
next unless defined $href; |
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
$href =~ s/^(http:\/\/[^\/]+?):80\//$1\//g; # remove bogus :80 port |
|
385
|
|
|
|
|
|
|
like($href, qr/^$repoUrl/); |
|
386
|
|
|
|
|
|
|
note("found rel=$rel, href=$href"); |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
} |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub test_Repository_getLink_unknown : Test { |
|
391
|
|
|
|
|
|
|
my $this = shift; |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
394
|
|
|
|
|
|
|
my $href = $repo->getLink("foobar"); |
|
395
|
|
|
|
|
|
|
ok(!defined $href); |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub test_Repository_getCheckedOutDocs : Tests { |
|
399
|
|
|
|
|
|
|
my $this = shift; |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
402
|
|
|
|
|
|
|
$this->deleteTestDocument; |
|
403
|
|
|
|
|
|
|
my $doc = $this->getTestDocument; |
|
404
|
|
|
|
|
|
|
note("before checkout id=".$doc->getId); |
|
405
|
|
|
|
|
|
|
$doc->checkOut; |
|
406
|
|
|
|
|
|
|
note("after checkout id=".$doc->getId); |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
my $checkedOutDocs = $repo->getCheckedOutDocs; |
|
409
|
|
|
|
|
|
|
ok(defined $checkedOutDocs) or diag("can't get checked out docs"); |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
my $nrEntries = $checkedOutDocs->getSize; |
|
412
|
|
|
|
|
|
|
ok(defined $nrEntries) or diag("should have at least one document checked out"); |
|
413
|
|
|
|
|
|
|
note("found $nrEntries checked out document(s)"); |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
while(my $doc = $checkedOutDocs->getNext) { |
|
416
|
|
|
|
|
|
|
my $id = $doc->getId; |
|
417
|
|
|
|
|
|
|
ok(defined $id); |
|
418
|
|
|
|
|
|
|
my $baseTypeId = $doc->getProperty("cmis:baseTypeId"); |
|
419
|
|
|
|
|
|
|
ok(defined $baseTypeId); |
|
420
|
|
|
|
|
|
|
my $selfLink = $doc->getSelfLink; |
|
421
|
|
|
|
|
|
|
ok(defined $selfLink); |
|
422
|
|
|
|
|
|
|
note("id=$id, baseTypeId=$baseTypeId, url=$selfLink"); |
|
423
|
|
|
|
|
|
|
isa_ok($doc, 'WebService::Cmis::Document'); |
|
424
|
|
|
|
|
|
|
} |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
note("before cancel checkout id=".$doc->getId); |
|
427
|
|
|
|
|
|
|
$doc->cancelCheckOut; |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub test_Repository_getTypeDefinitions : Tests { |
|
431
|
|
|
|
|
|
|
my $this = shift; |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
my $typeDefs = $repo->getTypeDefinitions; |
|
436
|
|
|
|
|
|
|
ok(defined $typeDefs) or diag("can't get type definitions"); |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
note("found ".$typeDefs->getSize." type definition(s)"); |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
while(my $objectType = $typeDefs->getNext) { |
|
441
|
|
|
|
|
|
|
isa_ok($objectType, 'WebService::Cmis::ObjectType'); |
|
442
|
|
|
|
|
|
|
ok(defined $objectType->getId); |
|
443
|
|
|
|
|
|
|
ok(defined $objectType->getDisplayName); |
|
444
|
|
|
|
|
|
|
ok(defined $objectType->getQueryName); |
|
445
|
|
|
|
|
|
|
#print "id=".$objectType->getId.", displayName=".$objectType->getDisplayName.", description=".$objectType->getDescription.", link=".$objectType->getLink."\n"; |
|
446
|
|
|
|
|
|
|
$objectType->reload; |
|
447
|
|
|
|
|
|
|
ok(defined $objectType->getId); |
|
448
|
|
|
|
|
|
|
ok(defined $objectType->getDisplayName); |
|
449
|
|
|
|
|
|
|
ok(defined $objectType->getQueryName); |
|
450
|
|
|
|
|
|
|
} |
|
451
|
|
|
|
|
|
|
} |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub test_Repository_getTypeChildren : Tests { |
|
454
|
|
|
|
|
|
|
my $this = shift; |
|
455
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
# get type defs |
|
458
|
|
|
|
|
|
|
foreach my $typeId (undef, 'cmis:document', 'cmis:folder') { |
|
459
|
|
|
|
|
|
|
my $set = $repo->getTypeChildren($typeId); |
|
460
|
|
|
|
|
|
|
ok(defined $set); |
|
461
|
|
|
|
|
|
|
ok($set->getSize > 0); |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
note("found ".$set->getSize." objects(s)"); |
|
464
|
|
|
|
|
|
|
while(my $objectType = $set->getNext) { |
|
465
|
|
|
|
|
|
|
isa_ok($objectType, 'WebService::Cmis::ObjectType'); |
|
466
|
|
|
|
|
|
|
#print "id=".$objectType->getId.", displayName=".$objectType->getDisplayName.", description=".$objectType->getDescription.", link=".$objectType->getLink."\n"; |
|
467
|
|
|
|
|
|
|
} |
|
468
|
|
|
|
|
|
|
} |
|
469
|
|
|
|
|
|
|
} |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
sub test_Repository_getTypeDescendants : Tests { |
|
472
|
|
|
|
|
|
|
my $this = shift; |
|
473
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
474
|
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
# get type defs |
|
476
|
|
|
|
|
|
|
foreach my $typeId (undef, 'cmis:document', 'cmis:folder') { |
|
477
|
|
|
|
|
|
|
my $set = $repo->getTypeDescendants($typeId, depth=>1); |
|
478
|
|
|
|
|
|
|
ok(defined $set); |
|
479
|
|
|
|
|
|
|
note("found ".$set->getSize." objects(s) of type ".($typeId||'undef')); |
|
480
|
|
|
|
|
|
|
ok($set->getSize > 0); |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
while(my $objectType = $set->getNext) { |
|
483
|
|
|
|
|
|
|
isa_ok($objectType, 'WebService::Cmis::ObjectType'); |
|
484
|
|
|
|
|
|
|
#print "id=".$objectType->getId.", displayName=".$objectType->getDisplayName.", description=".$objectType->getDescription.", link=".$objectType->getLink."\n"; |
|
485
|
|
|
|
|
|
|
} |
|
486
|
|
|
|
|
|
|
} |
|
487
|
|
|
|
|
|
|
} |
|
488
|
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
sub test_Repository_getQueryXmlDoc : Test { |
|
490
|
|
|
|
|
|
|
my $this = shift; |
|
491
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
my $xmlDoc = $repo->_getQueryXmlDoc("select * from cmis:document", foo=>"bar"); |
|
494
|
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
my $testString = <<'HERE'; |
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
bar |
|
500
|
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
HERE |
|
502
|
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
note("xmlDoc=".$xmlDoc->toString(1)); |
|
504
|
|
|
|
|
|
|
is($xmlDoc->toString(1), $testString) or $this->reportXmlDiff($xmlDoc->toString(1), $testString); |
|
505
|
|
|
|
|
|
|
} |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub test_Repository_query : Test(14) { |
|
508
|
|
|
|
|
|
|
my $this = shift; |
|
509
|
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
my $maxItems = 10; |
|
513
|
|
|
|
|
|
|
my $skipCount = 0; |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
foreach my $typeId ('cmis:folder', 'cmis:document') { |
|
518
|
|
|
|
|
|
|
my $feed = $repo->query("select * from $typeId", maxItems => $maxItems, skipCount => $skipCount); |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
#note("feed=".$feed->{xmlDoc}->toString(1)); |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
my $dateTime = WebService::Cmis::Property::formatDateTime($feed->getUpdated); |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
note("title=" . $feed->getTitle); |
|
525
|
|
|
|
|
|
|
note("generator=" . $feed->getGenerator); |
|
526
|
|
|
|
|
|
|
note("updated=" . $feed->getUpdated . " ($dateTime)"); |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
my $numItems = $feed->getSize; |
|
529
|
|
|
|
|
|
|
note("numItems=$numItems reported in feed while querying for $typeId"); |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
ok(defined $feed); |
|
532
|
|
|
|
|
|
|
ok(defined $feed->getTitle); |
|
533
|
|
|
|
|
|
|
ok(defined $feed->getGenerator); |
|
534
|
|
|
|
|
|
|
ok(defined $feed->getUpdated); |
|
535
|
|
|
|
|
|
|
like($feed->getUpdated, qr'^\d+(Z|[-+]\d\d(:\d\d)?)?$'); |
|
536
|
|
|
|
|
|
|
like($feed->getSize, qr'^\d+$'); |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
# more checks |
|
539
|
|
|
|
|
|
|
my $countItems = 0; |
|
540
|
|
|
|
|
|
|
$countItems++ while my $obj = $feed->getNext; |
|
541
|
|
|
|
|
|
|
note("counted $countItems $typeId while crawling the feed"); |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
my $msg = $this->isBrokenFeature("numItems"); |
|
544
|
|
|
|
|
|
|
SKIP: { |
|
545
|
|
|
|
|
|
|
skip $msg, 1 if $msg; |
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
is($countItems, $numItems) or diag("woops, wrong number of entries in feed"); |
|
548
|
|
|
|
|
|
|
} |
|
549
|
|
|
|
|
|
|
} |
|
550
|
|
|
|
|
|
|
} |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
sub test_Repository_query_jpg : Tests { |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
my $this = shift; |
|
555
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
556
|
|
|
|
|
|
|
$this->getTestDocument; |
|
557
|
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
my $feed = $repo->query("select * from cmis:document where cmis:name like '%jpg'"); |
|
559
|
|
|
|
|
|
|
my $size = $feed->getSize(); |
|
560
|
|
|
|
|
|
|
ok($size > 0) or diag("no jpegs found by query"); |
|
561
|
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
while(my $obj = $feed->getNext) { |
|
563
|
|
|
|
|
|
|
my $title = $obj->getTitle; |
|
564
|
|
|
|
|
|
|
my $id = $obj->getId; |
|
565
|
|
|
|
|
|
|
ok(defined $title); |
|
566
|
|
|
|
|
|
|
ok(defined $id); |
|
567
|
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
my $props = $obj->getProperties; |
|
569
|
|
|
|
|
|
|
ok(defined $props); |
|
570
|
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
my @result = (); |
|
572
|
|
|
|
|
|
|
foreach my $key (keys %$props) { |
|
573
|
|
|
|
|
|
|
my $val = $props->{$key}->getValue; |
|
574
|
|
|
|
|
|
|
push @result, "$key=$val" if defined $val; |
|
575
|
|
|
|
|
|
|
} |
|
576
|
|
|
|
|
|
|
note(join("\n ", @result)); |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
note("size=$size"); |
|
580
|
|
|
|
|
|
|
} |
|
581
|
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
sub test_Repository_createEntryXmlDoc_1 : Test { |
|
583
|
|
|
|
|
|
|
my $this = shift; |
|
584
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
585
|
|
|
|
|
|
|
my $id = $repo->getRepositoryId; |
|
586
|
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
my $xmlDoc = $repo->createEntryXmlDoc(summary=>"hello world"); |
|
588
|
|
|
|
|
|
|
note($xmlDoc->toString(1)); |
|
589
|
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
my $xmlSource = <<"HERE"; |
|
591
|
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
hello world |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
HERE |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
my $xmlDocString = $xmlDoc->toString(1); |
|
600
|
|
|
|
|
|
|
$xmlDocString =~ s/\n\s*?.*?<\/cmis:repositoryId>\s*?\n/\n/; |
|
601
|
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
is($xmlDocString, $xmlSource) or $this->reportXmlDiff($xmlDocString, $xmlSource); |
|
603
|
|
|
|
|
|
|
} |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
sub test_Repository_createEntryXmlDoc_2 : Test { |
|
606
|
|
|
|
|
|
|
my $this = shift; |
|
607
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
608
|
|
|
|
|
|
|
my $id = $repo->getRepositoryId; |
|
609
|
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
require WebService::Cmis::Property; |
|
611
|
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
#print "nameProperty=".$nameProperty->toString."\n"; |
|
613
|
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
my $xmlDoc = $repo->createEntryXmlDoc( |
|
615
|
|
|
|
|
|
|
properties => [ |
|
616
|
|
|
|
|
|
|
WebService::Cmis::Property::newString( |
|
617
|
|
|
|
|
|
|
id => 'cmis:name', |
|
618
|
|
|
|
|
|
|
value => "hello world", |
|
619
|
|
|
|
|
|
|
), |
|
620
|
|
|
|
|
|
|
WebService::Cmis::Property::newBoolean( |
|
621
|
|
|
|
|
|
|
id=>"cmis:isLatestMajorVersion", |
|
622
|
|
|
|
|
|
|
displayName=>"Is Latest Major Version", |
|
623
|
|
|
|
|
|
|
queryName=>"cmis:isLatestMajorVersion", |
|
624
|
|
|
|
|
|
|
value=>0, |
|
625
|
|
|
|
|
|
|
), |
|
626
|
|
|
|
|
|
|
WebService::Cmis::Property::newDateTime( |
|
627
|
|
|
|
|
|
|
id=>"cmis:creationDate", |
|
628
|
|
|
|
|
|
|
displayName=>"Creation Date", |
|
629
|
|
|
|
|
|
|
queryName=>"cmis:creationDate", |
|
630
|
|
|
|
|
|
|
value=>WebService::Cmis::Property::parseDateTime("2011-01-25T13:22:28+01:00"), |
|
631
|
|
|
|
|
|
|
), |
|
632
|
|
|
|
|
|
|
WebService::Cmis::Property::newString( |
|
633
|
|
|
|
|
|
|
id => 'cm:taggable', |
|
634
|
|
|
|
|
|
|
queryName => 'cm:taggable', |
|
635
|
|
|
|
|
|
|
displayName => 'Tags', |
|
636
|
|
|
|
|
|
|
value => ["foo", "bar", "baz"], |
|
637
|
|
|
|
|
|
|
), |
|
638
|
|
|
|
|
|
|
] |
|
639
|
|
|
|
|
|
|
); |
|
640
|
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
my $testString = <<"HERE"; |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
hello world |
|
648
|
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
false |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
2011-01-25T13:22:28+01:00 |
|
654
|
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
foo |
|
657
|
|
|
|
|
|
|
bar |
|
658
|
|
|
|
|
|
|
baz |
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
hello world |
|
663
|
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
HERE |
|
665
|
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
note($xmlDoc->toString(1)); |
|
667
|
|
|
|
|
|
|
my $xmlDocString = $xmlDoc->toString(1); |
|
668
|
|
|
|
|
|
|
$xmlDocString =~ s/^\s//; |
|
669
|
|
|
|
|
|
|
$xmlDocString =~ s/\n\s*?.*?<\/cmis:repositoryId>\s*?\n/\n/; |
|
670
|
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
is($xmlDocString, $testString) or $this->reportXmlDiff($xmlDocString, $testString); |
|
672
|
|
|
|
|
|
|
} |
|
673
|
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
sub test_Repository_createEntryXmlDoc_contentFile { |
|
675
|
|
|
|
|
|
|
my $this = shift; |
|
676
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
677
|
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
my $testFile = $this->{testFile}; |
|
679
|
|
|
|
|
|
|
ok(-e $testFile) or diag("testFile=$testFile not found"); |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
my $xmlDoc = $repo->createEntryXmlDoc( |
|
682
|
|
|
|
|
|
|
contentFile=>$testFile |
|
683
|
|
|
|
|
|
|
); |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
note($xmlDoc->toString(1)); |
|
686
|
|
|
|
|
|
|
#is($testString, $xmlDoc->toString(1)); |
|
687
|
|
|
|
|
|
|
} |
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
sub test_Repository_createDocument_filed : Test { |
|
690
|
|
|
|
|
|
|
my $this = shift; |
|
691
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
692
|
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
# set up test folder |
|
694
|
|
|
|
|
|
|
my $document = $this->getTestDocument; |
|
695
|
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
$document = $repo->getObjectByPath($this->getTestFolderPath."/free.jpg"); |
|
697
|
|
|
|
|
|
|
ok(defined $document) or diag("can't find uploaded object ... should be available now"); |
|
698
|
|
|
|
|
|
|
} |
|
699
|
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
sub test_Repository_createDocument_unfiled : Test(2) { |
|
701
|
|
|
|
|
|
|
my $this = shift; |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
704
|
|
|
|
|
|
|
my $canUnfiling = $repo->getCapabilities()->{'Unfiling'}; |
|
705
|
|
|
|
|
|
|
SKIP: { |
|
706
|
|
|
|
|
|
|
skip "repository not supporting unfiling", 2 unless $canUnfiling; |
|
707
|
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
my $testFile = $this->{testFile}; |
|
709
|
|
|
|
|
|
|
ok(-e $testFile) or diag("testFile=$testFile not found"); |
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
my $document = $repo->createDocument("free.jpg", contentFile => $testFile); |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
ok(defined $document); |
|
714
|
|
|
|
|
|
|
} |
|
715
|
|
|
|
|
|
|
} |
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
sub test_Repository_getUnfiledDocs : Tests { |
|
718
|
|
|
|
|
|
|
my $this = shift; |
|
719
|
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
721
|
|
|
|
|
|
|
my $canUnfiling = $repo->getCapabilities()->{'Unfiling'}; |
|
722
|
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
SKIP: { |
|
724
|
|
|
|
|
|
|
skip "repository not supporting unfiling", unless $canUnfiling; |
|
725
|
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
my $unfiledDocs = $repo->getUnfiledDocs; |
|
727
|
|
|
|
|
|
|
ok(defined $unfiledDocs) or diag("can't get unfiled docs"); |
|
728
|
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
note("found " . $unfiledDocs->getSize . " unfiled document(s)"); |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
while (my $obj = $unfiledDocs->getNext) { |
|
732
|
|
|
|
|
|
|
note("name=" . $obj->getName . ", id=" . $obj->getId . ", url=" . $obj->getSelfLink); |
|
733
|
|
|
|
|
|
|
isa_ok($obj, 'WebService::Cmis::Document'); |
|
734
|
|
|
|
|
|
|
} |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
} |
|
737
|
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
# TODO create an unfiled document and test it |
|
739
|
|
|
|
|
|
|
#fail("WARNING: create an unfiled document and verify it is in the unfiled collection"); |
|
740
|
|
|
|
|
|
|
} |
|
741
|
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
sub test_Repository_createFolder : Test { |
|
743
|
|
|
|
|
|
|
my $this = shift; |
|
744
|
|
|
|
|
|
|
my $repo = $this->getRepository; |
|
745
|
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
my $folder = $this->getTestFolder; |
|
747
|
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
$folder = $repo->getObjectByPath($this->getTestFolderPath); |
|
749
|
|
|
|
|
|
|
ok(defined $folder) or diag("folder should be available now"); |
|
750
|
|
|
|
|
|
|
} |
|
751
|
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
1; |
|
754
|
|
|
|
|
|
|
|