Package it.unive.lisa.outputs.compare
Interface JsonReportComparer.DiffAlgorithm
-
- All Known Implementing Classes:
JsonReportComparer.BaseDiffAlgorithm
- Enclosing class:
- JsonReportComparer
public static interface JsonReportComparer.DiffAlgorithm
An object that provides callbacks for reporting differences when comparingJsonReport
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
configurationDiff(java.lang.String key, java.lang.String first, java.lang.String second)
Callback invoked by aJsonReportComparer
whenever a configuration key is mapped to two different values.default boolean
customFileCompare(java.io.File expected, java.io.File actual)
Custom comparison method for files that are neither json graphs nor visualization-only files.void
fileDiff(java.lang.String first, java.lang.String second, java.lang.String message)
Callback invoked by aJsonReportComparer
whenever files from different reports but with matching names have different content.void
infoDiff(java.lang.String key, java.lang.String first, java.lang.String second)
Callback invoked by aJsonReportComparer
whenever an analysis information key is mapped to two different values.default boolean
isJsonGraph(java.lang.String path)
Yields whether or not the file pointed by the given path should be considered a json graph.default boolean
isVisualizationFile(java.lang.String path)
Yields whether or not the file pointed by the given path is for visualizing results and can thus be skipped as its content depends solely on other files.void
report(JsonReportComparer.REPORTED_COMPONENT component, JsonReportComparer.REPORT_TYPE type, java.util.Collection<?> reported)
Reports a difference in one of the components of the reports.default boolean
shouldCompareConfigurations()
Iftrue
, analysis configurations (JsonReport.getConfiguration()
) will be compared.default boolean
shouldCompareFileContents()
Iftrue
, content of files produced by both analyses will be compared.default boolean
shouldCompareFiles()
Iftrue
, files (JsonReport.getFiles()
) will be compared.default boolean
shouldCompareRunInfos()
Iftrue
, run information (JsonReport.getInfo()
) will be compared.default boolean
shouldCompareWarnings()
Iftrue
, warnings (JsonReport.getWarnings()
) will be compared.default boolean
shouldFailFast()
Iftrue
, comparison will halt after the first failed category (warnings, files, ...) without reporting the full diff.default boolean
verboseLabelDiff()
Iftrue
, the full diff between two labels will be reported when a difference is found.
-
-
-
Method Detail
-
report
void report(JsonReportComparer.REPORTED_COMPONENT component, JsonReportComparer.REPORT_TYPE type, java.util.Collection<?> reported)
Reports a difference in one of the components of the reports.- Parameters:
component
- theJsonReportComparer.REPORTED_COMPONENT
where the difference was foundtype
- theJsonReportComparer.REPORT_TYPE
indicating what is the difference being reportedreported
- the collection of elements that are part of the report
-
fileDiff
void fileDiff(java.lang.String first, java.lang.String second, java.lang.String message)
Callback invoked by aJsonReportComparer
whenever files from different reports but with matching names have different content.- Parameters:
first
- the complete (i.e. path + file name) pathname of the first filesecond
- the complete (i.e. path + file name) pathname of the second filemessage
- the message reporting the difference
-
infoDiff
void infoDiff(java.lang.String key, java.lang.String first, java.lang.String second)
Callback invoked by aJsonReportComparer
whenever an analysis information key is mapped to two different values.- Parameters:
key
- the information keyfirst
- the value in the first reportsecond
- the value in the second report
-
configurationDiff
void configurationDiff(java.lang.String key, java.lang.String first, java.lang.String second)
Callback invoked by aJsonReportComparer
whenever a configuration key is mapped to two different values.- Parameters:
key
- the configuration keyfirst
- the value in the first reportsecond
- the value in the second report
-
shouldCompareConfigurations
default boolean shouldCompareConfigurations()
Iftrue
, analysis configurations (JsonReport.getConfiguration()
) will be compared.- Returns:
- whether or not configurations should be compared
-
shouldCompareRunInfos
default boolean shouldCompareRunInfos()
Iftrue
, run information (JsonReport.getInfo()
) will be compared.- Returns:
- whether or not run informations should be compared
-
shouldCompareWarnings
default boolean shouldCompareWarnings()
Iftrue
, warnings (JsonReport.getWarnings()
) will be compared.- Returns:
- whether or not warnings should be compared
-
shouldCompareFiles
default boolean shouldCompareFiles()
Iftrue
, files (JsonReport.getFiles()
) will be compared.- Returns:
- whether or not files should be compared
-
shouldCompareFileContents
default boolean shouldCompareFileContents()
Iftrue
, content of files produced by both analyses will be compared.- Returns:
- whether or not file contents should be compared
-
shouldFailFast
default boolean shouldFailFast()
Iftrue
, comparison will halt after the first failed category (warnings, files, ...) without reporting the full diff.- Returns:
- whether or not comparison should fail fast
-
isJsonGraph
default boolean isJsonGraph(java.lang.String path)
Yields whether or not the file pointed by the given path should be considered a json graph.- Parameters:
path
- the path pointing to the file- Returns:
true
if that condition holds
-
isVisualizationFile
default boolean isVisualizationFile(java.lang.String path)
Yields whether or not the file pointed by the given path is for visualizing results and can thus be skipped as its content depends solely on other files.- Parameters:
path
- the path pointing to the file- Returns:
true
if that condition holds
-
customFileCompare
default boolean customFileCompare(java.io.File expected, java.io.File actual)
Custom comparison method for files that are neither json graphs nor visualization-only files.- Parameters:
expected
- the file from the expected reportactual
- the file from the actual report- Returns:
- whether or not a difference was found in the files
- Throws:
java.lang.UnsupportedOperationException
- if file comparisons are not supported for the given file type
-
verboseLabelDiff
default boolean verboseLabelDiff()
Iftrue
, the full diff between two labels will be reported when a difference is found. Otherwise, a simple message is reported.- Returns:
- whether or not label diff reporting should be verbose
-
-