This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from aclavio/develop
Release 1.1.0
- Loading branch information
Showing
40 changed files
with
1,251 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include "state-conductor-modules", "state-conductor-dataservices", "state-conductor-example", "state-conductor-dhf5-example" | ||
include "state-conductor-modules", "state-conductor-dataservices", "state-conductor-example", "state-conductor-dhf5-example", "state-conductor-corb-example" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#=========== Do not change ========== | ||
URIS-MODULE=/state-conductor/corb2/uris-module.sjs | ||
PROCESS-MODULE=state-conductor/corb2/process-module.sjs | ||
PROCESS-MODULE=/state-conductor/corb2/process-module.sjs | ||
EXIT-CODE-NO-URIS=3 | ||
#==================================== | ||
|
||
#=== User Configurable Properties === | ||
XCC-CONNECTION-URI= | ||
URIS-MODULE.jobCount=500 | ||
URIS-MODULE.executionCount=500 | ||
URIS-MODULE.resumeWait=true | ||
#URIS-MODULE.flowNames= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ mlHost=localhost | |
mlPort=9010 | ||
username=admin | ||
password=admin | ||
server.port=9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...test/ml-modules/root/test/suites/StateConductorDHF5Suite/test-dhf5RunFlowStepActionSQ.sjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use strict'; | ||
const test = require('/test/test-helper.xqy'); | ||
const dhf5RunFlowStepAction = require('/state-conductor/actions/common/dhf/dhf5RunFlowStepAction.sjs'); | ||
|
||
const uri1 = '/data/janedoe.json'; | ||
const uri2 = '/data/johndoe.json'; | ||
|
||
// helper to allow processing in seperate transactions | ||
function isolate(func, db) { | ||
db = db || xdmp.database(); | ||
return fn.head( | ||
xdmp.invokeFunction( | ||
() => { | ||
declareUpdate(); | ||
return func(); | ||
}, | ||
{ | ||
isolation: 'different-transaction', | ||
commit: 'auto', | ||
database: db, | ||
} | ||
) | ||
); | ||
} | ||
|
||
const assertions = []; | ||
|
||
// run a test documents through the CustomFlow flow step 1 using it's sourceQuery | ||
let flowName = 'CustomFlow'; | ||
let step = 1; | ||
|
||
let original1 = isolate(() => cts.doc(uri1).toObject()); | ||
let original2 = isolate(() => cts.doc(uri2).toObject()); | ||
let resp = isolate(() => | ||
dhf5RunFlowStepAction.performAction(null, { | ||
flowName: flowName, | ||
step: step, | ||
useSourceQuery: true, | ||
}) | ||
); | ||
let transformed1 = isolate(() => cts.doc(uri1).toObject()); | ||
let transformed2 = isolate(() => cts.doc(uri2).toObject()); | ||
|
||
xdmp.log(resp); | ||
xdmp.log(transformed1); | ||
xdmp.log(transformed2); | ||
|
||
let flowResult = resp[flowName]; | ||
assertions.push(test.assertTrue(flowResult !== null)); | ||
|
||
let stepResult = flowResult['' + step]; | ||
assertions.push(test.assertTrue(stepResult !== null)); | ||
|
||
assertions.push( | ||
test.assertTrue(stepResult.jobId.length > 0), | ||
test.assertEqual(2, stepResult.totalCount, 'found souceQuery docs'), | ||
test.assertEqual(0, stepResult.errorCount), | ||
test.assertTrue(stepResult.completedItems.includes(uri1)), | ||
test.assertTrue(stepResult.completedItems.includes(uri2)), | ||
|
||
test.assertTrue(transformed1.envelope != null), | ||
test.assertTrue(transformed1.envelope.headers != null), | ||
test.assertTrue(transformed1.envelope.headers.createdOn.length > 0), | ||
test.assertTrue(transformed1.envelope.headers.randomUuid.length > 0), | ||
test.assertTrue(transformed1.envelope.triples != null), | ||
test.assertTrue(transformed1.envelope.instance != null), | ||
test.assertEqual('Jane', transformed1.envelope.instance.firstName), | ||
test.assertEqual('Doe', transformed1.envelope.instance.lastName), | ||
test.assertEqual(JSON.stringify(original1), JSON.stringify(transformed1.envelope.instance)), | ||
test.assertTrue(isolate(() => xdmp.documentGetCollections(uri1).includes('MyCustomStep'))), | ||
test.assertTrue(isolate(() => xdmp.documentGetMetadata(uri1).datahubCreatedInFlow === flowName)), | ||
test.assertTrue( | ||
isolate(() => xdmp.documentGetMetadata(uri1).datahubCreatedByStep === 'MyCustomStep') | ||
), | ||
|
||
test.assertTrue(transformed2.envelope != null), | ||
test.assertTrue(transformed2.envelope.headers != null), | ||
test.assertTrue(transformed2.envelope.headers.createdOn.length > 0), | ||
test.assertTrue(transformed2.envelope.headers.randomUuid.length > 0), | ||
test.assertTrue(transformed2.envelope.triples != null), | ||
test.assertTrue(transformed2.envelope.instance != null), | ||
test.assertEqual('John', transformed2.envelope.instance.firstName), | ||
test.assertEqual('Doe', transformed2.envelope.instance.lastName), | ||
test.assertEqual(JSON.stringify(original2), JSON.stringify(transformed2.envelope.instance)), | ||
test.assertTrue(isolate(() => xdmp.documentGetCollections(uri2).includes('MyCustomStep'))), | ||
test.assertTrue(isolate(() => xdmp.documentGetMetadata(uri2).datahubCreatedInFlow === flowName)), | ||
test.assertTrue( | ||
isolate(() => xdmp.documentGetMetadata(uri2).datahubCreatedByStep === 'MyCustomStep') | ||
) | ||
); | ||
|
||
// return | ||
assertions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# MarkLogic State Conductor Example Project | ||
|
||
_TODO_ | ||
# MarkLogic State Conductor Example Project | ||
|
||
State Conductor examples and unit tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.