Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Alzate <[email protected]>
  • Loading branch information
mr-zepol committed Aug 25, 2024
1 parent f9a883e commit edc00ce
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public AttachmentText deserialize(JsonParser parser, DeserializationContext cont
attachmentText.setText(contentNode.asText());
} else if (node.has("")) {
attachmentText.setText(node.get("").asText());
} else if(node.isTextual()) {
attachmentText.setText(node.textValue());
}

JsonNode contentTypeNode = getContentTypeNode(node);
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/cyclonedx/BomJsonGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,18 @@ public void schema15_testEvidence() throws Exception {
assertTrue(parser.isValid(loadedFile, version));
}

@Test
public void schema16_testFormulation() throws Exception {
Version version = Version.VERSION_16;
Bom bom = createCommonXmlBom("/1.6/valid-formulation-1.6.xml");

BomJsonGenerator generator = BomGeneratorFactory.createJson(version, bom);
File loadedFile = writeToFile(generator.toJsonString());

JsonParser parser = new JsonParser();
assertTrue(parser.isValid(loadedFile, version));
}

private void assertLicenseInformation(Bom bom, Version version) {

//First Component
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/cyclonedx/BomXmlGeneratorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,18 @@ public void schema15_testEvidence() throws Exception {
assertTrue(parser.isValid(loadedFile, version));
}

@Test
public void schema16_testFormulation() throws Exception {
Version version = Version.VERSION_16;
Bom bom = createCommonJsonBom("/1.6/valid-formulation-1.6.json");

BomXmlGenerator generator = BomGeneratorFactory.createXml(version, bom);
File loadedFile = writeToFile(generator.toXmlString());

XmlParser parser = new XmlParser();
assertTrue(parser.isValid(loadedFile, version));
}

private void assertLicenseInformation(Bom bom, Version version) {

//First Component
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/1.6/valid-formulation-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@
"timeEnd": "2023-01-01T00:00:00+10:00",
"workspaces": [
{
"bom-ref": "workspace-1",
"uid": "workspace-1",
"bom-ref": "workspace-2",
"uid": "workspace-2",
"name": "My workspace",
"aliases": [ "default-workspace" ],
"description": "Description here",
Expand Down

0 comments on commit edc00ce

Please sign in to comment.