Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to accommodate CI/CD #1985

Merged
merged 4 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
https://github.com/usnistgov/OSCAL/discussions/1114
When this is determined, tests can be added for those sections. -->

<!-- Location of sample files, relative to compiled test in xspec/ subdirectory -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../../../specifications/profile-resolution/profile-resolution-examples')"/>
<!-- Location of sample files, relative to this test file -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../specifications/profile-resolution/profile-resolution-examples',$x:xspec-uri)"/>

<x:scenario label="Import controls using ID mapping">
<x:scenario label="Basic case" pending="Mapping is not implemented yet">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
stylesheet="../../oscal-profile-resolve-select.xsl">

<!-- Location of sample files, relative to compiled test in xspec/ subdirectory -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../../../specifications/profile-resolution/profile-resolution-examples')"/>
<!-- Location of sample files, relative to this test file -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../specifications/profile-resolution/profile-resolution-examples',$x:xspec-uri)"/>

<x:scenario label="Direct import by file href">
<x:context>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/resolver-pipeline/testing/1_selected/select.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
stylesheet="../../oscal-profile-resolve-select.xsl"
xslt-version="3.0">

<!-- Location of sample files, relative to compiled test in xspec/ subdirectory -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../../../specifications/profile-resolution/profile-resolution-examples')"/>
<!-- Location of sample files, relative to this test file -->
<x:variable name="ov:filedir" as="xs:string" select="resolve-uri('../../../../specifications/profile-resolution/profile-resolution-examples',$x:xspec-uri)"/>

<x:variable name="ov:unique" as="function(*)"
select="function($seq as xs:string*) as xs:boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
xmlns:javaUUID="java.util.UUID"
xmlns:ov="http://csrc.nist.gov/ns/oscal/xspec/variable"
xmlns:u="http://csrc.nist.gov/ns/uuid"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Expand All @@ -8,7 +9,7 @@
<x:scenario label="Tests for u:determine-uuid template">
<x:variable name="ov:fixed" as="xs:string" select="'00000000-0000-4000-B000-000000000000'"/>
<x:variable name="ov:specified" as="xs:string" select="'f0ad1e6c-5de5-44cd-b92e-a4c507805f0f'"/>
<x:variable name="ov:service" as="xs:string" select="resolve-uri('../uuid-value.txt')"/>
<x:variable name="ov:service" as="xs:string" select="resolve-uri('uuid-value.txt',$x:xspec-uri)"/>
<x:scenario label="Valid user-provided UUID">
<x:call template="u:determine-uuid">
<x:param name="top-uuid" select="$ov:specified"/>
Expand Down Expand Up @@ -37,16 +38,22 @@
<x:expect label="UUID is neither fixed one nor specified one"
test="$x:result ne $ov:specified and $x:result ne $ov:fixed"/>
</x:scenario>
<x:scenario label="Random UUID using Java">
<x:scenario label="Random UUID using Java (Note: Not available in CI/CD)">
<x:call template="u:determine-uuid">
<x:param name="top-uuid" select="$ov:specified"/>
<x:param name="uuid-method" select="'random-java'"/>
</x:call>
<x:expect label="Nonempty string"
test="$x:result instance of xs:string and $x:result != ''"/>
<x:variable name="ov:java-fcn-available" as="xs:boolean"
select="function-available('javaUUID:randomUUID')"/>
<x:expect label="Nonempty"
test="if ($ov:java-fcn-available)
then (string($x:result) != '')
else true()"/>
<x:expect label="UUID is neither fixed one nor specified one"
test="$x:result ne $ov:specified and $x:result ne $ov:fixed"/>
</x:scenario>
test="if ($ov:java-fcn-available)
then (string($x:result) ne $ov:specified and string($x:result) ne $ov:fixed)
else true()"/>
</x:scenario>
<!-- FYI: Because the transform relies on use-when, which is evaluated at
compile time, the same test invocation cannot check both
when the XSLT and Java random number generators are available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@
</control>
</x:expect>
</x:scenario>
<x:scenario label="include-controls with parent controls (default choice)">
<x:scenario label="include-controls with parent controls (default choice)"
pending="Needs confirmation about latest expected result">
<x:context mode="o:custom-merge" select="//o:include-controls">
<catalog uuid="xyz-tiny_catalog">
<selection>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/resolver-pipeline/testing/4_modified/modify.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@

<x:scenario label="Tests for match=set-parameter template">
<x:scenario label="set-param child does not match anything">
<x:context select="//set-parameter">
<x:context select="//o:set-parameter">
<catalog id="abc">
<param id="p1">
<label>Parameter #1</label>
Expand Down Expand Up @@ -1158,7 +1158,7 @@
</x:scenario>
<x:scenario label="Edge case: Empty $modifications param">
<x:call function="oscal:patches-to-id-targeting-ancestor">
<x:param name="here" select="id('a1-stmt')">
<x:param name="here" select="//*[@id='a1-stmt']">
iMichaela marked this conversation as resolved.
Show resolved Hide resolved
<catalog id="abc">
<control id="a1">
<title>Control A</title>
Expand Down