Package it.unive.lisa.outputs.compare
Interface JsonReportComparer.DiffAlgorithm
-
- All Known Implementing Classes:
JsonReportComparer.BaseDiffAlgorithm
- Enclosing class:
- JsonReportComparer
public static interface JsonReportComparer.DiffAlgorithmAn object that provides callbacks for reporting differences when comparingJsonReports.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidconfigurationDiff(java.lang.String key, java.lang.String first, java.lang.String second)Callback invoked by aJsonReportComparerwhenever a configuration key is mapped to two different values.default booleancustomFileCompare(java.io.File expected, java.io.File actual)Custom comparison method for files that are neither json graphs nor visualization-only files.voidfileDiff(java.lang.String first, java.lang.String second, java.lang.String message)Callback invoked by aJsonReportComparerwhenever files from different reports but with matching names have different content.voidinfoDiff(java.lang.String key, java.lang.String first, java.lang.String second)Callback invoked by aJsonReportComparerwhenever an analysis information key is mapped to two different values.default booleanisJsonGraph(java.lang.String path)Yields whether or not the file pointed by the given path should be considered a json graph.default booleanisVisualizationFile(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.voidreport(JsonReportComparer.REPORTED_COMPONENT component, JsonReportComparer.REPORT_TYPE type, java.util.Collection<?> reported)Reports a difference in one of the components of the reports.default booleanshouldCompareConfigurations()Iftrue, analysis configurations (JsonReport.getConfiguration()) will be compared.default booleanshouldCompareFileContents()Iftrue, content of files produced by both analyses will be compared.default booleanshouldCompareFiles()Iftrue, files (JsonReport.getFiles()) will be compared.default booleanshouldCompareRunInfos()Iftrue, run information (JsonReport.getInfo()) will be compared.default booleanshouldCompareWarnings()Iftrue, warnings (JsonReport.getWarnings()) will be compared.default booleanshouldFailFast()Iftrue, comparison will halt after the first failed category (warnings, files, ...) without reporting the full diff.default booleanverboseLabelDiff()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_COMPONENTwhere the difference was foundtype- theJsonReportComparer.REPORT_TYPEindicating 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 aJsonReportComparerwhenever 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 aJsonReportComparerwhenever 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 aJsonReportComparerwhenever 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:
trueif 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:
trueif 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
-
-