package org.sonar.server.computation.step;
import com.google.common.collect.ImmutableMap;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.sonar.server.computation.source.SourceLinesRepository;
import org.sonar.server.computation.source.SymbolsLineReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
public class PersistFileSourcesStep implements ComputationStep {
.setBinaryData(data)
.setDataHash(dataHash)
.setSrcHash(srcHash)
- .setLineHashes(lineHashes);
- // Optimization only change updated at when updating binary data to avoid unnecessary indexation by E/S
- if (binaryDataUpdated) {
- previousDto.setUpdatedAt(system2.now());
- }
+ .setLineHashes(lineHashes)
+ .setUpdatedAt(system2.now());
dbClient.fileSourceDao().update(previousDto);
session.commit();
}
assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE_UUID);
assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
- // Updated at is not updated to not reindex the file source in E/S as the src hash is not indexed
- assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(past);
+ assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(now);
assertThat(fileSourceDto.getSrcHash()).isEqualTo("137f72c3708c6bd0de00a0e5a69c699b");
}