Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
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
Alexandra Rogova
jio_mebibou
Commits
e4bd6802
Commit
e4bd6802
authored
Jan 15, 2014
by
Jonathan Rivalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction for the alldocs methods in s3storage.js + validation for the tests
parent
aaa2641c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
99 deletions
+30
-99
src/jio.storage/s3storage.js
src/jio.storage/s3storage.js
+22
-10
test/jio.storage/s3storage.tests.js
test/jio.storage/s3storage.tests.js
+8
-89
No files found.
src/jio.storage/s3storage.js
View file @
e4bd6802
...
...
@@ -295,12 +295,6 @@
jio
,
isAttachment
,
callback
)
{
console
.
log
(
command
)
console
.
log
(
obj
)
console
.
log
(
http
)
console
.
log
(
jio
)
console
.
log
(
isAttachment
)
console
.
log
(
callback
)
obj
.
onreadystatechange
=
function
()
{
var
response
,
err
=
''
;
if
(
obj
.
readyState
===
4
)
{
...
...
@@ -584,7 +578,6 @@
if
(
response
===
'
404
'
)
{
postDocument
();
}
else
{
console
.
log
(
'
ERROR!
'
);
//si ce n'est pas une 404,
//alors on renvoit une erreur 405
return
command
.
error
(
...
...
@@ -933,7 +926,6 @@
allDocResponse
=
{
// document content will be added to response
"
total_rows
"
:
resultTable
.
length
,
"
offset
"
:
0
,
"
rows
"
:
[]
};
...
...
@@ -1016,11 +1008,32 @@
keyId
=
resultTable
[
i
];
allDocResponse
.
rows
[
i
]
=
{
"
id
"
:
priv
.
fileNameToIds
(
keyId
).
join
(),
"
key
"
:
keyId
,
"
value
"
:
{}
};
}
// allDocResponse = {
// "data": {
// "total_rows": 2,
// "rows": [{
// "id": "lol",
// "value": {}
// }, {
// "id": "b",
// "value": {}
// }]
// },
// "method": "allDocs",
// "result": "success",
// "status": 200,
// "statusText": "Ok"
// };
allDocResponse
=
{
"
data
"
:
allDocResponse
};
command
.
success
(
allDocResponse
);
//}
}
...
...
@@ -1033,7 +1046,6 @@
}
);
}
getXML
();
//fin alldocs
};
...
...
test/jio.storage/s3storage.tests.js
View file @
e4bd6802
...
...
@@ -9,7 +9,6 @@
if
(
typeof
s3storage_spec
===
'
object
'
)
{
use_fake_server
=
false
;
spec
=
s3storage_spec
;
console
.
log
(
spec
);
}
else
{
spec
=
dav_storage
.
createDescription
(
"
http://localhost
"
,
...
...
@@ -121,92 +120,10 @@
}
function
listDocuments
()
{
//quelle utilité à pousser le xml ?
responses
.
push
([
207
,
{
"
Content-Type
"
:
"
text/xml
"
},
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<D:multistatus xmlns:D="DAV:">
'
+
'
<D:response xmlns:lp2="http://apache.
'
+
'
org/dav/props/" xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype><D:collection/></lp1:resourcetype>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"240be-1000-4e6bb383e5fbb"</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:lp2="http://apache.org/dav/props/"
'
+
'
xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/
'
+
shared
.
created_document_id
+
'
</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>66</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"20529-42-4e6bb383d0d30"</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:lp2="http://apache.org/dav/props/"
'
+
'
xmlns:lp1="DAV:">
'
+
'
<D:href>/uploads/b</D:href>
'
+
'
<D:propstat>
'
+
'
<D:prop>
'
+
'
<lp1:resourcetype/>
'
+
'
<lp1:creationdate>2013-09-19T11:54:43Z</lp1:creationdate>
'
+
'
<lp1:getcontentlength>25</lp1:getcontentlength>
'
+
'
<lp1:getlastmodified>Thu, 19 Sep 2013 11:54:43 GMT
'
+
'
</lp1:getlastmodified>
'
+
'
<lp1:getetag>"20da3-19-4e6bb383e5fbb"</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>
'
200
,
{
"
Content-Type
"
:
"
text/xml
"
},
''
]);
// PROPFIND
return
jio
.
allDocs
();
}
...
...
@@ -279,7 +196,7 @@
function
listEmptyStorage
()
{
responses
.
push
([
20
7
,
20
0
,
{
"
Content-Type
"
:
"
text/xml
"
},
'
<?xml version="1.0" encoding="utf-8"?>
'
+
'
<D:multistatus xmlns:D="DAV:">
'
+
...
...
@@ -925,14 +842,16 @@
then
(
getCreatedDocument
).
then
(
getCreatedDocumentTest
).
// post b 201
then
(
postSpecificDocument
).
then
(
postSpecificDocumentTest
).
//postSpecificDocument().then(postSpecificDocumentTest).
// allD 200 2 documents
//then(listDocuments).then(list2DocumentsTest).
then
(
listDocuments
).
then
(
list2DocumentsTest
).
//listDocuments().then(list2DocumentsTest).
// remove a 204
then
(
removeCreatedDocument
).
then
(
removeCreatedDocumentTest
).
// remove b 204
then
(
removeSpecificDocument
).
then
(
removeSpecificDocumentTest
).
// allD 200 empty storage
//
then(listEmptyStorage).then(listEmptyStorageTest).
then
(
listEmptyStorage
).
then
(
listEmptyStorageTest
).
// # Create and update documents, and some attachment and remove them
// put 201
then
(
putNewDocument
).
then
(
putNewDocumentTest
).
...
...
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