Skip to content

Commit 26baee3

Browse files
committed
changes for code review
1 parent 11947fa commit 26baee3

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mlAppName=marklogic-unit-test-testapp
66
mlHost=localhost
77
mlUsername=admin
88
mlPassword=admin
9-
mlRestPort=8090
9+
mlRestPort=8030
1010
mlContentForestsPerHost=1
1111

1212
# Load both the ml-unit-test framework code and some test modules

src/main/ml-modules/root/test/formats/j-unit.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Convert default ml-uni-test report XML output to valid JUnit report XML
2+
Convert default ml-unit-test report XML output to valid JUnit report XML
33
-->
44
<xsl:stylesheet version="2.0"
55
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

src/main/ml-modules/root/test/test-controller.xqy

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import module namespace helper = "http://marklogic.com/roxy/test-helper" at "/te
1414
declare namespace t="http://marklogic.com/roxy/test";
1515

1616
declare variable $FS-PATH as xs:string := if (xdmp:platform() eq "winnt") then "\" else "/";
17+
declare variable $XSL-PATTERN as xs:string := "\.xslt?$";
1718
declare variable $TEST-SUITES-ROOT := "/test/suites/";
1819
declare variable $db-id as xs:unsignedLong := xdmp:modules-database();
1920
declare variable $root as xs:string := xdmp:modules-root();
@@ -45,14 +46,14 @@ declare function list()
4546
$path)
4647
let $main-formats as xs:string* :=
4748
if ($db-id = 0) then
48-
xdmp:filesystem-directory(fn:concat($root, $FS-PATH, "test/formats"))/dir:entry[dir:type = "file" and fn:not(dir:filename = $test-ignore-list)]/dir:filename[fn:ends-with(., ".xsl")]
49+
xdmp:filesystem-directory(fn:concat($root, $FS-PATH, "test/formats"))/dir:entry[dir:type = "file" and fn:not(dir:filename = $test-ignore-list)]/dir:filename[fn:matches(., $XSL-PATTERN)]
4950
else
5051
let $uris := helper:list-from-database($db-id, $root, (), 'formats')
5152
return
5253
fn:distinct-values(
5354
for $uri in $uris
5455
let $path := fn:replace($uri, fn:concat($root, "test/formats/"), "")
55-
where $path ne "" and fn:not(fn:contains($path, "/")) and fn:not($path = $test-ignore-list) and (fn:ends-with($path, ".xsl"))
56+
where $path ne "" and fn:not(fn:contains($path, "/")) and fn:not($path = $test-ignore-list) and (fn:matches($path, $XSL-PATTERN))
5657
return
5758
$path)
5859
return (
@@ -70,19 +71,6 @@ declare function list()
7071
where $path ne "" and fn:not(fn:contains($path, "/")) and fn:not($path = $test-ignore-list) and (fn:ends-with($path, ".xqy") or fn:ends-with($path, ".sjs"))
7172
return
7273
$path)
73-
let $formats as xs:string* :=
74-
if ($db-id = 0) then
75-
xdmp:filesystem-directory(fn:concat($root, $FS-PATH, "test/suites/", $suite, "/formats"))/dir:entry[dir:type = "file" and fn:not(dir:filename = $test-ignore-list)]/dir:filename[fn:ends-with(., ".xsl")]
76-
else
77-
let $uris := helper:list-from-database(
78-
$db-id, $root, fn:concat($suite, '/formats/'), 'suites')
79-
return
80-
fn:distinct-values(
81-
for $uri in $uris
82-
let $path := fn:replace($uri, fn:concat($root, "test/suites/", $suite, "/formats/"), "")
83-
where $path ne "" and fn:not(fn:contains($path, "/")) and fn:not($path = $test-ignore-list) and (fn:ends-with($path, ".xsl"))
84-
return
85-
$path)
8674
where $tests
8775
return
8876
element t:suite {
@@ -93,16 +81,7 @@ declare function list()
9381
element t:test {
9482
attribute path {$test}
9583
}
96-
},
97-
if ($formats) then
98-
element t:formats {
99-
for $format in $formats
100-
return
101-
element t:format {
102-
attribute path {$format}
103-
}
104-
}
105-
else ()
84+
}
10685
},
10786
if ($main-formats) then
10887
element t:formats {
@@ -256,12 +235,15 @@ declare function format($result as element(), $format as xs:string, $suite as xs
256235
if ($format eq "junit") then
257236
format-junit($suite)
258237
else
259-
let $format-uris := helper:list-from-database($db-id, $root, (), 'formats')
260-
let $suite-format-uris := helper:list-from-database($db-id, $root, $suite || '/formats/', 'suites')
238+
let $format-uris :=
239+
if ($db-id = 0) then
240+
xdmp:filesystem-directory(fn:concat($root, $FS-PATH, "test/formats"))/dir:entry[dir:type = "file"]/dir:filename[fn:matches(., $XSL-PATTERN)]
241+
else
242+
helper:list-from-database($db-id, $root, (), 'formats')
261243
let $xsl-match :=
262-
for $uri in ($format-uris, $suite-format-uris)
244+
for $uri in $format-uris
263245
return
264-
if (fn:matches(fn:tokenize($uri, '/')[fn:last()], '^' || $format || '(\.xsl)?$')) then $uri
246+
if (fn:matches(fn:tokenize($uri, '/')[fn:last()], '^' || $format || $XSL-PATTERN)) then $uri
265247
else ()
266248
return
267249
if ($xsl-match) then

0 commit comments

Comments
 (0)