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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
jio
Commits
fd0b1d71
Commit
fd0b1d71
authored
Feb 21, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JobRules improved, 'eliminate' is not used anymore.
parent
a4482dab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
185 additions
and
154 deletions
+185
-154
src/jio/jobs/jobRules.js
src/jio/jobs/jobRules.js
+164
-127
test/jiotests.js
test/jiotests.js
+21
-27
No files found.
src/jio/jobs/jobRules.js
View file @
fd0b1d71
...
...
@@ -37,7 +37,7 @@ var jobRules = (function () {
return
'
wait
'
;
}
});
Object
.
defineProperty
(
that
,
"
none
"
,
{
Object
.
defineProperty
(
that
,
"
ok
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
...
...
@@ -45,19 +45,66 @@ var jobRules = (function () {
return
'
none
'
;
}
});
that
.
default_action
=
that
.
none
;
that
.
default_action
=
that
.
ok
;
that
.
default_compare
=
function
(
job1
,
job2
)
{
return
(
job1
.
getCommand
().
getDocId
()
===
job2
.
getCommand
().
getDocId
()
&&
job1
.
getCommand
().
getAttachmentId
()
===
job2
.
getCommand
().
getAttachmentId
()
&&
job1
.
getCommand
().
getDocInfo
(
'
_rev
'
)
===
job2
.
getCommand
().
getDocInfo
(
'
_rev
'
)
&&
job1
.
getCommand
().
getOption
(
'
rev
'
)
===
job2
.
getCommand
().
getOption
(
'
rev
'
)
&&
JSON
.
stringify
(
job1
.
getStorage
().
serialized
())
===
JSON
.
stringify
(
job2
.
getStorage
().
serialized
()));
return
job1
.
getId
()
!==
job2
.
getId
()
&&
job1
.
getStatus
().
getLabel
()
!==
"
done
"
&&
job1
.
getStatus
().
getLabel
()
!==
"
fail
"
&&
JSON
.
stringify
(
job1
.
getStorage
().
serialized
())
===
JSON
.
stringify
(
job2
.
getStorage
().
serialized
());
};
// Compare Functions //
Object
.
defineProperty
(
that
,
"
sameDocumentId
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
job1
,
job2
)
{
return
job1
.
getCommand
().
getDocId
()
===
job2
.
getCommand
().
getDocId
();
}
});
Object
.
defineProperty
(
that
,
"
sameRevision
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
job1
,
job2
)
{
return
job1
.
getCommand
().
getDocInfo
(
"
_rev
"
)
===
job2
.
getCommand
().
getDocInfo
(
"
_rev
"
);
}
});
Object
.
defineProperty
(
that
,
"
sameAttachmentId
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
job1
,
job2
)
{
return
job1
.
getCommand
().
getAttachmentId
()
===
job2
.
getCommand
().
getAttachmentId
();
}
});
Object
.
defineProperty
(
that
,
"
sameDocument
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
job1
,
job2
)
{
return
JSON
.
stringify
(
job1
.
getCommand
().
cloneDoc
())
===
JSON
.
stringify
(
job2
.
getCommand
().
cloneDoc
());
}
});
Object
.
defineProperty
(
that
,
"
sameOption
"
,
{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
job1
,
job2
)
{
return
JSON
.
stringify
(
job1
.
getCommand
().
cloneOption
())
===
JSON
.
stringify
(
job2
.
getCommand
().
cloneOption
());
}
});
// Methods //
/**
* Returns an action according the jobs given in parameters.
...
...
@@ -67,16 +114,28 @@ var jobRules = (function () {
* @return {string} An action string.
*/
priv
.
getAction
=
function
(
job1
,
job2
)
{
var
j1label
,
j2label
,
j1status
;
j1label
=
job1
.
getCommand
().
getLabel
();
j2label
=
job2
.
getCommand
().
getLabel
();
j1status
=
(
job1
.
getStatus
().
getLabel
()
===
'
on going
'
?
'
on going
'
:
'
not on going
'
);
if
(
priv
.
action
[
j1label
]
&&
priv
.
action
[
j1label
][
j1status
]
&&
priv
.
action
[
j1label
][
j1status
][
j2label
])
{
return
priv
.
action
[
j1label
][
j1status
][
j2label
](
job1
,
job2
);
var
method1
,
method2
,
tmp
=
priv
.
action
,
i
,
j
,
condition_list
=
[],
res
;
method1
=
job1
.
getCommand
().
getLabel
();
method2
=
job2
.
getCommand
().
getLabel
();
tmp
=
tmp
[
method1
]
=
tmp
[
method1
]
||
{};
tmp
=
tmp
[
method2
]
=
tmp
[
method2
]
||
[];
for
(
i
=
0
;
i
<
tmp
.
length
;
i
+=
1
)
{
// browsing all method1 method2 rules
condition_list
=
tmp
[
i
].
condition_list
;
res
=
true
;
for
(
j
=
0
;
j
<
condition_list
.
length
;
j
+=
1
)
{
// test all the rule's conditions
if
(
!
condition_list
[
j
](
job1
,
job2
))
{
res
=
false
;
break
;
}
}
if
(
res
)
{
// if all respects condition list, then action
return
tmp
[
i
].
rule
();
}
}
return
that
.
default_action
(
job1
,
job2
);
return
that
.
default_action
();
};
/**
...
...
@@ -87,10 +146,11 @@ var jobRules = (function () {
* @return {boolean} true if comparable, else false.
*/
priv
.
canCompare
=
function
(
job1
,
job2
)
{
var
job1label
=
job1
.
getCommand
().
getLabel
(),
job2label
=
job2
.
getCommand
().
getLabel
();
if
(
priv
.
compare
[
job1label
]
&&
priv
.
compare
[
job2label
])
{
return
priv
.
compare
[
job1label
][
job2label
](
job1
,
job2
);
var
method1
,
method2
;
method1
=
job1
.
getCommand
().
getLabel
();
method2
=
job2
.
getCommand
().
getLabel
();
if
(
priv
.
compare
[
method1
]
&&
priv
.
compare
[
method1
][
method2
])
{
return
priv
.
compare
[
method1
][
method2
](
job1
,
job2
);
}
return
that
.
default_compare
(
job1
,
job2
);
};
...
...
@@ -132,11 +192,14 @@ var jobRules = (function () {
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
function
(
method1
,
ongoing
,
method2
,
rule
)
{
var
ongoing_s
=
(
ongoing
?
'
on going
'
:
'
not on going
'
);
priv
.
action
[
method1
]
=
priv
.
action
[
method1
]
||
{};
priv
.
action
[
method1
][
ongoing_s
]
=
priv
.
action
[
method1
][
ongoing_s
]
||
{};
priv
.
action
[
method1
][
ongoing_s
][
method2
]
=
rule
;
value
:
function
(
method1
,
method2
,
condition_list
,
rule
)
{
var
tmp
=
priv
.
action
;
tmp
=
tmp
[
method1
]
=
tmp
[
method1
]
||
{};
tmp
=
tmp
[
method2
]
=
tmp
[
method2
]
||
[];
tmp
.
push
({
"
condition_list
"
:
condition_list
,
"
rule
"
:
rule
});
}
});
...
...
@@ -160,112 +223,86 @@ var jobRules = (function () {
////////////////////////////////////////////////////////////////////////////
// Adding some rules
/*
LEGEND:
- s: storage
- m: method
- n: name
- c: content
- o: options
- =: are equal
- !: are not equal
Rules
original job |job to add |condition |action
select ALL s= n=
removefailordone fail|done
/ elim repl nacc wait
Remove !ongoing Save 1 x x x
Save !ongoing Remove 1 x x x
GetList !ongoing GetList 0 1 x x
Remove !ongoing Remove 0 1 x x
Load !ongoing Load 0 1 x x
Save c= !ongoing Save 0 1 x x
Save c! !ongoing Save 0 1 x x
GetList ongoing GetList 0 0 1 x
Remove ongoing Remove 0 0 1 x
Remove ongoing Load 0 0 1 x
Remove !ongoing Load 0 0 1 x
Load ongoing Load 0 0 1 x
Save c= ongoing Save 0 0 1 x
Remove ongoing Save 0 0 0 1
Load ongoing Remove 0 0 0 1
Load ongoing Save 0 0 0 1
Load !ongoing Remove 0 0 0 1
Load !ongoing Save 0 0 0 1
Save ongoing Remove 0 0 0 1
Save ongoing Load 0 0 0 1
Save c! ongoing Save 0 0 0 1
Save !ongoing Load 0 0 0 1
GetList ongoing Remove 0 0 0 0
GetList ongoing Load 0 0 0 0
GetList ongoing Save 0 0 0 0
GetList !ongoing Remove 0 0 0 0
GetList !ongoing Load 0 0 0 0
GetList !ongoing Save 0 0 0 0
Remove ongoing GetList 0 0 0 0
Remove !ongoing GetList 0 0 0 0
Load ongoing GetList 0 0 0 0
Load !ongoing GetList 0 0 0 0
Save ongoing GetList 0 0 0 0
Save !ongoing GetList 0 0 0 0
post post same doc update
" " same docid, same rev wait
" put same doc update
" " same docid, same rev wait
" putA " wait
" remove " "
put post same doc update
" " same docid, same rev wait
" put same doc update
" " same docid, same rev wait
" putA " "
" remove " "
putA post same docid, same rev wait
" put " "
" putA same doc update
" " same docid, same rev, same attmt wait
" remove same docid, same rev "
remove post same docid, same rev wait
" put " "
" putA " "
" remove " update
get get same doc, same options update
allDocs allDocs same doc, same options update
*/
For more information, see documentation
*/
that
.
addActionRule
(
'
post
'
,
true
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
post
'
,
true
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
true
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
true
,
'
remove
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
true
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
false
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
post
'
,
false
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
false
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
post
'
,
false
,
'
remove
'
,
that
.
eliminate
);
that
.
addActionRule
(
'
post
'
,
false
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
"
post
"
,
"
post
"
,
[
that
.
sameDocument
],
that
.
update
);
that
.
addActionRule
(
"
post
"
,
"
post
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
post
"
,
"
put
"
,
[
that
.
sameDocument
],
that
.
update
);
that
.
addActionRule
(
"
post
"
,
"
put
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
post
"
,
"
putAttachment
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
post
"
,
"
remove
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
true
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
put
'
,
true
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
true
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
true
,
'
remove
'
,
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
true
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
false
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
put
'
,
false
,
'
put
'
,
that
.
update
);
that
.
addActionRule
(
'
put
'
,
false
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
put
'
,
false
,
'
remove
'
,
that
.
eliminate
);
that
.
addActionRule
(
'
put
'
,
false
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
"
put
"
,
"
post
"
,
[
that
.
sameDocument
]
,
that
.
update
);
that
.
addActionRule
(
"
put
"
,
"
post
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
]
,
that
.
wait
);
that
.
addActionRule
(
"
put
"
,
"
put
"
,
[
that
.
sameDocument
],
that
.
update
);
that
.
addActionRule
(
"
put
"
,
"
put
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
put
"
,
"
putAttachment
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
]
,
that
.
wait
);
that
.
addActionRule
(
"
put
"
,
"
remove
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
]
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
true
,
'
post
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
true
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
true
,
'
get
'
,
that
.
update
);
that
.
addActionRule
(
'
get
'
,
true
,
'
remove
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
true
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
false
,
'
post
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
false
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
false
,
'
get
'
,
that
.
update
);
that
.
addActionRule
(
'
get
'
,
false
,
'
remove
'
,
that
.
wait
);
that
.
addActionRule
(
'
get
'
,
false
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
"
putAttachment
"
,
"
post
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
putAttachment
"
,
"
put
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
putAttachment
"
,
"
putAttachment
"
,
[
that
.
sameDocument
],
that
.
update
);
that
.
addActionRule
(
"
putAttachment
"
,
"
putAttachment
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
,
that
.
sameAttachmentId
],
that
.
wait
);
that
.
addActionRule
(
"
putAttachment
"
,
"
remove
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
'
remove
'
,
true
,
'
post
'
,
that
.
wait
);
that
.
addActionRule
(
'
remove
'
,
true
,
'
get
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
true
,
'
remove
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
true
,
'
putAttachment
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
false
,
'
post
'
,
that
.
eliminate
);
that
.
addActionRule
(
'
remove
'
,
false
,
'
put
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
false
,
'
get
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
false
,
'
remove
'
,
that
.
update
);
that
.
addActionRule
(
'
remove
'
,
false
,
'
putAttachment
'
,
that
.
update
);
that
.
addActionRule
(
"
remove
"
,
"
post
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
remove
"
,
"
put
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
remove
"
,
"
putAttachment
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
wait
);
that
.
addActionRule
(
"
remove
"
,
"
remove
"
,
[
that
.
sameDocumentId
,
that
.
sameRevision
],
that
.
update
);
that
.
addActionRule
(
'
allDocs
'
,
true
,
'
allDocs
'
,
that
.
update
);
that
.
addActionRule
(
'
allDocs
'
,
false
,
'
allDocs
'
,
that
.
update
);
that
.
addActionRule
(
"
get
"
,
"
get
"
,
[
that
.
sameDocument
,
that
.
sameOption
],
that
.
update
);
that
.
addActionRule
(
"
allDocs
"
,
"
allDocs
"
,
[
that
.
sameDocument
,
that
.
sameOption
],
that
.
update
);
that
.
addActionRule
(
'
putAttachment
'
,
true
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
putAttachment
'
,
true
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
true
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
true
,
'
remove
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
true
,
'
putAttachment
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
false
,
'
post
'
,
that
.
update
);
that
.
addActionRule
(
'
putAttachment
'
,
false
,
'
put
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
false
,
'
get
'
,
that
.
wait
);
that
.
addActionRule
(
'
putAttachment
'
,
false
,
'
remove
'
,
that
.
eliminate
);
that
.
addActionRule
(
'
putAttachment
'
,
false
,
'
putAttachment
'
,
that
.
update
);
// end adding rules
////////////////////////////////////////////////////////////////////////////
return
that
;
...
...
test/jiotests.js
View file @
fd0b1d71
...
...
@@ -642,12 +642,26 @@ test ("Similar Jobs at the same time (Update)", function () {
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job1 ok
"
,
"
f
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job2 ok
"
,
"
f2
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job3 ok
"
,
"
f3
"
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f2
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f3
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
// 1
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f2
);
// 2
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f3
);
// 3
deepEqual
(
getLastJob
(
o
.
jio
.
getId
()).
id
,
1
,
"
Check job queue
"
);
console
.
log
(
JSON
.
parse
(
JSON
.
stringify
(
localStorage
)));
o
.
tick
(
o
,
1000
,
"
f
"
);
o
.
tick
(
o
,
"
f2
"
);
o
.
tick
(
o
,
"
f3
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job4 ok
"
,
"
f
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job5 ok
"
,
"
f2
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job6 ok
"
,
"
f3
"
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
// 4
o
.
jio
.
remove
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f2
);
// 5
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f3
);
// 6
deepEqual
(
getLastJob
(
o
.
jio
.
getId
()).
id
,
5
,
"
Check job queue
"
);
o
.
tick
(
o
,
1000
,
"
f
"
);
o
.
tick
(
o
,
"
f2
"
);
o
.
tick
(
o
,
"
f3
"
);
o
.
jio
.
stop
();
});
...
...
@@ -659,15 +673,15 @@ test ("One document aim jobs at the same time (Wait for job(s))" , function () {
o
.
jio
=
JIO
.
newJio
({
"
type
"
:
"
dummyallok
"
});
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job1
"
,
"
f
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job2
"
,
"
f2
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
_id
"
:
"
file
"
,
"
title
"
:
"
get_tit
le
"
},
"
job3
"
,
"
f3
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
fi
le
"
},
"
job3
"
,
"
f3
"
);
o
.
jio
.
p
os
t
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
o
.
jio
.
p
u
t
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
o
.
testLastJobWaitForJob
(
undefined
,
"
job1 is not waiting for someone
"
);
o
.
jio
.
put
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f2
);
o
.
jio
.
remove
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f2
);
o
.
testLastJobWaitForJob
([
1
],
"
job2 is waiting
"
);
o
.
jio
.
ge
t
({
"
_id
"
:
"
file
"
},
o
.
f3
);
o
.
jio
.
pu
t
({
"
_id
"
:
"
file
"
},
o
.
f3
);
o
.
testLastJobWaitForJob
([
1
,
2
],
"
job3 is waiting
"
);
o
.
tick
(
o
,
1000
,
"
f
"
);
...
...
@@ -677,26 +691,6 @@ test ("One document aim jobs at the same time (Wait for job(s))" , function () {
});
test
(
"
One document aim jobs at the same time (Elimination)
"
,
function
()
{
var
o
=
generateTools
(
this
);
o
.
jio
=
JIO
.
newJio
({
"
type
"
:
"
dummyallok
"
});
o
.
spy
(
o
,
"
status
"
,
10
,
"
job1 stopped
"
,
"
f
"
);
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
file
"
},
"
job2
"
,
"
f2
"
);
o
.
jio
.
post
({
"
_id
"
:
"
file
"
,
"
content
"
:
"
content
"
},
o
.
f
);
o
.
testLastJobLabel
(
"
post
"
,
"
job1 exists
"
);
o
.
jio
.
remove
({
"
_id
"
:
"
file
"
},
o
.
f2
);
o
.
testLastJobLabel
(
"
remove
"
,
"
job1 does not exist anymore
"
);
o
.
tick
(
o
,
1000
,
"
f
"
);
o
.
tick
(
o
,
"
f2
"
);
o
.
jio
.
stop
();
});
test
(
"
Server will be available soon (Wait for time)
"
,
function
()
{
var
o
=
generateTools
(
this
);
...
...
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