Class UtilsKt
-
- All Implemented Interfaces:
public final class UtilsKt
-
-
Method Summary
Modifier and Type Method Description final FilegetUSER_DIR()final static AdvisorRunadvisorRunOf(Pair<Identifier, List<AdvisorResult>> results)Create an AdvisorRun with the given results. final static StringgetAssetAsString(String path)Return the content of the fun test asset file located under path relative to the 'assets' directory as text. final static FilegetAssetFile(String path)Return the absolute file for the functional test assets at the given path. final static StringpatchExpectedResult(File expectedResultFile, File definitionFile, Map<String, String> custom)Return a string representation of the expectedResultFile contents that has placeholders replaced. final static StringpatchActualResult(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 OrtResultreadOrtResult(String file)final static OrtResultreadOrtResult(File file)final static ScannerRunscannerRunOf(Pair<Identifier, List<ScanResult>> pkgScanResults)Create a ScannerRun with the given pkgScanResults. -
-
Method Detail
-
getUSER_DIR
final File getUSER_DIR()
-
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.
-
readOrtResult
final static OrtResult readOrtResult(String file)
-
readOrtResult
final static OrtResult readOrtResult(File file)
-
scannerRunOf
final static ScannerRun scannerRunOf(Pair<Identifier, List<ScanResult>> pkgScanResults)
Create a ScannerRun with the given pkgScanResults.
-
-
-
-