5 $testurl =
"http://localhost/sss/sd-uri";
17 $testdepositurl =
"http://localhost/sss/col-uri/da9b9feb-4266-446a-8847-46f6c30b2ff0";
20 $testatomentry =
"test-files/atom_multipart/atom";
23 $testatomentry2 =
"test-files/atom_multipart/atom2";
26 $testmultipart =
"test-files/atom_multipart_package";
29 $testmultipart2 =
"test-files/atom_multipart_package2";
32 $testzipcontentfile =
"test-files/atom_multipart_package2.zip";
35 $testextrafile =
"test-files/swordlogo.jpg";
38 $testextrafiletype =
"image/jpg";
41 $testcontenttype =
"application/zip";
44 $testpackaging =
"http://purl.org/net/sword/package/SimpleZip";
46 require(
"../swordappclient.php");
50 print
"About to request servicedocument from " . $testurl .
"\n";
51 if (empty($testuser)) {
52 print
"As: anonymous\n";
54 print
"As: " . $testuser .
"\n";
56 $testsdr = $testsac->servicedocument($testurl, $testuser, $testpw, $testobo);
57 print
"Received HTTP status code: " . $testsdr->sac_status .
" (" . $testsdr->sac_statusmessage .
")\n";
59 if ($testsdr->sac_status == 200) {
67 print
"About to deposit multipart file (" . $testmultipart .
") to " . $testdepositurl .
"\n";
68 if (empty($testuser)) {
69 print
"As: anonymous\n";
71 print
"As: " . $testuser .
"\n";
73 $testdr = $testsac->depositMultipart($testdepositurl, $testuser, $testpw, $testobo, $testmultipart, $testpackaging,
false);
74 print
"Received HTTP status code: " . $testdr->sac_status .
" (" . $testdr->sac_statusmessage .
")\n";
76 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
82 $edit_iri = $testdr->sac_edit_iri;
83 $cont_iri = $testdr->sac_content_src;
84 $edit_media = $testdr->sac_edit_media_iri;
85 $statement_atom = $testdr->sac_state_iri_atom;
86 $statement_ore = $testdr->sac_state_iri_ore;
90 print
"About to request Atom serialisation of the deposit statement from " . $statement_atom .
"\n";
91 if (empty($testuser)) {
92 print
"As: anonymous\n";
94 print
"As: " . $testuser .
"\n";
96 $testatomstatement = $testsac->retrieveAtomStatement($statement_atom, $testuser, $testpw, $testobo);
98 if (($testatomstatement->sac_status >= 200) || ($testatomstatement->sac_status < 300)) {
99 $testatomstatement->toString();
106 print
"About to request OAI-ORE serialisation of the deposit statement from " . $statement_ore .
"\n";
107 if (empty($testuser)) {
108 print
"As: anonymous\n";
110 print
"As: " . $testuser .
"\n";
112 $testoaiore = $testsac->retrieveOAIOREStatement($statement_ore, $testuser, $testpw, $testobo);
119 print
"About to retrieve content from " . $edit_media .
"\n";
120 if (empty($testuser)) {
121 print
"As: anonymous\n";
123 print
"As: " . $testuser .
"\n";
125 $testresp = $testsac->retrieveContent($edit_media, $testuser, $testpw, $testobo,
"http://purl.org/net/sword/package/SimpleZip");
132 print
"About to replace content at " . $edit_media .
"\n";
133 if (empty($testuser)) {
134 print
"As: anonymous\n";
136 print
"As: " . $testuser .
"\n";
138 $status = $testsac->replaceFileContent($edit_media, $testuser, $testpw, $testobo, $testzipcontentfile, $testpackaging, $testcontenttype,
false);
139 print
"Received HTTP status code: " . $status .
"\n";
140 if ($status == 204) {
141 echo
"Content replaced\n";
148 print
"About to replace atom entry (" . $testatomentry2 .
") to " . $edit_iri .
"\n";
149 if (empty($testuser)) {
150 print
"As: anonymous\n";
152 print
"As: " . $testuser .
"\n";
154 $testdr = $testsac->replaceMetadata($edit_iri, $testuser, $testpw, $testobo, $testatomentry2,
false);
155 print
"Received HTTP status code: " . $testdr->sac_status .
156 " (" . $testdr->sac_statusmessage .
")\n";
158 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
166 print
"About to replace multipart atom entry and file (" . $testmultipart2 .
") to " . $edit_iri .
"\n";
167 if (empty($testuser)) {
168 print
"As: anonymous\n";
170 print
"As: " . $testuser .
"\n";
172 $testdr = $testsac->replaceMetadataAndFile($edit_iri, $testuser, $testpw, $testobo, $testmultipart2, $testpackaging,
false);
173 print
"Received HTTP status code: " . $testdr->sac_status .
174 " (" . $testdr->sac_statusmessage .
")\n";
176 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
184 print
"About to add file (" . $testextrafile .
") to " . $edit_media .
"\n";
185 if (empty($testuser)) {
186 print
"As: anonymous\n";
188 print
"As: " . $testuser .
"\n";
190 $testdr = $testsac->addExtraFileToMediaResource($edit_media, $testuser, $testpw, $testobo, $testextrafile, $testextrafiletype,
false);
191 print
"Received HTTP status code: " . $testdr->sac_status .
192 " (" . $testdr->sac_statusmessage .
")\n";
194 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
202 print
"About to add package (" . $testzipcontentfile .
") to " . $edit_iri .
"\n";
203 if (empty($testuser)) {
204 print
"As: anonymous\n";
206 print
"As: " . $testuser .
"\n";
208 $testdr = $testsac->addExtraPackage($edit_iri, $testuser, $testpw, $testobo, $testzipcontentfile, $testpackaging, $testcontenttype,
false);
209 print
"Received HTTP status code: " . $testdr->sac_status .
210 " (" . $testdr->sac_statusmessage .
")\n";
212 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
220 print
"About to add atom entry (" . $testatomentry2 .
") to " . $edit_iri .
"\n";
221 if (empty($testuser)) {
222 print
"As: anonymous\n";
224 print
"As: " . $testuser .
"\n";
226 $testdr = $testsac->addExtraAtomEntry($edit_iri, $testuser, $testpw, $testobo, $testatomentry2,
false);
227 print
"Received HTTP status code: " . $testdr->sac_status .
228 " (" . $testdr->sac_statusmessage .
")\n";
230 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
238 print
"About to add multipart atom entry and file (" . $testmultipart2 .
") to " . $edit_iri .
"\n";
239 if (empty($testuser)) {
240 print
"As: anonymous\n";
242 print
"As: " . $testuser .
"\n";
244 $testdr = $testsac->addExtraMultipartPackage($edit_iri, $testuser, $testpw, $testobo, $testmultipart2, $testpackaging,
false);
245 print
"Received HTTP status code: " . $testdr->sac_status .
246 " (" . $testdr->sac_statusmessage .
")\n";
248 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
277 print
"About to delete container at " . $edit_iri .
"\n";
278 if (empty($testuser)) {
279 print
"As: anonymous\n";
281 print
"As: " . $testuser .
"\n";
284 $deleteresponse = $testsac->deleteContainer($edit_iri, $testuser, $testpw, $testobo);
285 print
" - Container successfully deleted, HTTP code 204\n";
286 }
catch (Exception $e) {
287 echo $e->getMessage();
294 print
"About to deposit atom entry (" . $testatomentry .
") to " . $testdepositurl .
"\n";
295 if (empty($testuser)) {
296 print
"As: anonymous\n";
298 print
"As: " . $testuser .
"\n";
300 $testdr = $testsac->depositAtomEntry($testdepositurl, $testuser, $testpw, $testobo, $testatomentry,
false);
301 print
"Received HTTP status code: " . $testdr->sac_status .
302 " (" . $testdr->sac_statusmessage .
")\n";
304 if (($testdr->sac_status >= 200) || ($testdr->sac_status < 300)) {
310 $edit_iri = $testdr->sac_edit_iri;
311 $cont_iri = $testdr->sac_content_src;
312 $edit_media = $testdr->sac_edit_media_iri;
313 $statement_atom = $testdr->sac_state_iri_atom;
314 $statement_ore = $testdr->sac_state_iri_ore;
318 print
"About to retrieve deposit receipt from " . $edit_iri .
"\n";
319 if (empty($testuser)) {
320 print
"As: anonymous\n";
322 print
"As: " . $testuser .
"\n";
324 $testdr = $testsac->retrieveDepositReceipt($edit_iri, $testuser, $testpw, $testobo,
"http://purl.org/net/sword/package/SimpleZip");
325 print
"Received HTTP status code: " . $testsdr->sac_status .
" (" . $testsdr->sac_statusmessage .
")\n";
326 if ($testdr->sac_status == 200) {