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
Hide 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 @@
...
@@ -16,8 +16,8 @@
// Tells us that the document is saved.
// Tells us that the document is saved.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
},
100
);
// 100 ms, for jiotests simple job waiting
};
// end saveDocument
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
that
.
loadDocument
=
function
(
command
)
{
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
'
content
'
:
'
content
'
,
'
content
'
:
'
content
'
,
'
creation_date
'
:
10000
,
'
creation_date
'
:
10000
,
'
last_modified
'
:
15000
};
'
last_modified
'
:
15000
};
that
.
done
(
doc
);
that
.
success
(
doc
);
},
100
);
},
100
);
};
// end loadDocument
};
// end loadDocument
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
delete
list
[
0
].
content
;
delete
list
[
0
].
content
;
delete
list
[
1
].
content
;
delete
list
[
1
].
content
;
}
}
that
.
done
(
list
);
that
.
success
(
list
);
},
100
);
},
100
);
};
// end getDocumentList
};
// end getDocumentList
...
@@ -61,7 +61,7 @@
...
@@ -61,7 +61,7 @@
// Remove a document from the storage.
// Remove a document from the storage.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
},
100
);
};
};
return
that
;
return
that
;
...
@@ -72,45 +72,30 @@
...
@@ -72,45 +72,30 @@
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Dummy Storage 2 : all fail
// Dummy Storage 2 : all fail
newDummyStorageAllFail
=
function
(
spec
,
my
)
{
newDummyStorageAllFail
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
);
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
)
,
priv
=
{}
;
that
.
setType
(
'
dummyallfail
'
);
priv
.
error
=
function
()
{
setTimeout
(
function
()
{
that
.
error
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
});
};
that
.
saveDocument
=
function
(
command
)
{
that
.
saveDocument
=
function
(
command
)
{
// Tells us that the document is not saved.
priv
.
error
();
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
};
// end saveDocument
};
// end saveDocument
that
.
loadDocument
=
function
(
command
)
{
that
.
loadDocument
=
function
(
command
)
{
// Returns a document object containing nothing.
priv
.
error
();
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
};
// end loadDocument
};
// end loadDocument
that
.
getDocumentList
=
function
(
command
)
{
that
.
getDocumentList
=
function
(
command
)
{
// It returns nothing.
priv
.
error
();
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
};
// end getDocumentList
};
// end getDocumentList
that
.
removeDocument
=
function
(
command
)
{
that
.
removeDocument
=
function
(
command
)
{
// Remove a document from the storage.
priv
.
error
();
};
// end removeDocument
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Unknown error.
'
});
},
100
);
};
return
that
;
return
that
;
},
},
// end Dummy Storage All Fail
// end Dummy Storage All Fail
...
@@ -121,13 +106,11 @@
...
@@ -121,13 +106,11 @@
newDummyStorageAllNotFound
=
function
(
spec
,
my
)
{
newDummyStorageAllNotFound
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
);
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
);
that
.
setType
(
'
dummyallnotfound
'
);
that
.
saveDocument
=
function
(
command
)
{
that
.
saveDocument
=
function
(
command
)
{
// Document does not exists yet, create it.
// Document does not exists yet, create it.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
},
100
);
};
// end saveDocument
};
// end saveDocument
...
@@ -135,9 +118,9 @@
...
@@ -135,9 +118,9 @@
// Returns a document object containing nothing.
// Returns a document object containing nothing.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
that
.
error
({
status
:
404
,
statusText
:
'
Not Found
'
,
message
:
'
Document "
'
+
command
.
getPath
()
+
message
:
'
Document "
'
+
command
.
getPath
()
+
'
" not found.
'
});
'
" not found.
'
});
},
100
);
},
100
);
};
// end loadDocument
};
// end loadDocument
...
@@ -145,8 +128,8 @@
...
@@ -145,8 +128,8 @@
// It returns nothing.
// It returns nothing.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
that
.
error
({
status
:
404
,
statusText
:
'
Not Found
'
,
message
:
'
User list not found.
'
});
message
:
'
User list not found.
'
});
},
100
);
},
100
);
};
// end getDocumentList
};
// end getDocumentList
...
@@ -154,7 +137,7 @@
...
@@ -154,7 +137,7 @@
// Remove a document from the storage.
// Remove a document from the storage.
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
done
();
that
.
success
();
},
100
);
},
100
);
};
};
return
that
;
return
that
;
...
@@ -167,8 +150,6 @@
...
@@ -167,8 +150,6 @@
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
),
priv
=
{};
var
that
=
Jio
.
storage
(
spec
,
my
,
'
base
'
),
priv
=
{};
that
.
setType
(
'
dummyall3tries
'
);
// this serialized method is used to make simple difference between
// this serialized method is used to make simple difference between
// two dummyall3tries storages:
// two dummyall3tries storages:
// so {type:'dummyall3tries',a:'b'} differs from
// so {type:'dummyall3tries',a:'b'} differs from
...
@@ -176,7 +157,7 @@
...
@@ -176,7 +157,7 @@
var
super_serialized
=
that
.
serialized
;
var
super_serialized
=
that
.
serialized
;
that
.
serialized
=
function
()
{
that
.
serialized
=
function
()
{
var
o
=
super_serialized
();
var
o
=
super_serialized
();
o
.
spec
=
spec
;
o
.
applicationname
=
spec
.
applicationname
;
return
o
;
return
o
;
};
};
...
@@ -187,15 +168,20 @@
...
@@ -187,15 +168,20 @@
},
100
);
},
100
);
};
};
priv
.
Try3OKElseFail
=
function
(
tries
,
if_ok_return
)
{
priv
.
Try3OKElseFail
=
function
(
tries
,
if_ok_return
)
{
if
(
tries
===
3
)
{
if
(
typeof
tries
===
'
undefined
'
)
{
return
that
.
done
(
if_ok_return
);
return
that
.
error
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
message
:
'
Cannot get tried
'
});
}
}
if
(
tries
<
3
)
{
if
(
tries
<
3
)
{
return
that
.
fail
(
return
that
.
retry
(
{
message
:
''
+
(
3
-
tries
)
+
'
tries left.
'
});
{
message
:
''
+
(
3
-
tries
)
+
'
tries left.
'
});
}
}
if
(
tries
===
3
)
{
return
that
.
success
(
if_ok_return
);
}
if
(
tries
>
3
)
{
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