Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
nexedi
officejs
Commits
9d672f03
Commit
9d672f03
authored
Jul 31, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating Dummy Storages
parent
1f289bc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
48 deletions
+34
-48
OfficeJS/src/jio.dummystorages.js
OfficeJS/src/jio.dummystorages.js
+34
-48
No files found.
OfficeJS/src/jio.dummystorages.js
View file @
9d672f03
...
...
@@ -16,8 +16,8 @@
// Tells us that the document is saved.
setTimeout
(
function
()
{
that
.
done
();
},
100
);
that
.
success
();
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
...
...
@@ -30,7 +30,7 @@
'
content
'
:
'
content
'
,
'
creation_date
'
:
10000
,
'
last_modified
'
:
15000
};
that
.
done
(
doc
);
that
.
success
(
doc
);
},
100
);
};
// end loadDocument
...
...
@@ -53,7 +53,7 @@
delete
list
[
0
].
content
;
delete
list
[
1
].
content
;
}
that
.
done
(
list
);
that
.
success
(
list
);
},
100
);
};
// end getDocumentList
...
...
@@ -61,7 +61,7 @@
// Remove a document from the storage.
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
};
return
that
;
...
...
@@ -72,45 +72,30 @@
////////////////////////////////////////////////////////////////////////////
// Dummy Storage 2 : all fail
newDummyStorageAllFail
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
);
that
.
setType
(
'
dummyallfail
'
);
that
.
saveDocument
=
function
(
command
)
{
// Tells us that the document is not saved.
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
),
priv
=
{};
priv
.
error
=
function
()
{
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
that
.
error
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
});
};
that
.
saveDocument
=
function
(
command
)
{
priv
.
error
();
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
// Returns a document object containing nothing.
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
priv
.
error
();
};
// end loadDocument
that
.
getDocumentList
=
function
(
command
)
{
// It returns nothing.
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
priv
.
error
();
};
// end getDocumentList
that
.
removeDocument
=
function
(
command
)
{
// Remove a document from the storage.
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
};
priv
.
error
();
};
// end removeDocument
return
that
;
},
// end Dummy Storage All Fail
...
...
@@ -121,13 +106,11 @@
newDummyStorageAllNotFound
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
);
that
.
setType
(
'
dummyallnotfound
'
);
that
.
saveDocument
=
function
(
command
)
{
// Document does not exists yet, create it.
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
};
// end saveDocument
...
...
@@ -135,7 +118,7 @@
// Returns a document object containing nothing.
setTimeout
(
function
()
{
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
that
.
error
({
status
:
404
,
statusText
:
'
Not Found
'
,
message
:
'
Document "
'
+
command
.
getPath
()
+
'
" not found.
'
});
},
100
);
...
...
@@ -145,7 +128,7 @@
// It returns nothing.
setTimeout
(
function
()
{
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
that
.
error
({
status
:
404
,
statusText
:
'
Not Found
'
,
message
:
'
User list not found.
'
});
},
100
);
};
// end getDocumentList
...
...
@@ -154,7 +137,7 @@
// Remove a document from the storage.
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
};
return
that
;
...
...
@@ -167,8 +150,6 @@
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
),
priv
=
{};
that
.
setType
(
'
dummyall3tries
'
);
// this serialized method is used to make simple difference between
// two dummyall3tries storages:
// so {type:'dummyall3tries',a:'b'} differs from
...
...
@@ -176,7 +157,7 @@
var
super_serialized
=
that
.
serialized
;
that
.
serialized
=
function
()
{
var
o
=
super_serialized
();
o
.
spec
=
spec
;
o
.
applicationname
=
spec
.
applicationname
;
return
o
;
};
...
...
@@ -187,15 +168,20 @@
},
100
);
};
priv
.
Try3OKElseFail
=
function
(
tries
,
if_ok_return
)
{
if
(
tries
===
3
)
{
return
that
.
done
(
if_ok_return
);
if
(
typeof
tries
===
'
undefined
'
)
{
return
that
.
error
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Cannot get tried
'
});
}
if
(
tries
<
3
)
{
return
that
.
fail
(
return
that
.
retry
(
{
message
:
''
+
(
3
-
tries
)
+
'
tries left.
'
});
}
if
(
tries
===
3
)
{
return
that
.
success
(
if_ok_return
);
}
if
(
tries
>
3
)
{
return
that
.
fail
({
message
:
'
Too much tries.
'
});
return
that
.
error
({
status
:
0
,
statusText
:
'
Too Much Tries
'
,
message
:
'
Too much tries.
'
});
}
};
...
...
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