From 71cb48296c5f6adb39ff455164879ff4cbb27e4d Mon Sep 17 00:00:00 2001 From: galtm <40716346+galtm@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:15:34 -0500 Subject: [PATCH] Profile resolver selection: XSpec additions and minor XSLT enhancements (#1101) * Group scenarios and add edge case scenario * Group the scenarios that test o:glob-as-regex. * Add scenario for edge case where input is empty. * For selection, augment XSpec and update XSLT * Add XSpec tests for oscal-profile-resolve-select.xsl, mostly at the level of templates and functions. * Minor enhancements in oscal-profile-resolve-select.xsl: * Add support for with-parent-controls * Generate fatal error if resource cannot be fetched * Provide focused error message if resource has no suitable rlink * Handle missing matching pattern * Fix indentation * Fix scenario that intentionally omits pattern * Rename o:resource-or-warning as o:resource-or-error * Attributes, not elements, for "from" and "to" * Update expected value for 4a3cadf changes in catalog * The abc-full_catalog.xml file has changed, so the "Loose parameters" test scenario needs adjustment. * Reduce redundancy in expected metadata * metadata is copied verbatim, so no need to check details in multiple test scenarios for the match=profile template * Update verbiage to cross-reference with logged discussion pages --- .../oscal-profile-resolve-select.xsl | 76 +- .../testing/1_selected/catalog-no-uuid.xml | 2 + .../catalog-nonstandard-file-name-ext.xmlcat | 2 + .../testing/1_selected/glob-rewrite.xspec | 11 +- .../1_selected/resource-media-type.xml | 26 + .../1_selected/resource-multiple-rlinks.xml | 21 + .../1_selected/select-mapping-controls.xspec | 243 +++ .../testing/1_selected/select-rlink.xspec | 4 +- .../testing/1_selected/select.xspec | 1743 +++++++++++++---- 9 files changed, 1758 insertions(+), 370 deletions(-) create mode 100644 src/utils/util/resolver-pipeline/testing/1_selected/catalog-no-uuid.xml create mode 100644 src/utils/util/resolver-pipeline/testing/1_selected/catalog-nonstandard-file-name-ext.xmlcat create mode 100644 src/utils/util/resolver-pipeline/testing/1_selected/resource-media-type.xml create mode 100644 src/utils/util/resolver-pipeline/testing/1_selected/resource-multiple-rlinks.xml create mode 100644 src/utils/util/resolver-pipeline/testing/1_selected/select-mapping-controls.xspec diff --git a/src/utils/util/resolver-pipeline/oscal-profile-resolve-select.xsl b/src/utils/util/resolver-pipeline/oscal-profile-resolve-select.xsl index f4654e1009..d8ca35000a 100644 --- a/src/utils/util/resolver-pipeline/oscal-profile-resolve-select.xsl +++ b/src/utils/util/resolver-pipeline/oscal-profile-resolve-select.xsl @@ -1,5 +1,5 @@ - - + @@ -94,7 +93,16 @@ - + + + + + + Document not acquired for resource with uuid {@uuid + }: No rlink with media-type='xml' or href ending with '.xml' + + @@ -104,7 +112,7 @@ - + @@ -118,10 +126,11 @@ - + + + select="concat(opr:catalog-identifier($context/root()/o:catalog), '#', $context/(@id, generate-id())[1])"/> @@ -131,7 +140,7 @@ - + @@ -174,22 +183,30 @@ + - - + + + - - + + @@ -200,26 +217,19 @@ - - + + + + + + + - - - - - - - - Document not acquired: ' - - ' resolved as ' - - ' (as OSCAL XML) - - - - + Document not acquired: {$href} resolved as { + $resolved-href} (as OSCAL XML) + @@ -237,7 +247,7 @@ - + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/catalog-no-uuid.xml b/src/utils/util/resolver-pipeline/testing/1_selected/catalog-no-uuid.xml new file mode 100644 index 0000000000..78beab5883 --- /dev/null +++ b/src/utils/util/resolver-pipeline/testing/1_selected/catalog-no-uuid.xml @@ -0,0 +1,2 @@ + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/catalog-nonstandard-file-name-ext.xmlcat b/src/utils/util/resolver-pipeline/testing/1_selected/catalog-nonstandard-file-name-ext.xmlcat new file mode 100644 index 0000000000..a506f84570 --- /dev/null +++ b/src/utils/util/resolver-pipeline/testing/1_selected/catalog-nonstandard-file-name-ext.xmlcat @@ -0,0 +1,2 @@ + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/glob-rewrite.xspec b/src/utils/util/resolver-pipeline/testing/1_selected/glob-rewrite.xspec index add11d3ed1..e417e4641e 100644 --- a/src/utils/util/resolver-pipeline/testing/1_selected/glob-rewrite.xspec +++ b/src/utils/util/resolver-pipeline/testing/1_selected/glob-rewrite.xspec @@ -1,12 +1,10 @@ - -]> + ac @@ -30,5 +28,12 @@ ac-1(*) + + + + + + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/resource-media-type.xml b/src/utils/util/resolver-pipeline/testing/1_selected/resource-media-type.xml new file mode 100644 index 0000000000..5db7281637 --- /dev/null +++ b/src/utils/util/resolver-pipeline/testing/1_selected/resource-media-type.xml @@ -0,0 +1,26 @@ + + + + + + Test Profile with Nonstandard File Name Extension in resource/rlink + 2020-05-30T14:39:37.3-04:00 + 1.0 + 1.0.0-rc2 + + + + + + + + + + + + + + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/resource-multiple-rlinks.xml b/src/utils/util/resolver-pipeline/testing/1_selected/resource-multiple-rlinks.xml new file mode 100644 index 0000000000..1f41a36168 --- /dev/null +++ b/src/utils/util/resolver-pipeline/testing/1_selected/resource-multiple-rlinks.xml @@ -0,0 +1,21 @@ + + + + + + Test Profile with Nonstandard File Name Extension in resource/rlink + 2020-05-30T14:39:37.3-04:00 + 1.0 + 1.0.0-rc2 + + + + + + + + + + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/select-mapping-controls.xspec b/src/utils/util/resolver-pipeline/testing/1_selected/select-mapping-controls.xspec new file mode 100644 index 0000000000..950e4a241f --- /dev/null +++ b/src/utils/util/resolver-pipeline/testing/1_selected/select-mapping-controls.xspec @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + x1 + + + + + + + + + + + ... + + Group X of XYZ + + Control X1 + + + ... + ... + + + + + + + + + x1 + + + + + + + + + + x1 + + + + + + + + + + + ... + + Group X of XYZ + + Control X1 + + + ... + ... + + + ... + + Group X of XYZ + + Control X1 + + + ... + ... + + + + + + + + z3 + + + + + + + + + + Control Z3 + Control Z3-A + Control Z3-A-1 + + + + + + + + + z3 + + + + + + + + + + Control Z3 + Control Z3-A + Control Z3-A-1 + + + + + + + + + x1 + + + + + + + + + + + + + + + + x1 + + + + + + + + + + + + + + + + x1 + + + map-x1 + + + + + + + + + + + + + + + x1 + + + + + + + + + + + + + + + x1 + + + + + + + + + + + + + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/select-rlink.xspec b/src/utils/util/resolver-pipeline/testing/1_selected/select-rlink.xspec index 65f5006cf9..9abe119234 100644 --- a/src/utils/util/resolver-pipeline/testing/1_selected/select-rlink.xspec +++ b/src/utils/util/resolver-pipeline/testing/1_selected/select-rlink.xspec @@ -1,6 +1,6 @@ + ]> - + diff --git a/src/utils/util/resolver-pipeline/testing/1_selected/select.xspec b/src/utils/util/resolver-pipeline/testing/1_selected/select.xspec index 7df1cae86a..b14ce0adef 100644 --- a/src/utils/util/resolver-pipeline/testing/1_selected/select.xspec +++ b/src/utils/util/resolver-pipeline/testing/1_selected/select.xspec @@ -1,367 +1,1446 @@ - -]> - - - - + xmlns:xs="http://www.w3.org/2001/XMLSchema" + stylesheet="../../oscal-profile-resolve-select.xsl" + xslt-version="3.0"> - - - - - - - - - - + + - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - - - Group Y of XYZ - - - Group Z of XYZ - - - - + + + + + ... + ... + ... + ... + + + + + + text + + + + + + + + + - - - - - - - - - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - Control X1 - Control X2 - Control X3 - - - Group Y of XYZ - Control Y1 - Control Y2 - Control Y3 - - - Group Z of XYZ - Control Z1 - Control Z2 - Control Z3 - Control Z3-A - Control Z3-A-1 - - - - - - + + + + + + + + + + - - - - - - x1 - - - - - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - + + + + + + + + + + + + + + + + + + + + + + XYZ Tiny Catalog + 2020-05-30T14:51:42.355-04:00 + 1.0 + 1.0.0-rc2 + + + Group X of XYZ + + + Group Y of XYZ + + + Group Z of XYZ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ... + + Group X of XYZ + Control X1 + Control X2 + Control X3 + + + Group Y of XYZ + Control Y1 + Control Y2 + Control Y3 + + + Group Z of XYZ + Control Z1 + Control Z2 + Control Z3 + Control Z3-A + Control Z3-A-1 + + + + + + + + + + + + + + + + + + x1 + + + + + + + + + ... + Group X of XYZ Control X1 Group Y of XYZ Group Z of XYZ - - + + + + + + + + + + + + + + + + + + + + ... + + Group X of XYZ + Control X1 + Control X2 + Control X3 + + Group Y of XYZ + Group Z of XYZ + + + + + + + + + + + + x1 + y1 + z1 + + + + + + + + + ... + + Group X of XYZ + Control X2 + Control X3 + + + Group Y of XYZ + Control Y2 + Control Y3 + + + Group Z of XYZ + Control Z2 + Control Z3 + Control Z3-A + Control Z3-A-1 + + + + + + + + + + + + + + z3 + + + + + + + + + ... + + Group X of XYZ + + + Group Y of XYZ + + + Group Z of XYZ + Control Z3 + Control Z3-A + Control Z3-A-1 + + + + + + + + + + + + + + x1 + + + + + y1 + + + + + + + + + ... + + Group X of XYZ + Control X1 + + Group Y of XYZ + Group Z of XYZ + + + ... + + Group X of XYZ + + + Group Y of XYZ + Control Y1 + + Group Z of XYZ + + + + + + + + + + + + + + a1 + b1 + + + + + + + + + ... + + Group A of C + + + A.a value + + + + + + Control A1 + + + a1.a value + + + +

A1 aaaaa aaaaaaaaaa

+

Parameter A.a is set:

+

Parameter a1.a is set:

+
+
+
+ + Group B of C + + Control B1 + + +

B1 bbbb bbbbbbb.

+
+
+
+ + Group C of C + + + + + A citation to an out of line document. + + + + + A citation to an out of line document. + + + + + + A citation to an out of line document. + + + +
+
+
+
- - - - - - - - - - - + + + + + + + + + + + + + + ... + + + - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - Control X1 - Control X2 - Control X3 - - Group Y of XYZ - Group Z of XYZ - - - + + + + + + + + + + + + + + + + + - - - - - - - x1 - y1 - z1 - - - - + + + + + + + + + ... + ... + + + + + + + + + + - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - Control X2 - Control X3 - - - Group Y of XYZ - Control Y2 - Control Y3 - - - Group Z of XYZ - Control Z2 - Control Z3 - Control Z3-A - Control Z3-A-1 - - - - - - + + + + + + + + + + + + + + ... + + + + + + ... + + + + + + + + + Document not acquired for resource with uuid foo: No rlink with media-type='xml' or href ending with '.xml' + + + + - - - - - - z3 - - - - + + + + + + + + + + + + + + + + + + - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - - - Group Y of XYZ - - - Group Z of XYZ - Control Z3 - Control Z3-A - Control Z3-A-1 - - - - - + + + + + Group X of XYZ + + + + + + Group X of XYZ + - - - - - - x1 - - - - - y1 - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - Control X1 - - Group Y of XYZ - Group Z of XYZ - - - - XYZ Tiny Catalog - 2020-05-30T14:51:42.355-04:00 - 1.0 - 1.0.0-rc2 - - - Group X of XYZ - - - Group Y of XYZ - Control Y1 - - Group Z of XYZ - - - + + + + + + + + ... + + + + + + + + + + + - - - - - - a1 - b1 - - - + + + + + + Control A1 + + + + + - - - - - - ABC Catalog - 2020-05-30T14:51:38.311-04:00 - 1.0 - 1.0.0-rc2 - - - Group A of C - - - A.a value - - - - - - Control A1 - - - a1.a value - - - -

A1 aaaaa aaaaaaaaaa

-

Parameter A.a is set: ...

-

Parameter a1.a is set: ...

-

Also, we refer to a citation.

-
-
-
- - Group B of C - - Control B1 - - -

B1 bbbb bbbbbbb.

-
-
-
- - Group C of C - - - - - A citation to an out of line document. - - - -
-
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + abc + + + + + + + + + + + + + + + abc + + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + level-four + + + + + + + + + + + + + level-four + + + + + + + + + + + + + level-two + + + + + + + + + + + + + level-two + + + + + + + + + + + + + level-two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + level-four + + + level-three + + + + + + + + + + + + + level-two + + + level-three + + + + + + + + + + + + + + + + + + + + + + + + + + + abc + + + + + + + + + + + + + + + + abc + + + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + + level-two + + + + + + + + + + + + + + level-two + + + + + + + + + + + + + + level-two + + + + + + + + + + + + + level-two + + + level-three + + + + + + + + + + + + + level-two + + + level-three + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + + + + level-four + + + + + + + + + + + + + + level-four + + + level-four + + + + + + + + + + + + + level-four + + + level-four + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ... + + +