Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Roque
jio
Commits
ad13d07c
Commit
ad13d07c
authored
Dec 27, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dummyallfound added to jio storage for tests
parent
891be93a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
3 deletions
+88
-3
src/jio.dummystorages.js
src/jio.dummystorages.js
+88
-3
No files found.
src/jio.dummystorages.js
View file @
ad13d07c
...
...
@@ -5,6 +5,7 @@
// - dummyallnotfound
// - dummyall3tries
// - dummyalldocs
// - dummyallfound
(
function
()
{
var
jioDummyStorageLoader
=
function
(
jIO
)
{
////////////////////////////////////////////////////////////////////////////
...
...
@@ -198,9 +199,12 @@
that
.
remove
=
function
(
command
)
{
setTimeout
(
function
()
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
that
.
error
({
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Cannot remove an unexistant document
"
,
"
reason
"
:
"
missing
"
// or deleted
});
},
100
);
};
// end remove
...
...
@@ -415,12 +419,93 @@
// end Dummy Storage All Docs
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Dummy Storage 6 : all found
newDummyStorageAllFound
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
);
that
.
post
=
function
(
command
)
{
setTimeout
(
function
()
{
that
.
error
({
"
status
"
:
409
,
"
statusText
"
:
"
Conflicts
"
,
"
error
"
:
"
conflicts
"
,
"
message
"
:
"
Cannot create a new document
"
,
"
reason
"
:
"
Document already exists
"
});
},
100
);
};
// end post
that
.
put
=
function
(
command
)
{
setTimeout
(
function
()
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
});
},
100
);
};
// end put
that
.
putAttachment
=
function
(
command
)
{
setTimeout
(
function
()
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
});
},
100
);
};
// end put
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
return
that
.
success
(
'
0123456789
'
);
}
that
.
success
({
"
_id
"
:
command
.
getDocId
(),
"
title
"
:
'
get_title
'
});
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end get
that
.
allDocs
=
function
(
command
)
{
setTimeout
(
function
()
{
that
.
error
({
"
status
"
:
405
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
message
"
:
"
Your are not allowed to use this command
"
,
"
reason
"
:
"
LocalStorage forbids AllDocs command executions
"
});
});
};
// end allDocs
that
.
remove
=
function
(
command
)
{
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
});
}
else
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
});
}
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end remove
return
that
;
},
// end Dummy Storage All Not Found
////////////////////////////////////////////////////////////////////////////
// add key to storageObjectType of global jio
jIO
.
addStorageType
(
'
dummyallok
'
,
newDummyStorageAllOk
);
jIO
.
addStorageType
(
'
dummyallfail
'
,
newDummyStorageAllFail
);
jIO
.
addStorageType
(
'
dummyallnotfound
'
,
newDummyStorageAllNotFound
);
jIO
.
addStorageType
(
'
dummyall3tries
'
,
newDummyStorageAll3Tries
);
jIO
.
addStorageType
(
'
dummyalldocs
'
,
newDummyStorageAllDocs
);
jIO
.
addStorageType
(
'
dummyallfound
'
,
newDummyStorageAllFound
);
};
...
...
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