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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Junming
jio
Commits
93c5a742
Commit
93c5a742
authored
Jan 10, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint pass dummystorages.js
parent
f6015801
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
473 additions
and
496 deletions
+473
-496
src/jio.dummystorages.js
src/jio.dummystorages.js
+473
-496
No files found.
src/jio.dummystorages.js
View file @
93c5a742
/*global window, define */
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global setTimeout: true, window: true, define: true, jIO: true */
// Adds 5 dummy storages to JIO
// Adds 5 dummy storages to JIO
// type:
// type:
// - dummyallok
// - dummyallok
...
@@ -8,526 +9,502 @@
...
@@ -8,526 +9,502 @@
// - dummyalldocs
// - dummyalldocs
// - dummyallfound
// - dummyallfound
(
function
()
{
(
function
()
{
'
use strict
'
;
'
use strict
'
;
var
jioDummyStorageLoader
=
function
(
jIO
)
{
var
jioDummyStorageLoader
=
function
(
jIO
)
{
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 1 : all ok
// Dummy Storage 1 : all ok
var
newDummyStorageAllOk
=
function
(
spec
,
my
)
{
var
newDummyStorageAllOk
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
);
var
that
=
my
.
basicStorage
(
spec
,
my
);
that
.
specToStore
=
function
()
{
that
.
specToStore
=
function
()
{
return
{
return
{
"
username
"
:
spec
.
username
"
username
"
:
spec
.
username
};
};
};
};
that
.
post
=
function
(
command
)
{
that
.
post
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
command
.
getAttachmentId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end putAttachment
};
// end putAttachment
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
if
(
command
.
getAttachmentId
())
{
return
that
.
success
(
'
0123456789
'
);
return
that
.
success
(
'
0123456789
'
);
}
}
that
.
success
({
that
.
success
({
"
_id
"
:
command
.
getDocId
(),
"
_id
"
:
command
.
getDocId
(),
"
title
"
:
'
get_title
'
"
title
"
:
'
get_title
'
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end get
};
// end get
that
.
allDocs
=
function
(
command
)
{
that
.
allDocs
=
function
()
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
"
status
"
:
405
,
"
status
"
:
405
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
message
"
:
"
Your are not allowed to use
"
+
"
this command
"
,
"
this command
"
,
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
"
command executions
"
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
});
"
command executions
"
});
});
};
// end allDocs
});
};
// end allDocs
that
.
remove
=
function
(
command
)
{
that
.
remove
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
if
(
command
.
getAttachmentId
())
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
command
.
getAttachmentId
()
});
});
}
else
{
}
else
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
}
}
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end remove
};
// end remove
return
that
;
return
that
;
},
},
// end Dummy Storage All Ok
// end Dummy Storage All Ok
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 2 : all fail
// Dummy Storage 2 : all fail
newDummyStorageAllFail
=
function
(
spec
,
my
)
{
newDummyStorageAllFail
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
),
var
that
=
my
.
basicStorage
(
spec
,
my
),
priv
=
{};
priv
=
{};
priv
.
error
=
function
()
{
priv
.
error
=
function
()
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
status
:
0
,
status
:
0
,
statusText
:
'
Unknown Error
'
,
statusText
:
'
Unknown Error
'
,
error
:
'
unknown_error
'
,
error
:
'
unknown_error
'
,
message
:
'
Execution encountred an error.
'
,
message
:
'
Execution encountred an error.
'
,
reason
:
'
Execution encountred an error
'
reason
:
'
Execution encountred an error
'
});
});
},
100
);
},
100
);
};
};
that
.
post
=
function
(
command
)
{
that
.
post
=
function
(
)
{
priv
.
error
();
priv
.
error
();
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
)
{
priv
.
error
();
priv
.
error
();
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
)
{
priv
.
error
();
priv
.
error
();
};
// end put
};
// end put
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
)
{
priv
.
error
();
priv
.
error
();
};
// end get
};
// end get
that
.
allDocs
=
function
(
command
)
{
that
.
allDocs
=
function
()
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
"
status
"
:
405
,
"
status
"
:
405
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
message
"
:
"
Your are not allowed to use
"
+
"
this command
"
,
"
this command
"
,
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
"
command executions
"
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
});
"
command executions
"
});
});
};
// end allDocs
});
};
// end allDocs
that
.
remove
=
function
(
command
)
{
that
.
remove
=
function
(
)
{
priv
.
error
();
priv
.
error
();
};
// end remove
};
// end remove
return
that
;
return
that
;
},
},
// end Dummy Storage All Fail
// end Dummy Storage All Fail
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 3 : all not found
// Dummy Storage 3 : all not found
newDummyStorageAllNotFound
=
function
(
spec
,
my
)
{
newDummyStorageAllNotFound
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
);
var
that
=
my
.
basicStorage
(
spec
,
my
);
that
.
post
=
function
(
command
)
{
that
.
post
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
},
100
);
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
},
100
);
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
command
.
getAttachmentId
()
});
});
},
100
);
},
100
);
};
// end put
};
// end put
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
"
status
"
:
404
,
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Document '
"
+
command
.
getDocId
()
+
"
message
"
:
"
Document '
"
+
command
.
getDocId
()
+
"
' not found
"
,
"
' not found
"
,
"
reason
"
:
"
Document '
"
+
command
.
getDocId
()
+
"
'does not exist
"
"
reason
"
:
"
Document '
"
+
command
.
getDocId
()
+
});
"
'does not exist
"
},
100
);
});
};
// end get
},
100
);
that
.
allDocs
=
function
()
{
};
// end get
setTimeout
(
function
()
{
that
.
allDocs
=
function
(
command
)
{
that
.
error
({
window
.
setTimeout
(
function
()
{
"
status
"
:
405
,
that
.
error
({
"
statusText
"
:
"
Method Not Allowed
"
,
"
status
"
:
405
,
"
error
"
:
"
method_not_allowed
"
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
this command
"
,
"
error
"
:
"
method_not_allowed
"
,
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
"
command executions
"
"
message
"
:
"
Your are not allowed to use
"
+
});
"
this command
"
,
});
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
};
// end allDocs
"
command executions
"
that
.
remove
=
function
()
{
});
setTimeout
(
function
()
{
});
that
.
error
({
};
// end allDocs
"
status
"
:
404
,
that
.
remove
=
function
(
command
)
{
"
statusText
"
:
"
Not Found
"
,
window
.
setTimeout
(
function
()
{
"
error
"
:
"
not_found
"
,
that
.
error
({
"
message
"
:
"
Cannot remove an unexistant
"
+
"
document
"
,
"
status
"
:
404
,
"
reason
"
:
"
missing
"
// or deleted
"
statusText
"
:
"
Not Found
"
,
});
"
error
"
:
"
not_found
"
,
},
100
);
"
message
"
:
"
Cannot remove an unexistant
"
+
};
// end remove
"
document
"
,
return
that
;
"
reason
"
:
"
missing
"
// or deleted
},
});
// end Dummy Storage All Not Found
},
100
);
/////////////////////////////////////////////////////////////////
};
// end remove
return
that
;
},
// end Dummy Storage All Not Found
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 4 : all 3 tries
// Dummy Storage 4 : all 3 tries
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
),
var
that
=
my
.
basicStorage
(
spec
,
my
),
priv
=
{};
priv
=
{};
// this specToStore method is used to make simple
// this specToStore method is used to make simple
// difference between two dummyall3tries storages:
// difference between two dummyall3tries storages:
// so {type:'dummyall3tries',a:'b'} differs from
// so {type:'dummyall3tries',a:'b'} differs from
// {type:'dummyall3tries',c:'d'}.
// {type:'dummyall3tries',c:'d'}.
that
.
specToStore
=
function
()
{
that
.
specToStore
=
function
()
{
return
{
return
{
"
application_name
"
:
spec
.
application_name
"
application_name
"
:
spec
.
application_name
};
};
};
};
priv
.
doJob
=
function
(
command
,
if_ok_return
)
{
priv
.
doJob
=
function
(
command
,
if_ok_return
)
{
// wait a little to simulate asynchronous operation
// wait a little to simulate asynchronous operation
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
priv
.
Try3OKElseFail
(
command
.
getTried
(),
priv
.
Try3OKElseFail
(
command
.
getTried
(),
if_ok_return
);
if_ok_return
);
},
100
);
},
100
);
};
};
priv
.
Try3OKElseFail
=
function
(
tries
,
if_ok_return
)
{
priv
.
Try3OKElseFail
=
function
(
tries
,
if_ok_return
)
{
if
(
tries
===
'
undefined
'
)
{
if
(
tries
===
'
undefined
'
)
{
return
that
.
error
({
return
that
.
error
({
"
status
"
:
0
,
"
status
"
:
0
,
"
statusText
"
:
"
Unknown Error
"
,
"
statusText
"
:
"
Unknown Error
"
,
"
error
"
:
"
unknown_error
"
,
"
error
"
:
"
unknown_error
"
,
"
message
"
:
"
Cannot get tried
"
,
"
message
"
:
"
Cannot get tried
"
,
"
reason
"
:
"
Unknown
"
"
reason
"
:
"
Unknown
"
});
});
}
}
if
(
tries
<
3
)
{
if
(
tries
<
3
)
{
return
that
.
retry
({
return
that
.
retry
({
message
:
'
Now
'
+
(
3
-
tries
)
+
'
tries left.
'
message
:
'
Now
'
+
(
3
-
tries
)
+
'
tries left.
'
});
});
}
}
if
(
tries
===
3
)
{
if
(
tries
===
3
)
{
return
that
.
success
(
if_ok_return
);
return
that
.
success
(
if_ok_return
);
}
}
if
(
tries
>
3
)
{
if
(
tries
>
3
)
{
return
that
.
error
({
return
that
.
error
({
"
status
"
:
1
,
"
status
"
:
1
,
"
statusText
"
:
"
Too Much Tries
"
,
"
statusText
"
:
"
Too Much Tries
"
,
"
error
"
:
"
too_much_tries
"
,
"
error
"
:
"
too_much_tries
"
,
"
message
"
:
"
Too much tries
"
,
"
message
"
:
"
Too much tries
"
,
"
reason
"
:
"
Too much tries
"
"
reason
"
:
"
Too much tries
"
});
});
}
}
};
};
that
.
post
=
function
(
command
)
{
that
.
post
=
function
(
command
)
{
priv
.
doJob
(
command
,
{
priv
.
doJob
(
command
,
{
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
priv
.
doJob
(
command
,
{
priv
.
doJob
(
command
,
{
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
command
)
{
priv
.
doJob
(
command
,
{
priv
.
doJob
(
command
,
{
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
});
command
.
getAttachmentId
()
};
// end put
});
that
.
get
=
function
(
command
)
{
};
// end put
if
(
command
.
getAttachmentId
())
{
that
.
get
=
function
(
command
)
{
priv
.
doJob
(
command
,
"
0123456789
"
);
if
(
command
.
getAttachmentId
())
{
}
else
{
priv
.
doJob
(
command
,
"
0123456789
"
);
priv
.
doJob
(
command
,
{
}
else
{
"
_id
"
:
command
.
getDocId
(),
priv
.
doJob
(
command
,
{
"
title
"
:
'
Title of
'
+
command
.
getDocId
()
"
_id
"
:
command
.
getDocId
(),
});
"
title
"
:
'
Title of
'
+
command
.
getDocId
()
}
});
};
// end get
}
that
.
allDocs
=
function
()
{
};
// end get
setTimeout
(
function
()
{
that
.
allDocs
=
function
(
command
)
{
that
.
error
({
window
.
setTimeout
(
function
()
{
"
status
"
:
405
,
that
.
error
({
"
statusText
"
:
"
Method Not Allowed
"
,
"
status
"
:
405
,
"
error
"
:
"
method_not_allowed
"
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
this command
"
,
"
error
"
:
"
method_not_allowed
"
,
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
"
command executions
"
"
message
"
:
"
Your are not allowed to use
"
+
});
"
this command
"
,
});
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
};
// end allDocs
"
command executions
"
that
.
remove
=
function
(
command
)
{
});
if
(
command
.
getAttachmentId
())
{
});
priv
.
doJob
(
command
,
{
};
// end allDocs
"
ok
"
:
true
,
that
.
remove
=
function
(
command
)
{
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
if
(
command
.
getAttachmentId
())
{
});
priv
.
doJob
(
command
,
{
}
else
{
"
ok
"
:
true
,
priv
.
doJob
(
command
,
{
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
ok
"
:
true
,
command
.
getAttachmentId
()
"
id
"
:
command
.
getDocId
()
});
});
}
else
{
}
priv
.
doJob
(
command
,
{
};
// end remove
"
ok
"
:
true
,
return
that
;
"
id
"
:
command
.
getDocId
()
},
});
// end Dummy Storage All 3 Tries
}
/////////////////////////////////////////////////////////////////
};
// end remove
return
that
;
},
// end Dummy Storage All 3 Tries
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 5 : all docs
// Dummy Storage 5 : all docs
newDummyStorageAllDocs
=
function
(
spec
,
my
)
{
newDummyStorageAllDocs
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
);
var
that
=
my
.
basicStorage
(
spec
,
my
);
that
.
specToStore
=
function
()
{
that
.
specToStore
=
function
()
{
return
{
return
{
"
username
"
:
spec
.
username
"
username
"
:
spec
.
username
};
};
};
};
that
.
post
=
function
(
command
)
{
that
.
post
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
command
.
getAttachmentId
()
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end putAttachment
};
// end putAttachment
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
if
(
command
.
getAttachmentId
())
{
return
that
.
success
(
'
0123456789
'
);
return
that
.
success
(
'
0123456789
'
);
}
}
that
.
success
({
that
.
success
({
"
_id
"
:
command
.
getDocId
(),
"
_id
"
:
command
.
getDocId
(),
"
title
"
:
"
get_title
"
"
title
"
:
"
get_title
"
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end get
};
// end get
that
.
allDocs
=
function
(
command
)
{
that
.
allDocs
=
function
(
command
)
{
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
var
addRow
,
var
addRow
,
o
=
{
o
=
{
"
total_rows
"
:
0
,
"
total_rows
"
:
0
,
"
rows
"
:
[]
"
rows
"
:
[]
};
};
addRow
=
function
(
id
,
key
,
doc
)
{
addRow
=
function
(
id
,
key
,
doc
)
{
var
row
=
{
var
row
=
{
"
id
"
:
id
,
"
id
"
:
"
file
"
,
"
key
"
:
key
,
"
key
"
:
"
file
"
,
"
value
"
:
{}
"
value
"
:
{}
};
};
if
(
command
.
getOption
(
"
include_docs
"
))
{
if
(
command
.
getOption
(
"
include_docs
"
))
{
row
.
doc
=
doc
;
row
.
doc
=
doc
;
}
}
o
.
rows
.
push
(
row
);
o
.
rows
.
push
(
row
);
o
.
total_rows
+=
1
;
o
.
total_rows
+=
1
;
};
};
addRow
(
"
file
"
,
"
file
"
,
{
addRow
(
"
file
"
,
"
file
"
,
{
"
_id
"
:
"
file
"
,
"
_id
"
:
"
file
"
,
"
Title
"
:
"
myFile
"
"
Title
"
:
"
myFile
"
});
});
addRow
(
"
mylongtitledfilethatidontliketowriteby
"
+
addRow
(
"
mylongtitledfilethatidontliketowriteby
"
+
"
handonablackboard
"
,
"
mylongtialias1
"
,
{
"
handonablackboard
"
,
"
mylongtialias1
"
,
{
"
_id
"
:
"
mylongtitledfilethatidontlike
"
+
"
_id
"
:
"
mylongtitledfilethatidontlike
"
+
"
towritebyhandonablackboard
"
,
"
towritebyhandonablackboard
"
,
"
Title
"
:
"
myLongFile
"
"
Title
"
:
"
myLongFile
"
});
});
that
.
success
(
o
);
that
.
success
(
o
);
});
});
};
// end allDocs
};
// end allDocs
that
.
remove
=
function
(
command
)
{
that
.
remove
=
function
(
command
)
{
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
if
(
command
.
getAttachmentId
())
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
});
command
.
getAttachmentId
()
}
else
{
});
that
.
success
({
}
else
{
"
ok
"
:
true
,
that
.
success
({
"
id
"
:
command
.
getDocId
()
"
ok
"
:
true
,
});
"
id
"
:
command
.
getDocId
()
}
});
},
100
);
// 100 ms, for jiotests simple job waiting
}
};
// end remove
},
100
);
// 100 ms, for jiotests simple job waiting
return
that
;
};
// end remove
},
return
that
;
// end Dummy Storage All Docs
},
/////////////////////////////////////////////////////////////////
// end Dummy Storage All Docs
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Dummy Storage 6 : all found
// Dummy Storage 6 : all found
newDummyStorageAllFound
=
function
(
spec
,
my
)
{
newDummyStorageAllFound
=
function
(
spec
,
my
)
{
var
that
=
my
.
basicStorage
(
spec
,
my
);
var
that
=
my
.
basicStorage
(
spec
,
my
);
that
.
post
=
function
(
command
)
{
that
.
post
=
function
()
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
"
status
"
:
409
,
"
status
"
:
409
,
"
statusText
"
:
"
Conflicts
"
,
"
statusText
"
:
"
Conflicts
"
,
"
error
"
:
"
conflicts
"
,
"
error
"
:
"
conflicts
"
,
"
message
"
:
"
Cannot create a new document
"
,
"
message
"
:
"
Cannot create a new document
"
,
"
reason
"
:
"
Document already exists
"
"
reason
"
:
"
Document already exists
"
});
});
},
100
);
},
100
);
};
// end post
};
// end post
that
.
put
=
function
(
command
)
{
that
.
put
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
"
id
"
:
command
.
getDocId
()
});
});
},
100
);
},
100
);
};
// end put
};
// end put
that
.
putAttachment
=
function
(
command
)
{
that
.
putAttachment
=
function
(
command
)
{
window
.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
command
.
getAttachmentId
()
});
});
},
100
);
},
100
);
};
// end put
};
// end put
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
if
(
command
.
getAttachmentId
())
{
if
(
command
.
getAttachmentId
())
{
return
that
.
success
(
'
0123456789
'
);
return
that
.
success
(
'
0123456789
'
);
}
}
that
.
success
({
that
.
success
({
"
_id
"
:
command
.
getDocId
(),
"
_id
"
:
command
.
getDocId
(),
"
title
"
:
'
get_title
'
"
title
"
:
'
get_title
'
});
});
},
100
);
// 100 ms, for jiotests simple job waiting
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end get
};
// end get
that
.
allDocs
=
function
()
{
that
.
allDocs
=
function
(
command
)
{
setTimeout
(
function
()
{
window
.
setTimeout
(
function
()
{
that
.
error
({
that
.
error
({
"
status
"
:
405
,
"
status
"
:
405
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
statusText
"
:
"
Method Not Allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
error
"
:
"
method_not_allowed
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
this command
"
,
"
message
"
:
"
Your are not allowed to use
"
+
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
"
command executions
"
"
this command
"
,
});
"
reason
"
:
"
LocalStorage forbids AllDocs
"
+
});
"
command executions
"
};
// end allDocs
});
that
.
remove
=
function
(
command
)
{
});
setTimeout
(
function
()
{
};
// end allDocs
if
(
command
.
getAttachmentId
())
{
that
.
remove
=
function
(
command
)
{
that
.
success
({
window
.
setTimeout
(
function
()
{
"
ok
"
:
true
,
if
(
command
.
getAttachmentId
())
{
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
command
.
getAttachmentId
()
that
.
success
({
});
"
ok
"
:
true
,
}
else
{
"
id
"
:
command
.
getDocId
()
+
"
/
"
+
that
.
success
({
command
.
getAttachmentId
()
"
ok
"
:
true
,
});
"
id
"
:
command
.
getDocId
()
}
else
{
});
that
.
success
({
}
"
ok
"
:
true
,
},
100
);
// 100 ms, for jiotests simple job waiting
"
id
"
:
command
.
getDocId
()
};
// end remove
});
return
that
;
}
};
},
100
);
// 100 ms, for jiotests simple job waiting
// end Dummy Storage All Not Found
};
// end remove
/////////////////////////////////////////////////////////////////
return
that
;
// add key to storageObjectType of global jio
};
jIO
.
addStorageType
(
'
dummyallok
'
,
newDummyStorageAllOk
);
// end Dummy Storage All Not Found
jIO
.
addStorageType
(
'
dummyallfail
'
,
newDummyStorageAllFail
);
/////////////////////////////////////////////////////////////////
jIO
.
addStorageType
(
'
dummyallnotfound
'
,
newDummyStorageAllNotFound
);
// add key to storageObjectType of global jio
jIO
.
addStorageType
(
'
dummyall3tries
'
,
newDummyStorageAll3Tries
);
jIO
.
addStorageType
(
'
dummyallok
'
,
newDummyStorageAllOk
);
jIO
.
addStorageType
(
'
dummyalldocs
'
,
newDummyStorageAllDocs
);
jIO
.
addStorageType
(
'
dummyallfail
'
,
newDummyStorageAllFail
);
jIO
.
addStorageType
(
'
dummyallfound
'
,
newDummyStorageAllFound
);
jIO
.
addStorageType
(
'
dummyallnotfound
'
,
};
newDummyStorageAllNotFound
);
if
(
window
.
requirejs
)
{
jIO
.
addStorageType
(
'
dummyall3tries
'
,
newDummyStorageAll3Tries
);
define
(
'
JIODummyStorages
'
,
[
'
jIO
'
],
jioDummyStorageLoader
);
jIO
.
addStorageType
(
'
dummyalldocs
'
,
newDummyStorageAllDocs
);
}
else
{
jIO
.
addStorageType
(
'
dummyallfound
'
,
newDummyStorageAllFound
);
jioDummyStorageLoader
(
jIO
);
};
}
if
(
window
.
requirejs
)
{
define
(
'
JIODummyStorages
'
,
[
'
jIO
'
],
jioDummyStorageLoader
);
}
else
{
jioDummyStorageLoader
(
jIO
);
}
}());
}());
\ No newline at end of file
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