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
Hardik Juneja
jio
Commits
acec7de4
Commit
acec7de4
authored
May 31, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correction for the second alldocs tests (include docs = true)
parent
864644a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
45 deletions
+13
-45
src/jio.storage/s3storage.js
src/jio.storage/s3storage.js
+9
-44
test/jiotests.js
test/jiotests.js
+4
-1
No files found.
src/jio.storage/s3storage.js
View file @
acec7de4
...
@@ -872,9 +872,12 @@ jIO.addStorageType("s3", function (spec, my) {
...
@@ -872,9 +872,12 @@ jIO.addStorageType("s3", function (spec, my) {
requestUTC
,
requestUTC
,
parse
,
parse
,
checkCounter
;
checkCounter
;
keys
=
$
(
mon_document
).
find
(
'
Key
'
);
keys
=
$
(
mon_document
).
find
(
'
Key
'
);
resultTable
=
[];
resultTable
=
[];
counter
=
0
;
counter
=
0
;
keys
.
each
(
function
(
index
)
{
keys
.
each
(
function
(
index
)
{
var
that
,
filename
,
docId
;
var
that
,
filename
,
docId
;
that
=
$
(
this
);
that
=
$
(
this
);
...
@@ -899,6 +902,7 @@ jIO.addStorageType("s3", function (spec, my) {
...
@@ -899,6 +902,7 @@ jIO.addStorageType("s3", function (spec, my) {
//needed to save the index within the $.ajax.success() callback
//needed to save the index within the $.ajax.success() callback
count
=
resultTable
.
length
-
1
;
count
=
resultTable
.
length
-
1
;
countB
=
0
;
countB
=
0
;
dealCallback
=
function
(
i
,
countB
,
allDoc
)
{
dealCallback
=
function
(
i
,
countB
,
allDoc
)
{
return
function
(
doc
,
statustext
,
response
)
{
return
function
(
doc
,
statustext
,
response
)
{
allDoc
.
rows
[
i
].
doc
=
response
.
responseText
;
allDoc
.
rows
[
i
].
doc
=
response
.
responseText
;
...
@@ -925,13 +929,16 @@ jIO.addStorageType("s3", function (spec, my) {
...
@@ -925,13 +929,16 @@ jIO.addStorageType("s3", function (spec, my) {
};
};
i
=
resultTable
.
length
-
1
;
i
=
resultTable
.
length
-
1
;
if
(
command
.
getOption
(
"
include_docs
"
)
===
true
)
{
if
(
command
.
getOption
(
"
include_docs
"
)
===
true
)
{
for
(
i
;
i
>=
0
;
i
-=
1
)
{
for
(
i
;
i
>=
0
;
i
-=
1
)
{
keyId
=
resultTable
[
i
];
keyId
=
resultTable
[
i
];
Signature
=
that
.
encodeAuthorization
(
keyId
);
Signature
=
that
.
encodeAuthorization
(
keyId
);
callURL
=
'
http://
'
+
priv
.
server
+
'
.s3.amazonaws.com/
'
+
keyId
;
callURL
=
'
http://
'
+
priv
.
server
+
'
.s3.amazonaws.com/
'
+
keyId
;
requestUTC
=
new
Date
().
toUTCString
();
requestUTC
=
new
Date
().
toUTCString
();
parse
=
true
;
parse
=
true
;
allDocResponse
.
rows
[
i
]
=
{
allDocResponse
.
rows
[
i
]
=
{
"
id
"
:
priv
.
fileNameToIds
(
keyId
).
join
(),
"
id
"
:
priv
.
fileNameToIds
(
keyId
).
join
(),
"
key
"
:
keyId
,
"
key
"
:
keyId
,
...
@@ -980,6 +987,7 @@ jIO.addStorageType("s3", function (spec, my) {
...
@@ -980,6 +987,7 @@ jIO.addStorageType("s3", function (spec, my) {
//XHRwrapper(command,'PUT','text/plain; charset=UTF-8',true);
//XHRwrapper(command,'PUT','text/plain; charset=UTF-8',true);
that
.
XHRwrapper
(
command
,
''
,
''
,
'
GET
'
,
mime
,
''
,
false
,
false
,
that
.
XHRwrapper
(
command
,
''
,
''
,
'
GET
'
,
mime
,
''
,
false
,
false
,
function
(
reponse
)
{
function
(
reponse
)
{
console
.
log
(
reponse
);
mon_document
=
reponse
;
mon_document
=
reponse
;
makeJSON
();
makeJSON
();
}
}
...
@@ -990,47 +998,4 @@ jIO.addStorageType("s3", function (spec, my) {
...
@@ -990,47 +998,4 @@ jIO.addStorageType("s3", function (spec, my) {
//fin alldocs
//fin alldocs
};
};
return
that
;
return
that
;
});
});
\ No newline at end of file
/*
// It is not possible to attach listeners to xhr level 2 events
// AND validate the Qunit tests through sinon.js
// therefore, below methods are deprecated
var S3specifics = {};
S3specifics.uploadProgress = function(evt){
if (evt.lengthComputable) {
var percentComplete = Math.round(evt.loaded * 100 / evt.total);
console.log(percentComplete.toString() + '%');
} else {
console.log('Unable to compute.');
}
};
S3specifics.uploadComplete = function(evt){
var evt_txt = evt.target.responseText;
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(evt_txt, "text/xml");
var responseURL = $(xmlDoc.getElementsByTagName('Location'))[0].text();
console.log(responseURL);
};
S3specifics.uploadFailed = function(evt){
var evt_txt = evt.target.responseText;
console.log("Erreur lors de la tentative d'upload : " + evt_txt);
};
S3specifics.uploadCanceled = function(evt){
console.log("Upload annulé par l'utilisateur ou le navigateur.");
};
S3specifics.onReadyStateChange = function(req, those, that) {
if (req.readyState === 4 && those.status === 200){
that.success({
ok: true,
id: command.getDocId()
});
}
};
*/
test/jiotests.js
View file @
acec7de4
...
@@ -7127,7 +7127,7 @@ test ("AllDocs", function(){
...
@@ -7127,7 +7127,7 @@ test ("AllDocs", function(){
);
);
o
.
server
.
respondWith
(
"
GET
"
,
o
.
server
.
respondWith
(
"
GET
"
,
"
http
s
://jiobucket.s3.amazonaws.com/documentONE
"
,
"
http://jiobucket.s3.amazonaws.com/documentONE
"
,
[
[
200
,
200
,
{
"
Content-Type
"
:
"
text/html
"
},
{
"
Content-Type
"
:
"
text/html
"
},
...
@@ -7148,8 +7148,11 @@ test ("AllDocs", function(){
...
@@ -7148,8 +7148,11 @@ test ("AllDocs", function(){
]
]
);
);
console
.
log
(
o
);
o
.
spy
(
o
,
"
jobstatus
"
,
"
done
"
,
"
AllDocs with include docs
"
);
o
.
spy
(
o
,
"
jobstatus
"
,
"
done
"
,
"
AllDocs with include docs
"
);
o
.
jio
.
allDocs
({
"
include_docs
"
:
true
},
o
.
f
);
o
.
jio
.
allDocs
({
"
include_docs
"
:
true
},
o
.
f
);
console
.
log
(
o
.
f
);
o
.
clock
.
tick
(
5000
);
o
.
clock
.
tick
(
5000
);
o
.
server
.
respond
();
o
.
server
.
respond
();
o
.
tick
(
o
);
o
.
tick
(
o
);
...
...
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