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
f89b3df8
Commit
f89b3df8
authored
Jan 23, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexStorage: POST new API and qunit tests
parent
a9c06bba
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
418 additions
and
109 deletions
+418
-109
src/jio.storage/indexstorage.js
src/jio.storage/indexstorage.js
+357
-85
test/jiotests.js
test/jiotests.js
+58
-23
test/jiotests_withoutrequirejs.html
test/jiotests_withoutrequirejs.html
+3
-1
No files found.
src/jio.storage/indexstorage.js
View file @
f89b3df8
This diff is collapsed.
Click to expand it.
test/jiotests.js
View file @
f89b3df8
...
...
@@ -2619,9 +2619,64 @@ test ('Remove document', function () {
o.mytest('DummyStorageAllOK,3tries: remove document.',{ok:true,id:'file'});
o.jio.stop();
});
*/
module
(
"
Jio IndexStorage
"
);
test
(
"
Post
"
,
function
()
{
var
o
=
generateTools
(
this
);
o
.
jio
=
JIO
.
newJio
({
"
type
"
:
"
indexed
"
,
"
indices
"
:
[{
"
name
"
:
"
indexA
"
,
"
fields
"
:[
"
findMeA
"
]
},{
"
name
"
:
"
indexAB
"
,
"
fields
"
:[
"
findMeA
"
,
"
findMeB
"
]
}],
"
sub_storage
"
:
{
"
type
"
:
"
local
"
,
"
username
"
:
"
ipost
"
,
"
application_name
"
:
"
ipost
"
}
});
// post without id
o
.
spy
(
o
,
"
status
"
,
undefined
,
"
Post without id
"
);
o
.
jio
.
post
({},
o
.
f
);
o
.
tick
(
o
);
// post non empty document
o
.
doc
=
{
"
_id
"
:
"
some_id
"
,
"
title
"
:
"
myPost1
"
,
"
findMeA
"
:
"
keyword_abc
"
,
"
findMeB
"
:
"
keyword_def
"
};
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
some_id
"
},
"
Post document
"
);
o
.
jio
.
post
(
o
.
doc
,
o
.
f
);
o
.
tick
(
o
);
module ('Jio IndexedStorage');
// check document
o
.
indexPost
=
{
"
indexAB
"
:
{
"
keyword_abc
"
:[
"
some_id
"
],
"
keyword_def
"
:[
"
some_id
"
]},
"
indexA
"
:
{
"
keyword_abc
"
:[
"
some_id
"
]}
};
deepEqual
(
o
.
jio
.
get
(
"
ipost_indices.json
"
),
o
.
indexPost
,
"
Check index file
"
);
// post and document already exists
o
.
doc
=
{
"
_id
"
:
"
some_id
"
,
"
title
"
:
"
myPost2
"
,
"
findMeA
"
:
"
keyword_ghi
"
,
"
findMeB
"
:
"
keyword_jkl
"
}
o
.
spy
(
o
,
"
status
"
,
409
,
"
Post and document already exists
"
);
o
.
jio
.
post
(
o
.
doc
,
o
.
f
);
o
.
tick
(
o
);
o
.
jio
.
stop
();
});
/*
test ('Document load', function () {
var o = {}; o.clock = this.sandbox.useFakeTimers();
o.clock.tick(base_tick);
...
...
@@ -2665,27 +2720,6 @@ test ('Document load', function () {
o.jio.stop();
});
test ('Document save', function () {
var o = {}; o.clock = this.sandbox.useFakeTimers();
o.clock.tick(base_tick);
o.jio = JIO.newJio({type:'indexed',
storage:{type:'dummyall3tries',
username:'indexsave'}});
o.f = function (err,val) {
if (err) {
err = err.status;
}
deepEqual (err || val,{ok:true,id:'file'},'document save');
};
this.spy(o,'f');
o.jio.put({_id:'file',content:'content'},{max_retry:3},o.f);
o.clock.tick(2000);
if (!o.f.calledOnce){
ok (false, 'no response / too much results');
}
o.jio.stop();
});
test ('Get document list', function () {
var o = {}; o.clock = this.sandbox.useFakeTimers();
o.clock.tick(base_tick);
...
...
@@ -2742,7 +2776,8 @@ test ('Remove document', function () {
o.jio.stop();
});
*/
/*
module ('Jio CryptedStorage');
test ('Document save' , function () {
...
...
test/jiotests_withoutrequirejs.html
View file @
f89b3df8
...
...
@@ -28,9 +28,11 @@
src=
"../src/jio.storage/replicaterevisionstorage.js"
>
</script>
<!-- webDav -->
<script
type=
"text/javascript"
src=
"../lib/jquery/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/davstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/indexstorage.js"
>
</script>
</script>
<script
type=
"text/javascript"
src=
"./jiotests.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