Package it.unive.lisa.outputs.compare
Class JsonReportComparer
- java.lang.Object
-
- it.unive.lisa.outputs.compare.JsonReportComparer
-
public class JsonReportComparer extends java.lang.Object
A class providing capabilities for finding differences between twoJsonReport
s. Reports are compared by:- configurations (
JsonReport.getConfiguration()
) are compared fist, treating each field as a string - run information (
JsonReport.getInfo()
) are then compared, treating each field as a string but ignoring timestamps (duration, start, end) and LiSA's version - warnings (
JsonReport.getWarnings()
) are then compared, usingJsonReport.JsonWarning.compareTo(JsonWarning)
method - the set of files produced during the analysis
(
JsonReport.getFiles()
) is then compared, matching their paths - finally, the contents of every file produced by both analyses are
compared, excluding the report itself (
LiSA.REPORT_NAME
) and visualization-only files
JsonReportComparer.DiffAlgorithm
. - configurations (
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonReportComparer.BaseDiffAlgorithm
AJsonReportComparer.DiffAlgorithm
that dumps the differences using this class' logger, will compare all fields of the report, and will not fail fast.static interface
JsonReportComparer.DiffAlgorithm
An object that provides callbacks for reporting differences when comparingJsonReport
s.static class
JsonReportComparer.REPORT_TYPE
An enumeration defining the different type of reports that can be issued.static class
JsonReportComparer.REPORTED_COMPONENT
An enumeration defining the different components of aJsonReport
, in order to distinguish which one of them caused a difference being reported.
-
Constructor Summary
Constructors Constructor Description JsonReportComparer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
compare(JsonReport first, JsonReport second, java.io.File firstFileRoot, java.io.File secondFileRoot)
Compares the two reports usingJsonReportComparer.BaseDiffAlgorithm
.static boolean
compare(JsonReport first, JsonReport second, java.io.File firstFileRoot, java.io.File secondFileRoot, JsonReportComparer.DiffAlgorithm diff)
Compares the two reports according to the given algorithm.
-
-
-
Method Detail
-
compare
public static boolean compare(JsonReport first, JsonReport second, java.io.File firstFileRoot, java.io.File secondFileRoot) throws java.io.IOException
Compares the two reports usingJsonReportComparer.BaseDiffAlgorithm
. See this class' documentation for information about how reports are compared.- Parameters:
first
- the first reportsecond
- the second reportfirstFileRoot
- the root folder for the resolution of the file names in the first report (this should be either the workdir of that analysis or the folder wherefirst
lies)secondFileRoot
- the root folder for the resolution of the file names in the second report (this should be either the workdir of that analysis or the folder wheresecond
lies)- Returns:
true
if and only the two reports are equal- Throws:
java.io.IOException
- if errors happen while opening or reading the files contained in the reports
-
compare
public static boolean compare(JsonReport first, JsonReport second, java.io.File firstFileRoot, java.io.File secondFileRoot, JsonReportComparer.DiffAlgorithm diff) throws java.io.IOException
Compares the two reports according to the given algorithm. See this class' documentation for information about how reports are compared.- Parameters:
first
- the first reportsecond
- the second reportfirstFileRoot
- the root folder for the resolution of the file names in the first report (this should be either the workdir of that analysis or the folder wherefirst
lies)secondFileRoot
- the root folder for the resolution of the file names in the second report (this should be either the workdir of that analysis or the folder wheresecond
lies)diff
- theJsonReportComparer.DiffAlgorithm
that will be used for dumping the differences found in the two reports and for customizing the reporting process- Returns:
true
if and only the two reports are equal- Throws:
java.io.IOException
- if errors happen while opening or reading the files contained in the reports
-
-