Class LicenseXmlTester

java.lang.Object
org.spdx.licenselistpublisher.LicenseXmlTester

public class LicenseXmlTester extends Object
Tests a license XML file against license text expected to match TestLicenseXML licenseXmlFile textFile licenseXmlFile XML - file textFile - Text file which should match the license text for the licenseXmlFile testDirectory - optional directory of text files to test with the pattern {license-id}/(license|header|exception)/(good|bad)/{test-id}.txt
Author:
Gary O'Neall
  • Constructor Details

    • LicenseXmlTester

      public LicenseXmlTester()
  • Method Details

    • main

      public static void main(String[] args)
      Parameters:
      args - arguments - see usage for documentation
    • testLicenseXml

      public static List<String> testLicenseXml(File licenseXmlFile, File testFile, @Nullable File testDirectory) throws org.spdx.core.InvalidSPDXAnalysisException, LicenseXmlException, IOException, org.spdx.utility.compare.SpdxCompareException
      test a license XML against a single file and optionally a directory of test files
      Parameters:
      licenseXmlFile - file in LicenseXML Format
      testFile - single file to compare
      testDirectory - optional directory to test against with the pattern {license-id}/(license|header|exception)/(good|bad)/{test-id}.txt
      Returns:
      list of errors when comparing - if empty, no errors occurs
      Throws:
      org.spdx.core.InvalidSPDXAnalysisException - on SPDX parsing errors
      LicenseXmlException - on errors parsing the LicenseXML
      IOException - on errors reading either the XML or test files
      org.spdx.utility.compare.SpdxCompareException