public static void assertDatabaseVersionEquals(
     DatabaseVersion expectedDatabaseVersion, DatabaseVersion actualDatabaseVersion) {
   assertVectorClockEquals(
       expectedDatabaseVersion.getVectorClock(), actualDatabaseVersion.getVectorClock());
   compareDatabaseVersionChunks(
       expectedDatabaseVersion.getChunks(), actualDatabaseVersion.getChunks());
   compareDatabaseVersionMultiChunks(
       expectedDatabaseVersion.getMultiChunks(), actualDatabaseVersion.getMultiChunks());
   compareDatabaseVersionFileContents(
       expectedDatabaseVersion.getFileContents(), actualDatabaseVersion.getFileContents());
   compareDatabaseVersionFileHistories(
       expectedDatabaseVersion.getFileHistories(), actualDatabaseVersion.getFileHistories());
 }
Exemple #2
0
  private PartialFileHistory getFileHistoryByPathFromDatabaseVersion(
      DatabaseVersion databaseVersion, String path) {
    // TODO [medium] Extremely performance intensive, because this is called inside a loop above.
    // Implement better caching for database version!!!

    for (PartialFileHistory fileHistory : databaseVersion.getFileHistories()) {
      FileVersion lastVersion = fileHistory.getLastVersion();

      if (lastVersion.getStatus() != FileStatus.DELETED && lastVersion.getPath().equals(path)) {
        return fileHistory;
      }
    }

    return null;
  }