Skip to content

Commit

Permalink
Adding regression test for usnistgov/oscal-cli#106, it's still there.
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-stein-nist committed Jan 31, 2024
1 parent 272ab18 commit 5ef9291
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ void performTest(String profileName) throws IOException, SaxonApiException {
StringWriter writer = new StringWriter();
serializer.serialize(catalog, writer);

// OscalBindingContext.instance().newSerializer(Format.YAML, Catalog.class).serialize(catalog,
// OscalBindingContext.instance().newSerializer(Format.YAML,
// Catalog.class).serialize(catalog,
// System.out);

// System.out.println("Pre scrub: " + writer.getBuffer().toString());
Expand Down Expand Up @@ -256,4 +257,13 @@ void testArsModerateProfile() throws IOException, ProfileResolutionException, UR

assertNotNull(resolvedCatalog);
}

@Test
void testIssue106Profile() throws IOException, ProfileResolutionException, URISyntaxException {
Path profileFile = Paths.get(JUNIT_TEST_PATH, "content/issue106-profile.xml");
assert profileFile != null;
Catalog catalog = resolveProfile(profileFile);
assertNotNull(catalog);
assertEquals("1.1.1", catalog.getMetadata().getOscalVersion());
}
}
16 changes: 16 additions & 0 deletions src/test/resources/content/issue106-catalog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/releases/download/v1.1.1/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="37b7acd4-ab3f-4217-99d1-2ab9e490db49">
<metadata>
<title />
<last-modified>2023-02-18T13:06:18Z</last-modified>
<version>2023-02-18T13:06:18Z</version>
<oscal-version>1.1.1</oscal-version>
</metadata>
<control id="c1">
<title />
<control id="c1.1">
<title />
</control>
</control>
</catalog>
15 changes: 15 additions & 0 deletions src/test/resources/content/issue106-profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://github.com/usnistgov/OSCAL/releases/download/v1.1.1/oscal_complete_schema.xsd" schematypens="http://www.w3.org/2001/XMLSchema" title="OSCAL complete schema" ?>
<profile xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="3353e8e1-3eef-42ef-8163-1f71616bafca">
<metadata>
<title />
<last-modified>2023-02-18T13:06:18Z</last-modified>
<version>2023-02-18T13:06:18Z</version>
<oscal-version>1.1.1</oscal-version>
</metadata>
<import href="issue106-catalog.xml">
<include-controls>
<with-id>c1.1</with-id>
</include-controls>
</import>
</profile>

0 comments on commit 5ef9291

Please sign in to comment.