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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
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 @@
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
)
{
...
...
@@ -527,9 +533,6 @@
doc
=
metadata
;
doc_id
=
doc
.
_id
;
console
.
log
(
doc
);
console
.
log
(
doc_id
);
function
postDocument
()
{
var
http_response
,
fd
,
Signature
,
xhr
;
doc_id
=
priv
.
secureName
(
priv
.
idsToFileName
(
doc_id
));
...
...
@@ -581,6 +584,7 @@
if
(
response
===
'
404
'
)
{
postDocument
();
}
else
{
console
.
log
(
'
ERROR!
'
);
//si ce n'est pas une 404,
//alors on renvoit une erreur 405
return
command
.
error
(
...
...
@@ -964,46 +968,50 @@
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
(),
"
key
"
:
keyId
,
"
value
"
:
{}
};
checkCounter
=
i
;
$
.
ajax
({
contentType
:
''
,
crossdomain
:
true
,
url
:
callURL
,
type
:
'
GET
'
,
headers
:
{
'
Authorization
'
:
"
AWS
"
+
"
"
+
priv
.
AWSIdentifier
+
"
:
"
+
Signature
,
'
x-amz-date
'
:
requestUTC
,
'
Content-Type
'
:
'
application/json
'
//'Content-MD5' : ''
//'Content-Length' : ,
//'Expect' : ,
//'x-amz-security-token' : ,
},
success
:
dealCallback
(
i
,
countB
,
allDocResponse
),
error
:
errCallback
(
command
.
error
)
});
countB
+=
1
;
}
}
else
{
// 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(),
// "key": keyId,
// "value": {}
// };
// checkCounter = i;
// $.ajax({
// contentType : '',
// crossdomain : true,
// url : callURL,
// type : 'GET',
// headers : {
// 'Authorization' : "AWS"
// + " "
// + priv.AWSIdentifier
// + ":"
// + Signature,
// 'x-amz-date' : requestUTC,
// 'Content-Type' : 'application/json'
// //'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
)
{
keyId
=
resultTable
[
i
];
allDocResponse
.
rows
[
i
]
=
{
...
...
@@ -1013,7 +1021,7 @@
};
}
command
.
success
(
allDocResponse
);
}
//
}
}
function
getXML
()
{
...
...
test/jio.storage/s3storage.livetests.html
View file @
aaa2641c
...
...
@@ -27,10 +27,10 @@ location.href.split('?')[1].split('&').forEach(function (item) {
<h3>
JIO initialization
</h3>
<form
method=
"get"
action=
""
>
<input
type=
"hidden"
name=
"type"
value=
"s3"
/>
<input
type=
"text"
name=
"url"
placeholder=
"URL"
/>
<input
type=
"text"
name=
"server"
placeholder=
"Bucket"
/>
<input
type=
"text"
name=
"AWSIdentifier"
placeholder=
"AWSIdentifier"
/>
<input
type=
"password"
name=
"password"
placeholder=
"Password"
/>
<input
type=
"text"
name=
"url"
placeholder=
"URL"
value=
"https://jiobucket.s3.amazonaws.com"
/>
<input
type=
"text"
name=
"server"
placeholder=
"Bucket"
value=
"jiobucket"
/>
<input
type=
"text"
name=
"AWSIdentifier"
placeholder=
"AWSIdentifier"
value=
"AKIAJLNYGVLTV66RHPEQ"
/>
<input
type=
"password"
name=
"password"
placeholder=
"Password"
value=
"/YHoa5r2X6EUHfvP31jdYx6t75h81pAjIZ4Mt94y"
/>
<input
type=
"submit"
value=
"Run Tests"
/>
</form>
<br
/>
...
...
test/jio.storage/s3storage.tests.js
View file @
aaa2641c
...
...
@@ -926,13 +926,13 @@
// post b 201
then
(
postSpecificDocument
).
then
(
postSpecificDocumentTest
).
// allD 200 2 documents
then
(
listDocuments
).
then
(
list2DocumentsTest
).
//
then(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