Created
January 6, 2017 19:17
-
-
Save grechaw/f9cf66b06b5368d2303f8537c3dbb90a to your computer and use it in GitHub Desktop.
This script simply takes a QA harness REST test and transforms it into a QConsole workspace so that you can run it interactively.
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
(: turn a QA Harness test file into a QConsole Workspace :) | |
declare namespace h = "http://marklogic.com/xdmp/harness"; | |
let $QA_HOME := "/MarkLogic/git/qa-trunk" | |
let $source := ($QA_HOME || "/scripts/tests/rest-client-api-documents-06.xml") | |
=>xdmp:filesystem-file() | |
=>xdmp:unquote() | |
let $queries := | |
for $test in $source/h:script/h:test | |
let $query-text := $test/h:query/text() | |
=>fn:replace("rest_api_test_port", "12345") | |
=>fn:replace("QA_HOME",$QA_HOME) | |
return | |
<query name="{$test/h:name}" mode="xquery">{$query-text}</query> | |
let $workspace := <export><workspace name="QA Harness Export">{$queries}</workspace></export> | |
return xdmp:save("/share/w.xml", $workspace) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The results of this particular example, once imported into QC, requires one XQuery module in the Modules database in order to run in QConsole. I installed it like this:
curl -X PUT -d@rest-client-api-common.xqy -Hcontent-type:application/xquery "http://localhost:8000/v1/documents?database=Modules&uri=/rest-client-api-common.xqy"