Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
Xiaohe Cao
jio
Commits
aaa2641c
Commit
aaa2641c
authored
Jan 14, 2014
by
Jonathan Rivalan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
maj tests unitaires
parent
74f6eb98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
48 deletions
+56
-48
src/jio.storage/s3storage.js
src/jio.storage/s3storage.js
+50
-42
test/jio.storage/s3storage.livetests.html
test/jio.storage/s3storage.livetests.html
+4
-4
test/jio.storage/s3storage.tests.js
test/jio.storage/s3storage.tests.js
+2
-2
No files found.
src/jio.storage/s3storage.js
View file @
aaa2641c
...
@@ -295,6 +295,12 @@
...
@@ -295,6 +295,12 @@
jio
,
jio
,
isAttachment
,
isAttachment
,
callback
)
{
callback
)
{
console
.
log
(
command
)
console
.
log
(
obj
)
console
.
log
(
http
)
console
.
log
(
jio
)
console
.
log
(
isAttachment
)
console
.
log
(
callback
)
obj
.
onreadystatechange
=
function
()
{
obj
.
onreadystatechange
=
function
()
{
var
response
,
err
=
''
;
var
response
,
err
=
''
;
if
(
obj
.
readyState
===
4
)
{
if
(
obj
.
readyState
===
4
)
{
...
@@ -527,9 +533,6 @@
...
@@ -527,9 +533,6 @@
doc
=
metadata
;
doc
=
metadata
;
doc_id
=
doc
.
_id
;
doc_id
=
doc
.
_id
;
console
.
log
(
doc
);
console
.
log
(
doc_id
);
function
postDocument
()
{
function
postDocument
()
{
var
http_response
,
fd
,
Signature
,
xhr
;
var
http_response
,
fd
,
Signature
,
xhr
;
doc_id
=
priv
.
secureName
(
priv
.
idsToFileName
(
doc_id
));
doc_id
=
priv
.
secureName
(
priv
.
idsToFileName
(
doc_id
));
...
@@ -581,6 +584,7 @@
...
@@ -581,6 +584,7 @@
if
(
response
===
'
404
'
)
{
if
(
response
===
'
404
'
)
{
postDocument
();
postDocument
();
}
else
{
}
else
{
console
.
log
(
'
ERROR!
'
);
//si ce n'est pas une 404,
//si ce n'est pas une 404,
//alors on renvoit une erreur 405
//alors on renvoit une erreur 405
return
command
.
error
(
return
command
.
error
(
...
@@ -964,46 +968,50 @@
...
@@ -964,46 +968,50 @@
i
=
resultTable
.
length
-
1
;
i
=
resultTable
.
length
-
1
;
if
(
command
.
getOption
(
"
include_docs
"
)
===
true
)
{
for
(
i
;
i
>=
0
;
i
-=
1
)
{
keyId
=
resultTable
[
i
];
Signature
=
that
.
encodeAuthorization
(
keyId
);
callURL
=
'
http://
'
+
priv
.
server
+
'
.s3.amazonaws.com/
'
+
keyId
;
requestUTC
=
new
Date
().
toUTCString
();
parse
=
true
;
allDocResponse
.
rows
[
i
]
=
{
"
id
"
:
priv
.
fileNameToIds
(
keyId
).
join
(),
// if (command.getOption("include_docs") === true) {
"
key
"
:
keyId
,
"
value
"
:
{}
// for (i; i >= 0; i -= 1) {
};
// keyId = resultTable[i];
checkCounter
=
i
;
// Signature = that.encodeAuthorization(keyId);
// callURL = 'http://' + priv.server + '.s3.amazonaws.com/' + keyId;
$
.
ajax
({
// requestUTC = new Date().toUTCString();
contentType
:
''
,
// parse = true;
crossdomain
:
true
,
url
:
callURL
,
// allDocResponse.rows[i] = {
type
:
'
GET
'
,
// "id": priv.fileNameToIds(keyId).join(),
headers
:
{
// "key": keyId,
'
Authorization
'
:
"
AWS
"
// "value": {}
+
"
"
// };
+
priv
.
AWSIdentifier
// checkCounter = i;
+
"
:
"
+
Signature
,
// $.ajax({
'
x-amz-date
'
:
requestUTC
,
// contentType : '',
'
Content-Type
'
:
'
application/json
'
// crossdomain : true,
//'Content-MD5' : ''
// url : callURL,
//'Content-Length' : ,
// type : 'GET',
//'Expect' : ,
// headers : {
//'x-amz-security-token' : ,
// 'Authorization' : "AWS"
},
// + " "
success
:
dealCallback
(
i
,
countB
,
allDocResponse
),
// + priv.AWSIdentifier
error
:
errCallback
(
command
.
error
)
// + ":"
});
// + Signature,
countB
+=
1
;
// 'x-amz-date' : requestUTC,
}
// 'Content-Type' : 'application/json'
}
else
{
// //'Content-MD5' : ''
// //'Content-Length' : ,
// //'Expect' : ,
// //'x-amz-security-token' : ,
// },
// success : dealCallback(i, countB, allDocResponse),
// error : errCallback(command.error)
// });
// countB += 1;
// }
// }
//else {
for
(
i
;
i
>=
0
;
i
-=
1
)
{
for
(
i
;
i
>=
0
;
i
-=
1
)
{
keyId
=
resultTable
[
i
];
keyId
=
resultTable
[
i
];
allDocResponse
.
rows
[
i
]
=
{
allDocResponse
.
rows
[
i
]
=
{
...
@@ -1013,7 +1021,7 @@
...
@@ -1013,7 +1021,7 @@
};
};
}
}
command
.
success
(
allDocResponse
);
command
.
success
(
allDocResponse
);
}
//
}
}
}
function
getXML
()
{
function
getXML
()
{
...
...
test/jio.storage/s3storage.livetests.html
View file @
aaa2641c
...
@@ -27,10 +27,10 @@ location.href.split('?')[1].split('&').forEach(function (item) {
...
@@ -27,10 +27,10 @@ location.href.split('?')[1].split('&').forEach(function (item) {
<h3>
JIO initialization
</h3>
<h3>
JIO initialization
</h3>
<form
method=
"get"
action=
""
>
<form
method=
"get"
action=
""
>
<input
type=
"hidden"
name=
"type"
value=
"s3"
/>
<input
type=
"hidden"
name=
"type"
value=
"s3"
/>
<input
type=
"text"
name=
"url"
placeholder=
"URL"
/>
<input
type=
"text"
name=
"url"
placeholder=
"URL"
value=
"https://jiobucket.s3.amazonaws.com"
/>
<input
type=
"text"
name=
"server"
placeholder=
"Bucket"
/>
<input
type=
"text"
name=
"server"
placeholder=
"Bucket"
value=
"jiobucket"
/>
<input
type=
"text"
name=
"AWSIdentifier"
placeholder=
"AWSIdentifier"
/>
<input
type=
"text"
name=
"AWSIdentifier"
placeholder=
"AWSIdentifier"
value=
"AKIAJLNYGVLTV66RHPEQ"
/>
<input
type=
"password"
name=
"password"
placeholder=
"Password"
/>
<input
type=
"password"
name=
"password"
placeholder=
"Password"
value=
"/YHoa5r2X6EUHfvP31jdYx6t75h81pAjIZ4Mt94y"
/>
<input
type=
"submit"
value=
"Run Tests"
/>
<input
type=
"submit"
value=
"Run Tests"
/>
</form>
</form>
<br
/>
<br
/>
...
...
test/jio.storage/s3storage.tests.js
View file @
aaa2641c
...
@@ -926,13 +926,13 @@
...
@@ -926,13 +926,13 @@
// post b 201
// post b 201
then
(
postSpecificDocument
).
then
(
postSpecificDocumentTest
).
then
(
postSpecificDocument
).
then
(
postSpecificDocumentTest
).
// allD 200 2 documents
// allD 200 2 documents
then
(
listDocuments
).
then
(
list2DocumentsTest
).
//
then(listDocuments).then(list2DocumentsTest).
// remove a 204
// remove a 204
then
(
removeCreatedDocument
).
then
(
removeCreatedDocumentTest
).
then
(
removeCreatedDocument
).
then
(
removeCreatedDocumentTest
).
// remove b 204
// remove b 204
then
(
removeSpecificDocument
).
then
(
removeSpecificDocumentTest
).
then
(
removeSpecificDocument
).
then
(
removeSpecificDocumentTest
).
// allD 200 empty storage
// allD 200 empty storage
then
(
listEmptyStorage
).
then
(
listEmptyStorageTest
).
//
then(listEmptyStorage).then(listEmptyStorageTest).
// # Create and update documents, and some attachment and remove them
// # Create and update documents, and some attachment and remove them
// put 201
// put 201
then
(
putNewDocument
).
then
(
putNewDocumentTest
).
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