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
Vincent Bechu
jio
Commits
ddf61098
Commit
ddf61098
authored
Aug 23, 2017
by
Vincent Bechu
Committed by
Vincent Bechu
Aug 30, 2017
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Add scenarii to test and update saferepair storage to pass them
parent
5d6e60dd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
368 additions
and
307 deletions
+368
-307
examples/scenario.js
examples/scenario.js
+359
-296
examples/scenario_officejs.js
examples/scenario_officejs.js
+0
-8
src/jio.storage/saferepairstorage.js
src/jio.storage/saferepairstorage.js
+4
-3
test/tests.html
test/tests.html
+5
-0
No files found.
examples/scenario.js
View file @
ddf61098
/*global console, btoa, Blob*/
/*global console, btoa, Blob
, RSVP
*/
/*jslint nomen: true, maxlen: 200*/
/*jslint nomen: true, maxlen: 200*/
(
function
(
window
,
QUnit
,
jIO
,
rJS
)
{
(
function
(
window
,
QUnit
,
jIO
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
...
@@ -8,175 +8,21 @@
...
@@ -8,175 +8,21 @@
ok
=
QUnit
.
ok
,
ok
=
QUnit
.
ok
,
stop
=
QUnit
.
stop
,
stop
=
QUnit
.
stop
,
start
=
QUnit
.
start
,
start
=
QUnit
.
start
,
deepEqual
=
QUnit
.
deepEqual
;
module
=
QUnit
.
module
,
deepEqual
=
QUnit
.
deepEqual
,
global
=
{
defer
:
RSVP
.
defer
()};
rJS
(
window
)
rJS
(
window
)
.
ready
(
function
(
g
)
{
.
ready
(
function
()
{
///////////////////////////
// Local storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// type: "document",
// document_id: "/",
// sub_storage: {
// type: "zip",
// sub_storage: {
// type: "local"
// }
// }
// }
// }
// });
///////////////////////////
// Memory storage
///////////////////////////
return
g
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
union
"
,
storage_list
:
[{
type
:
"
memory
"
}]
}
}
});
///////////////////////////
// WebSQL storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// "type": "websql",
// "database": "test"
// }
// }
// });
///////////////////////////
// IndexedDB storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// "type": "indexeddb",
// "database": "test"
// }
// }
// });
///////////////////////////
// DAV storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// type: "drivetojiomapping",
// sub_storage: {
// "type": "dav",
// "url": "DAVURL",
// "basic_login": btoa("LOGIN:PASSWD")
// }
// }
// }
// });
///////////////////////////
// Dropbox storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// type: "drivetojiomapping",
// sub_storage: {
// "type": "dropbox",
// "access_token" : "TOKEN",
// "root" : "dropbox"
// }
// }
// }
// });
///////////////////////////
// Qiniu storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// "type": "qiniu",
// "bucket": "BUCKET",
// "access_key": "ACCESSKEY",
// "secret_key": "SECRETKEY"
// }
// }
// });
///////////////////////////
// Replicate storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// type: "replicate",
// local_sub_storage: {
// type: "memory"
// },
// remote_sub_storage: {
// "type": "memory"
// }
// }
// }
// });
///////////////////////////
// Crypt storage
///////////////////////////
// return g.run({
// type: "query",
// sub_storage: {
// type: "uuid",
// sub_storage: {
// type: "crypt",
// key: {"alg": "A256GCM", "ext": true,
// "k": "seeaLzpu8dHG07bO2ANH2GywbTqs_zrs4Vq8zmtYeE4",
// "key_ops": ["encrypt", "decrypt"], "kty": "oct"},
// sub_storage: {
// type: "indexeddb",
// database: "test427"
// }
// }
// }
// });
global
.
gadget
=
this
;
global
.
defer
.
resolve
();
})
})
.
declareMethod
(
'
run
'
,
function
(
jio_options
)
{
.
declareMethod
(
'
run
'
,
function
(
jio_options
)
{
test
(
'
Test "
'
+
jio_options
.
type
+
'
"scenario
'
,
function
()
{
var
jio
;
var
jio
;
stop
();
expect
(
14
);
try
{
try
{
jio
=
jIO
.
createJIO
(
jio_options
);
jio
=
jIO
.
createJIO
(
jio_options
);
...
@@ -336,6 +182,223 @@
...
@@ -336,6 +182,223 @@
start
();
start
();
});
});
});
});
module
(
"
scenario
"
);
///////////////////////////
// Memory storage
///////////////////////////
test
(
'
Test Memory Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
union
"
,
storage_list
:
[{
type
:
"
memory
"
}]
}
}
});
});
});
///////////////////////////
// Local storage
///////////////////////////
test
(
'
Test Local Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
document
"
,
document_id
:
"
/
"
,
sub_storage
:
{
type
:
"
zip
"
,
sub_storage
:
{
type
:
"
local
"
}
}
}
}
});
});
});
///////////////////////////
// WebSQL storage
///////////////////////////
test
(
'
Test WebSQL Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
"
type
"
:
"
websql
"
,
"
database
"
:
"
test
"
}
}
});
});
});
///////////////////////////
// IndexedDB storage
///////////////////////////
test
(
'
Test IndexedDB Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
"
type
"
:
"
indexeddb
"
,
"
database
"
:
"
test
"
}
}
});
});
});
///////////////////////////
// DAV storage
///////////////////////////
test
(
'
Test DAV Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
drivetojiomapping
"
,
sub_storage
:
{
"
type
"
:
"
dav
"
,
"
url
"
:
"
DAVURL
"
,
"
basic_login
"
:
btoa
(
"
LOGIN:PASSWD
"
)
}
}
}
});
});
});
///////////////////////////
// Dropbox storage
///////////////////////////
test
(
'
Test Dropbox Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
drivetojiomapping
"
,
sub_storage
:
{
"
type
"
:
"
dropbox
"
,
"
access_token
"
:
"
TOKEN
"
,
"
root
"
:
"
dropbox
"
}
}
}
});
});
});
///////////////////////////
// Qiniu storage
///////////////////////////
/*
test('Test Qiniu Storage scenario', function () {
stop();
expect(14);
return global.defer.promise
.then(function () {
return global.gadget.run({
type: "query",
sub_storage: {
type: "uuid",
sub_storage: {
"type": "qiniu",
"bucket": "BUCKET",
"access_key": "ACCESSKEY",
"secret_key": "SECRETKEY"
}
}
});
});
});
*/
///////////////////////////
// Replicate storage
///////////////////////////
test
(
'
Test Replicate Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
replicate
"
,
local_sub_storage
:
{
type
:
"
memory
"
},
remote_sub_storage
:
{
"
type
"
:
"
memory
"
}
}
}
});
});
});
///////////////////////////
// Crypt storage
///////////////////////////
test
(
'
Test Crypt Storage scenario
'
,
function
()
{
stop
();
expect
(
14
);
return
global
.
defer
.
promise
.
then
(
function
()
{
return
global
.
gadget
.
run
({
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
crypt
"
,
key
:
{
"
alg
"
:
"
A256GCM
"
,
"
ext
"
:
true
,
"
k
"
:
"
seeaLzpu8dHG07bO2ANH2GywbTqs_zrs4Vq8zmtYeE4
"
,
"
key_ops
"
:
[
"
encrypt
"
,
"
decrypt
"
],
"
kty
"
:
"
oct
"
},
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
test427
"
}
}
}
});
});
});
});
}(
window
,
QUnit
,
jIO
,
rJS
));
}(
window
,
QUnit
,
jIO
,
rJS
,
RSVP
));
examples/scenario_officejs.js
View file @
ddf61098
...
@@ -12,13 +12,8 @@
...
@@ -12,13 +12,8 @@
module
=
QUnit
.
module
,
module
=
QUnit
.
module
,
ATTACHMENT
=
'
data
'
,
ATTACHMENT
=
'
data
'
,
i
,
i
,
<<<<<<<
HEAD
name_list
=
[
'
get
'
,
'
post
'
,
'
put
'
,
'
buildQuery
'
,
=======
name_list
=
[
'
get
'
,
'
post
'
,
'
put
'
,
'
remove
'
,
'
buildQuery
'
,
name_list
=
[
'
get
'
,
'
post
'
,
'
put
'
,
'
remove
'
,
'
buildQuery
'
,
>>>>>>>
7
ed9424
...
Scenario
:
init
officejs
scenario
'
putAttachment
'
,
'
getAttachment
'
,
'
allAttachments
'
];
'
putAttachment
'
,
'
getAttachment
'
,
'
allAttachments
'
];
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// Fake Storage
// Fake Storage
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
...
@@ -154,11 +149,8 @@
...
@@ -154,11 +149,8 @@
check_remote_attachment_creation
:
true
,
check_remote_attachment_creation
:
true
,
check_remote_attachment_deletion
:
true
,
check_remote_attachment_deletion
:
true
,
check_local_deletion
:
false
,
check_local_deletion
:
false
,
<<<<<<<
HEAD
parallel_operation_amount
:
10
,
parallel_operation_amount
:
10
,
parallel_operation_attachment_amount
:
10
,
parallel_operation_attachment_amount
:
10
,
=======
>>>>>>>
7
ed9424
...
Scenario
:
init
officejs
scenario
local_sub_storage
:
{
local_sub_storage
:
{
type
:
"
query
"
,
type
:
"
query
"
,
sub_storage
:
{
sub_storage
:
{
...
...
src/jio.storage/saferepairstorage.js
View file @
ddf61098
/*jslint nomen: true*/
/*jslint indent:2,maxlen:80,nomen:true*/
(
function
(
jIO
)
{
/*global jIO, RSVP*/
(
function
(
jIO
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
/**
/**
...
@@ -88,4 +89,4 @@
...
@@ -88,4 +89,4 @@
jIO
.
addStorage
(
'
saferepair
'
,
SafeRepairStorage
);
jIO
.
addStorage
(
'
saferepair
'
,
SafeRepairStorage
);
}(
jIO
));
}(
jIO
,
RSVP
));
test/tests.html
View file @
ddf61098
...
@@ -53,6 +53,11 @@
...
@@ -53,6 +53,11 @@
<script
src=
"jio.storage/zipstorage.tests.js"
></script>
<script
src=
"jio.storage/zipstorage.tests.js"
></script>
<script
src=
"jio.storage/gdrivestorage.tests.js"
></script>
<script
src=
"jio.storage/gdrivestorage.tests.js"
></script>
<script
src=
"jio.storage/websqlstorage.tests.js"
></script>
<script
src=
"jio.storage/websqlstorage.tests.js"
></script>
<script
src=
"../node_modules/renderjs/dist/renderjs-latest.js"
></script>
<script
src=
"../examples/scenario.js"
></script>
<script
src=
"../examples/scenario_officejs.js"
></script>
<!--script src="../lib/jquery/jquery.min.js"></script>
<!--script src="../lib/jquery/jquery.min.js"></script>
<script src="../src/jio.storage/xwikistorage.js"></script>
<script src="../src/jio.storage/xwikistorage.js"></script>
<script src="jio.storage/xwikistorage.tests.js"></script-->
<script src="jio.storage/xwikistorage.tests.js"></script-->
...
...
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