Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 8cbf544

Browse files
committed
Alter import to pick up user rather than assignee;
additional tests and fixes for tests
1 parent c2e3c26 commit 8cbf544

File tree

8 files changed

+42
-60
lines changed

8 files changed

+42
-60
lines changed

src/test/suites/e2e-rest-process-json/015-processmodel-json.xqy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ return (
123123
return (
124124
test:assert-equal('done', xs:string($properties/processingStatus)),
125125
test:assert-equal('user', xs:string($properties/currentStep/type)),
126-
test:assert-equal('admin', xs:string($properties/currentStep/assignee)),
126+
test:assert-equal('admin', xs:string($properties/currentStep/user)),
127127
test:assert-equal('userTask', xs:string($properties/currentStep/stepType)),
128128
test:assert-equal('ENTERED', xs:string($properties/currentStep/stepStatus))
129129
)

src/test/suites/e2e-rest-process-xml/015-processmodel-xml.xqy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ declare namespace http = "xdmp:http";
1010

1111
let $process := wrt:processmodel-create ($const:xml-options, "015-restapi-tests.bpmn")
1212
let $_testlog := xdmp:log("E2E XML TEST: 01-processmodel-create")
13-
return (
13+
return (
1414
test:assert-equal('200', xs:string($process[1]/http:code)),
1515
test:assert-equal('SUCCESS', xs:string($process[2]/ext:createResponse/ext:outcome)),
16-
test:assert-equal('015-restapi-tests__1__0', xs:string($process[2]/ext:createResponse/ext:modelId))
16+
test:assert-equal('015-restapi-tests__1__0', xs:string($process[2]/ext:createResponse/ext:modelId))
1717
);
1818
(:
1919
<ext:createResponse xmlns:ext="http://marklogic.com/rest-api/resource/processmodel">
@@ -46,10 +46,10 @@ declare namespace http = "xdmp:http";
4646

4747
let $result := wrt:test-03-processmodel-update($const:xml-options)
4848
let $_testlog := xdmp:log("E2E XML TEST: 03-processmodel-update")
49-
return (
49+
return (
5050
test:assert-equal('200', xs:string($result[1]/http:code)),
5151
test:assert-equal('SUCCESS', xs:string($result[2]/ext:createResponse/ext:outcome)),
52-
test:assert-equal('015-restapi-tests__1__2', xs:string($result[2]/ext:createResponse/ext:modelId))
52+
test:assert-equal('015-restapi-tests__1__2', xs:string($result[2]/ext:createResponse/ext:modelId))
5353
);
5454
(:
5555
<ext:createResponse xmlns:ext="http://marklogic.com/rest-api/resource/processmodel">
@@ -68,10 +68,10 @@ declare namespace http = "xdmp:http";
6868
let $_testlog := xdmp:log("E2E XML TEST: 04-processmodel-publish")
6969
(: not working with XML ? :)
7070
let $result := wrt:processmodel-publish($const:xml-options, "015-restapi-tests__1__2")
71-
return (
71+
return (
7272
test:assert-equal('200', xs:string($result[1]/http:code)),
7373
test:assert-equal('SUCCESS', xs:string($result[2]/ext:updateResponse/ext:outcome)),
74-
test:assert-exists(xs:string($result[2]/ext:updateResponse/ext:domainId))
74+
test:assert-exists(xs:string($result[2]/ext:updateResponse/ext:domainId))
7575
);
7676
(:
7777
<ext:updateResponse xmlns:ext="http://marklogic.com/rest-api/resource/processmodel">
@@ -153,7 +153,7 @@ return (
153153
return (
154154
test:assert-equal('done', xs:string($properties/cpf:processing-status)),
155155
test:assert-equal('user', xs:string($properties/wf:currentStep/wf:type)),
156-
test:assert-equal('admin', xs:string($properties/wf:currentStep/wf:assignee)),
156+
test:assert-equal('admin', xs:string($properties/wf:currentStep/wf:user)),
157157
test:assert-equal('userTask', xs:string($properties/wf:currentStep/wf:step-type)),
158158
test:assert-equal('ENTERED', xs:string($properties/wf:currentStep/wf:step-status))
159159
)

src/test/suites/inclusive-gateway/inclusive-gateway-01.xqy

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(:
2-
This test checks that for an inclusive gateway with two downstream routes, only one of which is activated,
2+
This test checks that for an inclusive gateway with two downstream routes, only one of which is activated,
33
rendezvousing is conditional only on the activated task being completed.
4-
:)
4+
:)
55
(:
66
Create process model for Inclusive Gateway Test 01, and check it has been created correctly
77
:)
@@ -23,7 +23,7 @@ return
2323
(
2424
test:assert-equal(xs:string($model-response/model:createResponse/model:outcome/text()),"SUCCESS"),
2525
test:assert-equal(xs:string($model-response/model:createResponse/model:modelId/text()),test-constants:expected-model-id($test-constants:TEST-01-MODEL-NAME))
26-
)
26+
)
2727
;
2828
(:
2929
Create process for Inclusive Gateway Test 01. Check success. Check pid exists and save.
@@ -48,7 +48,7 @@ return
4848
)
4949
;
5050
(: Need to sleep to ensure asynchronous behaviour has completed :)
51-
xdmp:sleep(2000)
51+
xdmp:sleep(5000)
5252
;
5353
(:
5454
Check process has entered the first gateway ( and effectively stopped there )
@@ -66,10 +66,13 @@ let $process-state := wrt:process-read($const:xml-options,$test-pid)[2]/ext:read
6666
let $current-state := ($process-state/ext:document/wf:process/wf:audit-trail/wf:audit)[fn:last()]/wf:state/text()
6767
return
6868
(
69-
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
70-
test:assert-equal("InclusiveGateway_1",fn:tokenize($current-state,"/")[fn:last()])
69+
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
70+
test:assert-equal("InclusiveGateway_1",fn:tokenize($current-state,"/")[fn:last()])
7171
)
7272
;
73+
(: Need to sleep to ensure asynchronous behaviour has completed :)
74+
xdmp:sleep(10000)
75+
;
7376

7477
(: test inbox lists wf:user processinbox-read :)
7578
import module namespace test-constants = "http://marklogic.com/workflow/test-constants/inclusive-gateway" at "/test/suites/inclusive-gateway/lib/constants.xqy";
@@ -82,8 +85,8 @@ declare namespace http = "xdmp:http";
8285
declare namespace prop = "http://marklogic.com/xdmp/property";
8386
declare namespace wf="http://marklogic.com/workflow";
8487

85-
let $_pause := xdmp:sleep(10000)
8688
let $test-pid := fn:doc(test-constants:test-pid-uri($test-constants:TEST-01-MODEL-NAME))/test-constants:pid/text()
89+
let $test-pid := fn:substring-before($test-pid, "+") (: some platforms not handling timezone well :)
8790
let $child-pid := /wf:process[fn:matches(wf:parent,$test-pid)]/@id/fn:string()
8891
let $result := wrt:test-08-processinbox-read($const:xml-options)
8992
return (
@@ -120,10 +123,11 @@ declare namespace wf = "http://marklogic.com/workflow";
120123
declare namespace ext = "http://marklogic.com/rest-api/resource/process";
121124

122125
let $test-pid := fn:doc(test-constants:test-pid-uri($test-constants:TEST-01-MODEL-NAME))/test-constants:pid/text()
126+
let $test-pid := fn:substring-before($test-pid, "+") (: some platforms not handling timezone well :)
123127
let $child-pid := /wf:process[fn:matches(wf:parent,$test-pid)]/@id/fn:string()
124128
let $update-response := wrt:call-complete-on-pid($const:xml-options,$child-pid)/ext:updateResponse
125129
return
126-
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
130+
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
127131
;
128132
(: Need to sleep to ensure asynchronous behaviour has completed :)
129133
xdmp:sleep(2000)

src/test/suites/inclusive-gateway/inclusive-gateway-02.xqy

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ return
2222
(
2323
test:assert-equal(xs:string($model-response/model:createResponse/model:outcome/text()),"SUCCESS"),
2424
test:assert-equal(xs:string($model-response/model:createResponse/model:modelId/text()),test-constants:expected-model-id($test-constants:TEST-02-MODEL-NAME))
25-
)
25+
)
2626
;
2727
(:
2828
Create process for Inclusive Gateway Test 02. Check success. Check pid exists and save.
@@ -47,9 +47,7 @@ return
4747
)
4848
;
4949
(: Need to sleep to ensure asynchronous behaviour has completed :)
50-
import module namespace test-config = "http://marklogic.com/roxy/test-config" at "/test/test-config.xqy";
51-
52-
test-config:test-sleep()
50+
xdmp:sleep(10000)
5351
;
5452
(:
5553
Check process has entered the first gateway ( and effectively stopped there )
@@ -67,10 +65,9 @@ let $process-state := wrt:process-read($const:xml-options,$test-pid)[2]/ext:read
6765
let $current-state := ($process-state/ext:document/wf:process/wf:audit-trail/wf:audit)[fn:last()]/wf:state/text()
6866
return
6967
(
70-
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
71-
test:assert-equal("InclusiveGateway_1",fn:tokenize($current-state,"/")[fn:last()])
72-
)
73-
;
68+
test:assert-equal("SUCCESS", xs:string($process-state/ext:outcome/text())),
69+
test:assert-equal("InclusiveGateway_1", fn:tokenize($current-state,"/")[fn:last()])
70+
);
7471
(:
7572
Fork has not rendezvoused because there are user tasks requiring completion. We complete the first one.
7673
:)
@@ -83,10 +80,11 @@ declare namespace wf = "http://marklogic.com/workflow";
8380
declare namespace ext = "http://marklogic.com/rest-api/resource/process";
8481

8582
let $test-pid := fn:doc(test-constants:test-pid-uri($test-constants:TEST-02-MODEL-NAME))/test-constants:pid/text()
83+
let $test-pid := fn:substring-before($test-pid, "+") (: some platforms not handling timezone well :)
8684
let $child-pid := (/wf:process[fn:matches(wf:parent,$test-pid)]/@id/fn:string())[1]
8785
let $update-response := wrt:call-complete-on-pid($const:xml-options,$child-pid)/ext:updateResponse
8886
return
89-
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
87+
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
9088
;
9189
(: Need to sleep to ensure asynchronous behaviour has completed :)
9290
import module namespace test-config = "http://marklogic.com/roxy/test-config" at "/test/test-config.xqy";
@@ -110,8 +108,8 @@ let $penultimate-state := ($process-state/ext:document/wf:process/wf:audit-trail
110108
let $current-state := ($process-state/ext:document/wf:process/wf:audit-trail/wf:audit)[fn:last()]/wf:state/text()
111109
return
112110
(
113-
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
114-
test:assert-equal("InclusiveGateway_1",fn:tokenize($current-state,"/")[fn:last()])
111+
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
112+
test:assert-equal("InclusiveGateway_1",fn:tokenize($current-state,"/")[fn:last()])
115113
)
116114
;
117115
(:
@@ -126,10 +124,11 @@ declare namespace wf = "http://marklogic.com/workflow";
126124
declare namespace ext = "http://marklogic.com/rest-api/resource/process";
127125

128126
let $test-pid := fn:doc(test-constants:test-pid-uri($test-constants:TEST-02-MODEL-NAME))/test-constants:pid/text()
127+
let $test-pid := fn:substring-before($test-pid, "+") (: some platforms not handling timezone well :)
129128
let $child-pid := (/wf:process[fn:matches(wf:parent,$test-pid)]/@id/fn:string())[2]
130129
let $update-response := wrt:call-complete-on-pid($const:xml-options,$child-pid)/ext:updateResponse
131130
return
132-
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
131+
test:assert-equal(xs:string($update-response/ext:outcome/text()),"SUCCESS")
133132
;
134133
(: Need to sleep to ensure asynchronous behaviour has completed :)
135134
import module namespace test-config = "http://marklogic.com/roxy/test-config" at "/test/test-config.xqy";
@@ -153,8 +152,8 @@ let $penultimate-state := ($process-state/ext:document/wf:process/wf:audit-trail
153152
let $current-state := ($process-state/ext:document/wf:process/wf:audit-trail/wf:audit)[fn:last()]/wf:state/text()
154153
return
155154
(
156-
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
157-
test:assert-equal("EndEvent_1",fn:tokenize($current-state,"/")[fn:last()]),
158-
test:assert-equal("InclusiveGateway_1__rv",fn:tokenize($penultimate-state,"/")[fn:last()])
155+
test:assert-equal(xs:string($process-state/ext:outcome/text()),"SUCCESS"),
156+
test:assert-equal("EndEvent_1",fn:tokenize($current-state,"/")[fn:last()]),
157+
test:assert-equal("InclusiveGateway_1__rv",fn:tokenize($penultimate-state,"/")[fn:last()])
159158
)
160159
;

src/test/suites/inclusive-gateway/lib/constants.xqy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ declare function test-pid-uri($model-name as xs:string) as xs:string{
2323
declare function save-pid($pid,$model-name){
2424
let $pid-content := element test-constants:pid{$pid}
2525
return
26-
xdmp:document-insert(test-pid-uri($model-name),$pid-content)
26+
xdmp:document-insert(test-pid-uri($model-name),$pid-content)
2727
};
2828

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
import module namespace test-constants = "http://marklogic.com/workflow/test-constants/inclusive-gateway" at "/test/suites/inclusive-gateway/lib/constants.xqy";
2-
import module namespace const="http://marklogic.com/roxy/workflow-constants" at "/test/workflow-constants.xqy";
3-
import module namespace wrt="http://marklogic.com/workflow/rest-tests" at "/test/workflow-rest-tests.xqy";
4-
import module namespace test = "http://marklogic.com/roxy/test-helper" at "/test/test-helper.xqy";
5-
6-
declare namespace ext = "http://marklogic.com/rest-api/resource/process";
7-
declare namespace wf = "http://marklogic.com/workflow";
8-
declare namespace p = "http://marklogic.com/cpf/pipelines";
9-
10-
11-
for $process-model-name in $test-constants:TEST-MODEL-NAMES
12-
return
1+
xquery version "1.0-ml";
132
(
14-
(: Delete processes generated by these tests :)
15-
/wf:process[wf:process-definition-name = $process-model-name] ! xdmp:document-delete(fn:base-uri(.)),
16-
(: Remove children of these processes :)
17-
let $test-pid := fn:doc(test-constants:test-pid-uri($process-model-name))/test-constants:pid/text()
18-
return
19-
/wf:process[fn:matches(wf:process-definition-name,$process-model-name)] ! xdmp:document-delete(fn:base-uri(.)),
20-
(: Delete test pid document :)
21-
xdmp:document-delete(test-constants:test-pid-uri($process-model-name)),
22-
(: Delete model files :)
23-
cts:uris()[fn:matches(.,test-constants:file-name-for-model($process-model-name))] ! xdmp:document-delete(.),
24-
(: Delete associated pipelines :)
25-
//p:pipeline-name[fn:matches(.,$process-model-name)] ! xdmp:document-delete(fn:base-uri(.))
26-
)
3+
xdmp:directory-delete("/"),
4+
xdmp:collection-delete("http://marklogic.com/cpf/pipelines")
5+
)

src/test/test-config.xqy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ declare variable $LOCAL-TEST-DATA-DIR := "/raw/bpmn/";
2626
declare variable $SLEEP-FOR-ASYNC := 5; (: Sleep period required, in seconds, for async tasks :)
2727

2828
declare function local-uri-for-test-file($test-file-name as xs:string){
29-
$LOCAL-TEST-DATA-DIR||$test-file-name
29+
$LOCAL-TEST-DATA-DIR||$test-file-name
3030
};
3131

3232
declare function test-sleep(){
3333
xdmp:sleep($SLEEP-FOR-ASYNC * 1000)
34-
};
34+
};

src/workflowengine/models/workflow-import.xqy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ declare function m:b2userTask($rootName as xs:string,$parentStep as xs:string?,$
10701070
<p:options xmlns:p="http:marklogic.com/cpf/pipelines">
10711071
<wf:type>{$type}</wf:type>
10721072
{
1073-
if (fn:not(fn:empty($user))) then <wf:assignee>{$user}</wf:assignee> else ()
1073+
if (fn:not(fn:empty($user))) then <wf:user>{$user}</wf:user> else ()
10741074
}
10751075
{
10761076
if (fn:not(fn:empty($queue))) then <wf:queue>{$queue}</wf:queue> else ()

0 commit comments

Comments
 (0)