Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mukul
jio
Commits
0c33f817
Commit
0c33f817
authored
Oct 30, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check and repair added to davstorage.js
parent
c49462b8
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
468 additions
and
4 deletions
+468
-4
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+330
-0
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+138
-4
No files found.
src/jio.storage/davstorage.js
View file @
0c33f817
This diff is collapsed.
Click to expand it.
test/jio.storage/davstorage.tests.js
View file @
0c33f817
...
...
@@ -62,7 +62,7 @@
* X-Requested-With, X-HTTP-Method-Override, Accept, Authorization,
* Depth"
*/
test
(
"
Scenario
"
,
3
0
,
function
()
{
test
(
"
Scenario
"
,
3
2
,
function
()
{
var
server
,
responses
=
[],
shared
=
{},
jio
=
jIO
.
createJIO
(
spec
,
{
"
workspace
"
:
{},
...
...
@@ -218,6 +218,138 @@
},
"
Post specific document
"
);
}
function
checkDocument
()
{
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
},
JSON
.
stringify
({
"
_id
"
:
"
b
"
,
"
title
"
:
"
Bee
"
})]);
// GET
return
jio
.
check
({
"
_id
"
:
"
b
"
});
}
function
checkDocumentTest
(
answer
)
{
deepEqual
(
answer
,
{
"
id
"
:
"
b
"
,
"
method
"
:
"
check
"
,
"
result
"
:
"
success
"
,
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
},
"
Check specific document
"
);
}
function
checkStorage
()
{
responses
.
push
([
207
,
{
"
Content-Type
"
:
"
text/xml
"
},
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<D:multistatus xmlns:D="DAV:">
'
+
'
<D:response xmlns:lp1="DAV:"
'
+
'
xmlns:lp2="http://apache.org/dav/props/">
'
+
'
<D:href>/uploads/</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype><D:collection/></lp1:resourcetype>
'
+
'
<lp1:creationdate>2013-10-30T17:19:46Z</lp1:creationdate>
'
+
'
<lp1:getlastmodified>Wed, 30 Oct 2013 17:19:46 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"240be-1000-4e9f88a305c4e"</lp1:getetag>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
<D:getcontenttype>httpd/unix-directory</D:getcontenttype>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
<D:response xmlns:lp1="DAV:"
'
+
'
xmlns:lp2="http://apache.org/dav/props/">
'
+
'
<D:href>/uploads/
'
+
shared
.
created_document_id
+
'
</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-10-30T17:19:46Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>66</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Wed, 30 Oct 2013 17:19:46 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"20568-42-4e9f88a2ea198"</lp1:getetag>
'
+
'
<lp2:executable>F</lp2:executable>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
<D:response xmlns:lp1="DAV:"
'
+
'
xmlns:lp2="http://apache.org/dav/props/">
'
+
'
<D:href>/uploads/b</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-10-30T17:19:46Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>25</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Wed, 30 Oct 2013 17:19:46 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"21226-19-4e9f88a305c4e"</lp1:getetag>
'
+
'
<lp2:executable>F</lp2:executable>
'
+
'
<D:supportedlock>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:exclusive/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
<D:lockentry>
'
+
'
<D:lockscope><D:shared/></D:lockscope>
'
+
'
<D:locktype><D:write/></D:locktype>
'
+
'
</D:lockentry>
'
+
'
</D:supportedlock>
'
+
'
<D:lockdiscovery/>
'
+
'
</D:prop>
'
+
'
<D:status>HTTP/1.1 200 OK</D:status>
'
+
'
</D:propstat>
'
+
'
</D:response>
'
+
'
</D:multistatus>
'
]);
// PROPFIND
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
},
JSON
.
stringify
({
"
_id
"
:
shared
.
created_document_id
,
"
title
"
:
"
Unique ID
"
})]);
// GET
responses
.
push
([
200
,
{
"
Content-Type
"
:
"
application/octet-stream
"
},
JSON
.
stringify
({
"
_id
"
:
"
b
"
,
"
title
"
:
"
Bee
"
})]);
// GET
return
jio
.
check
({});
}
function
checkStorageTest
(
answer
)
{
deepEqual
(
answer
,
{
"
method
"
:
"
check
"
,
"
result
"
:
"
success
"
,
"
status
"
:
204
,
"
statusText
"
:
"
No Content
"
},
"
Check storage state
"
);
}
function
listDocuments
()
{
responses
.
push
([
207
,
...
...
@@ -1023,6 +1155,10 @@
then
(
getCreatedDocument
).
then
(
getCreatedDocumentTest
).
// post b 201
then
(
postSpecificDocument
).
then
(
postSpecificDocumentTest
).
// check b 204
then
(
checkDocument
).
then
(
checkDocumentTest
).
// check storage 204
then
(
checkStorage
).
then
(
checkStorageTest
).
// allD 200 2 documents
then
(
listDocuments
).
then
(
list2DocumentsTest
).
// remove a 204
...
...
@@ -1069,9 +1205,7 @@
then
(
getInexistentDocument
).
then
(
getInexistentDocumentTest
).
// remove 404
then
(
removeInexistentDocument
).
then
(
removeInexistentDocumentTest
).
// check 204
//then(checkDocument).done(checkDocumentTest).
//then(checkStorage).done(checkStorageTest).
// end
fail
(
unexpectedError
).
always
(
start
).
always
(
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment