Class UtilsKt

  • All Implemented Interfaces:

    
    public final class UtilsKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final static File USER_DIR
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final File getUSER_DIR()
      final static AdvisorRun advisorRunOf(Pair<Identifier, List<AdvisorResult>> results) Create an AdvisorRun with the given results.
      final static String getAssetAsString(String path) Return the content of the fun test asset file located under path relative to the 'assets' directory as text.
      final static File getAssetFile(String path) Return the absolute file for the functional test assets at the given path.
      final static String patchExpectedResult(File expectedResultFile, File definitionFile, Map<String, String> custom) Return a string representation of the expectedResultFile contents that has placeholders replaced.
      final static String patchActualResult(String result, Map<String, String> custom, Boolean patchStartAndEndTime) Return a patched version of the result string, which is assumed to represent an ORT result (but is not required to do).
      final static OrtResult readOrtResult(String file)
      final static OrtResult readOrtResult(File file)
      final static ScannerRun scannerRunOf(Pair<Identifier, List<ScanResult>> pkgScanResults) Create a ScannerRun with the given pkgScanResults.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • advisorRunOf

         final static AdvisorRun advisorRunOf(Pair<Identifier, List<AdvisorResult>> results)

        Create an AdvisorRun with the given results.

      • getAssetAsString

         final static String getAssetAsString(String path)

        Return the content of the fun test asset file located under path relative to the 'assets' directory as text.

      • getAssetFile

         final static File getAssetFile(String path)

        Return the absolute file for the functional test assets at the given path.

      • patchExpectedResult

         final static String patchExpectedResult(File expectedResultFile, File definitionFile, Map<String, String> custom)

        Return a string representation of the expectedResultFile contents that has placeholders replaced. If a definitionFile is provided, values that can be derived from it, like the VCS revision, are also replaced. Additionally, custom placeholders can be replaced as well.

      • patchActualResult

         final static String patchActualResult(String result, Map<String, String> custom, Boolean patchStartAndEndTime)

        Return a patched version of the result string, which is assumed to represent an ORT result (but is not required to do). Values that usually change between ORT runs, like timestamps, are replaced with invariant values to allow for easy comparison with expected results. If patchStartAndEndTime is true, start and end times are also replaced. Additionally, custom regex replacements with substitutions can be specified.

      • scannerRunOf

         final static ScannerRun scannerRunOf(Pair<Identifier, List<ScanResult>> pkgScanResults)

        Create a ScannerRun with the given pkgScanResults.