Class ResponseCoverageHistoryStore

java.lang.Object
com.arc_e_tect.gradle.doppelganger.progress.ResponseCoverageHistoryStore

public class ResponseCoverageHistoryStore extends Object
Reads and writes ResponseCoverageRecords as newline-delimited JSON (NDJSON), one record per line, sorted by ResponseCoverageRecord.fingerprint() so that git diffs of the persisted file are minimal and stable - the same hand-rolled, dependency-free approach api-detector-core's ContractHistoryStore uses for the cross-plugin contract progress history.
  • Constructor Details

    • ResponseCoverageHistoryStore

      public ResponseCoverageHistoryStore()
      Creates a new ResponseCoverageHistoryStore.
  • Method Details

    • load

      public Map<String,ResponseCoverageRecord> load(File file)
      Loads the response coverage history from file.
      Parameters:
      file - the NDJSON history file; need not exist
      Returns:
      the records keyed by fingerprint; empty when file doesn't exist. A line that fails to parse is skipped with a WARN-level log message identifying the line number - it never fails the build.
    • save

      public void save(File file, Collection<ResponseCoverageRecord> records)
      Writes records to file as NDJSON, sorted by ResponseCoverageRecord.fingerprint(), overwriting any existing content.
      Parameters:
      file - the NDJSON history file to write
      records - the records to persist