]> source.dussan.org Git - sonarqube.git/commitdiff
rename AnalysisMetadataHolder.baseProjectAnalysis to baseAnalysis
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 24 Aug 2016 14:47:14 +0000 (16:47 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 30 Aug 2016 13:42:00 +0000 (15:42 +0200)
12 files changed:
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/filemove/FileMoveDetectionStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/BuildComponentTreeStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStep.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/filemove/FileMoveDetectionStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoRepositoryImplTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepTest.java

index fa96b6972b678b1f119d4618fb61a75eeeaaf887..43d6c7a06d94edccf00634247c6120a13c52aefa 100644 (file)
@@ -37,20 +37,20 @@ public interface AnalysisMetadataHolder {
   long getAnalysisDate();
 
   /**
-   * Convenience method equivalent to calling {@link #getBaseProjectSnapshot() == null}
+   * Convenience method equivalent to calling {@link #getBaseAnalysis() == null}
    *
    * @throws IllegalStateException if baseProjectSnapshot has not been set
    */
   boolean isFirstAnalysis();
 
   /**
-   * Return the last snapshot of the project.
+   * Return the last analysis of the project.
    * If it's the first analysis, it will return null.
    *
-   * @throws IllegalStateException if baseProjectSnapshot has not been set
+   * @throws IllegalStateException if baseAnalysis has not been set
    */
   @CheckForNull
-  Analysis getBaseProjectSnapshot();
+  Analysis getBaseAnalysis();
 
   /**
    * @throws IllegalStateException if cross project duplication flag has not been set
index 4ab56f9c11d38c732f2da5ab4070c17df9364df6..6ce238ab4d307178fa7d1fd05e318af73201b955 100644 (file)
@@ -72,19 +72,19 @@ public class AnalysisMetadataHolderImpl implements MutableAnalysisMetadataHolder
 
   @Override
   public boolean isFirstAnalysis() {
-    return getBaseProjectSnapshot() == null;
+    return getBaseAnalysis() == null;
   }
 
   @Override
-  public MutableAnalysisMetadataHolder setBaseProjectSnapshot(@Nullable Analysis baseProjectAnalysis) {
+  public MutableAnalysisMetadataHolder setBaseAnalysis(@Nullable Analysis baseAnalysis) {
     checkState(!this.baseProjectSnapshot.isInitialized(), "Base project snapshot has already been set");
-    this.baseProjectSnapshot.setProperty(baseProjectAnalysis);
+    this.baseProjectSnapshot.setProperty(baseAnalysis);
     return this;
   }
 
   @Override
   @CheckForNull
-  public Analysis getBaseProjectSnapshot() {
+  public Analysis getBaseAnalysis() {
     checkState(baseProjectSnapshot.isInitialized(), "Base project snapshot has not been set");
     return baseProjectSnapshot.getProperty();
   }
index ab6a5b58fe79630e4fbbff15aee093f6f4a1649b..89624d20addc3f4ff9489ceb94c9e6f12a7b0092 100644 (file)
@@ -36,9 +36,9 @@ public interface MutableAnalysisMetadataHolder extends AnalysisMetadataHolder {
   MutableAnalysisMetadataHolder setAnalysisDate(long date);
 
   /**
-   * @throws IllegalStateException if baseProjectAnalysis has already been set
+   * @throws IllegalStateException if baseAnalysis has already been set
    */
-  MutableAnalysisMetadataHolder setBaseProjectSnapshot(@Nullable Analysis baseProjectAnalysis);
+  MutableAnalysisMetadataHolder setBaseAnalysis(@Nullable Analysis baseAnalysis);
 
   /**
    * @throws IllegalStateException if cross project duplication flag has already been set
index aabd0cd2706e7b3f8cd676ecfa3f0875fd275de2..5ffd9591cd51b0e75dc9d5e1a035bbf2bbc7962b 100644 (file)
@@ -92,7 +92,7 @@ public class FileMoveDetectionStep implements ComputationStep {
   @Override
   public void execute() {
     // do nothing if no files in db (first analysis)
-    Analysis baseProjectAnalysis = analysisMetadataHolder.getBaseProjectSnapshot();
+    Analysis baseProjectAnalysis = analysisMetadataHolder.getBaseAnalysis();
     if (baseProjectAnalysis == null) {
       LOG.debug("First analysis. Do nothing.");
       return;
index fbd0a1f9f7cfa84047cf2ed3550027f25930bdde..0b322adf7491f33cad88aad65c3a5af36276b40f 100644 (file)
@@ -64,17 +64,17 @@ public class BuildComponentTreeStep implements ComputationStep {
     UuidFactory uuidFactory = new UuidFactory(dbClient, moduleKey(reportProject, branch));
     Component project = new ComponentRootBuilder(reportProject, uuidFactory, branch).build();
     treeRootHolder.setRoot(project);
-    setBaseProjectSnapshot(project.getUuid());
+    setBaseAnalysis(project.getUuid());
   }
 
-  private void setBaseProjectSnapshot(String projectUuid) {
+  private void setBaseAnalysis(String projectUuid) {
     DbSession dbSession = dbClient.openSession(false);
     try {
       SnapshotDto snapshotDto = dbClient.snapshotDao().selectAnalysisByQuery(dbSession,
         new SnapshotQuery()
           .setComponentUuid(projectUuid)
           .setIsLast(true));
-      analysisMetadataHolder.setBaseProjectSnapshot(toAnalysis(snapshotDto));
+      analysisMetadataHolder.setBaseAnalysis(toAnalysis(snapshotDto));
     } finally {
       dbClient.closeSession(dbSession);
     }
index d88d433edee0be4c22f0d2fc6578a375b1d8e9aa..09b00a47743444fc4562a4facd7c226ab081a3d9 100644 (file)
@@ -118,7 +118,7 @@ public class LoadCrossProjectDuplicationsRepositoryStep implements ComputationSt
     private List<DuplicationUnitDto> selectDuplicates(Component file, Collection<String> hashes) {
       DbSession dbSession = dbClient.openSession(false);
       try {
-        Analysis projectAnalysis = analysisMetadataHolder.getBaseProjectSnapshot();
+        Analysis projectAnalysis = analysisMetadataHolder.getBaseAnalysis();
         String analysisUuid = projectAnalysis == null ? null : projectAnalysis.getUuid();
         return dbClient.duplicationDao().selectCandidates(dbSession, analysisUuid, file.getFileAttributes().getLanguageKey(), hashes);
       } finally {
index 85eb76be394d8d59eca44f62c7cce1ff2c189bde..a4a4e363d7d73873fe33fe1b82bde39af8b3ab87 100644 (file)
@@ -70,7 +70,7 @@ public class AnalysisMetadataHolderImplTest {
   public void isFirstAnalysis_return_true() throws Exception {
     AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
 
-    underTest.setBaseProjectSnapshot(null);
+    underTest.setBaseAnalysis(null);
     assertThat(underTest.isFirstAnalysis()).isTrue();
   }
 
@@ -78,7 +78,7 @@ public class AnalysisMetadataHolderImplTest {
   public void isFirstAnalysis_return_false() throws Exception {
     AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
 
-    underTest.setBaseProjectSnapshot(baseProjectAnalysis);
+    underTest.setBaseAnalysis(baseProjectAnalysis);
     assertThat(underTest.isFirstAnalysis()).isFalse();
   }
 
@@ -95,17 +95,17 @@ public class AnalysisMetadataHolderImplTest {
     expectedException.expect(IllegalStateException.class);
     expectedException.expectMessage("Base project snapshot has not been set");
 
-    new AnalysisMetadataHolderImpl().getBaseProjectSnapshot();
+    new AnalysisMetadataHolderImpl().getBaseAnalysis();
   }
 
   @Test
   public void setBaseProjectSnapshot_throws_ISE_when_called_twice() {
     AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
-    underTest.setBaseProjectSnapshot(baseProjectAnalysis);
+    underTest.setBaseAnalysis(baseProjectAnalysis);
 
     expectedException.expect(IllegalStateException.class);
     expectedException.expectMessage("Base project snapshot has already been set");
-    underTest.setBaseProjectSnapshot(baseProjectAnalysis);
+    underTest.setBaseAnalysis(baseProjectAnalysis);
   }
 
   @Test
index bab325019b36d86989d06285caba4e904fd3209d..f12d92f4565e851fbde70f7373ff62dcac36ce3a 100644 (file)
@@ -36,7 +36,7 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
 
   private final InitializedProperty<Long> analysisDate = new InitializedProperty<>();
 
-  private final InitializedProperty<Analysis> baseProjectSnapshot = new InitializedProperty<>();
+  private final InitializedProperty<Analysis> baseAnalysis = new InitializedProperty<>();
 
   private final InitializedProperty<Boolean> crossProjectDuplicationEnabled = new InitializedProperty<>();
 
@@ -80,20 +80,20 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
 
   @Override
   public boolean isFirstAnalysis() {
-    return getBaseProjectSnapshot() == null;
+    return getBaseAnalysis() == null;
   }
 
   @Override
-  public AnalysisMetadataHolderRule setBaseProjectSnapshot(@Nullable Analysis baseProjectAnalysis) {
-    this.baseProjectSnapshot.setProperty(baseProjectAnalysis);
+  public AnalysisMetadataHolderRule setBaseAnalysis(@Nullable Analysis baseAnalysis) {
+    this.baseAnalysis.setProperty(baseAnalysis);
     return this;
   }
 
   @Override
   @CheckForNull
-  public Analysis getBaseProjectSnapshot() {
-    checkState(baseProjectSnapshot.isInitialized(), "Base project snapshot has not been set");
-    return baseProjectSnapshot.getProperty();
+  public Analysis getBaseAnalysis() {
+    checkState(baseAnalysis.isInitialized(), "Base analysis has not been set");
+    return baseAnalysis.getProperty();
   }
 
   @Override
index 49f62b9425ed073a10478dad2913fe4f4f59b975..17c5350ecb9c7d883d5ca3a37c7b317514941112 100644 (file)
@@ -60,15 +60,15 @@ public class MutableAnalysisMetadataHolderRule extends ExternalResource implemen
   }
 
   @Override
-  public MutableAnalysisMetadataHolderRule setBaseProjectSnapshot(@Nullable Analysis baseProjectAnalysis) {
-    delegate.setBaseProjectSnapshot(baseProjectAnalysis);
+  public MutableAnalysisMetadataHolderRule setBaseAnalysis(@Nullable Analysis baseAnalysis) {
+    delegate.setBaseAnalysis(baseAnalysis);
     return this;
   }
 
   @Override
   @CheckForNull
-  public Analysis getBaseProjectSnapshot() {
-    return delegate.getBaseProjectSnapshot();
+  public Analysis getBaseAnalysis() {
+    return delegate.getBaseAnalysis();
   }
 
   @Override
index 3514500f558348593c3c149fb8e8ea50538b2c76..f19049bcabc2d294d378d18c0faf35f055cd88aa 100644 (file)
@@ -250,7 +250,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_baseProjectSnapshot_is_null() {
-    analysisMetadataHolder.setBaseProjectSnapshot(null);
+    analysisMetadataHolder.setBaseAnalysis(null);
 
     underTest.execute();
 
@@ -259,7 +259,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_baseSnapshot_has_no_file_and_report_has_no_file() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
 
     underTest.execute();
 
@@ -268,7 +268,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_baseSnapshot_has_no_file() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     setFilesInReport(FILE_1, FILE_2);
 
     underTest.execute();
@@ -278,7 +278,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_retrieves_only_file_and_unit_tests_from_last_snapshot() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     ArgumentCaptor<ComponentTreeQuery> captor = ArgumentCaptor.forClass(ComponentTreeQuery.class);
     when(componentDao.selectDescendants(eq(dbSession), captor.capture()))
       .thenReturn(Collections.emptyList());
@@ -295,7 +295,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_there_is_no_file_in_report() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents( /* no components */);
     setFilesInReport();
 
@@ -306,7 +306,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_file_key_exists_in_both_DB_and_report() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey(), FILE_2.getKey());
     setFilesInReport(FILE_2, FILE_1);
 
@@ -317,7 +317,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_move_if_content_of_file_is_same_in_DB_and_report() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     ComponentDto[] dtos = mockComponents(FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
     setFilesInReport(FILE_2);
@@ -334,7 +334,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_content_of_file_is_not_similar_enough() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
     setFilesInReport(FILE_2);
@@ -347,7 +347,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_content_of_file_is_empty_in_DB() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT_EMPTY);
     setFilesInReport(FILE_2);
@@ -360,7 +360,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_content_of_file_has_no_path_in_DB() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
 
     mockComponents(key -> newComponentDto(key).setPath(null), FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
@@ -374,7 +374,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_content_of_file_is_empty_in_report() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
     setFilesInReport(FILE_2);
@@ -387,7 +387,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_two_added_files_have_same_content_as_the_one_in_db() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
     setFilesInReport(FILE_2, FILE_3);
@@ -401,7 +401,7 @@ public class FileMoveDetectionStepTest {
 
   @Test
   public void execute_detects_no_move_if_two_deleted_files_have_same_content_as_the_one_added() {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     mockComponents(FILE_1.getKey(), FILE_2.getKey());
     mockContentOfFileInDb(FILE_1.getKey(), CONTENT1);
     mockContentOfFileInDb(FILE_2.getKey(), CONTENT1);
@@ -420,7 +420,7 @@ public class FileMoveDetectionStepTest {
     // - file2 deleted
     // - file4 untouched
     // - file5 renamed to file6 with a small change
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     Component file4 = fileComponent(5);
     Component file5 = fileComponent(6);
     Component file6 = fileComponent(7);
@@ -452,7 +452,7 @@ public class FileMoveDetectionStepTest {
    */
   @Test
   public void real_life_use_case() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(ANALYSIS);
+    analysisMetadataHolder.setBaseAnalysis(ANALYSIS);
     List<String> componentDtoKey = new ArrayList<>();
     for (File f : FileUtils.listFiles(new File("src/test/resources/org/sonar/server/computation/task/projectanalysis/filemove/FileMoveDetectionStepTest/v1"), null, false)) {
       componentDtoKey.add(f.getName());
index 9b0574ff401ed30cee068f2f6e510e2abb5bbd14..546a21d6787e24ed1f0f39b274549106d8b53651 100644 (file)
@@ -90,7 +90,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void read_from_report() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addChangesetInReport("john", DATE_1, "rev-1");
 
     ScmInfo scmInfo = underTest.getScmInfo(FILE).get();
@@ -101,7 +101,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void getScmInfo_returns_absent_if_CopyFromPrevious_is_false_and_there_is_no_changeset_in_report() {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     // put data in DB, which should not be used
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
     addFileSourceInReport(1);
@@ -111,7 +111,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void getScmInfo_returns_ScmInfo_from_DB_CopyFromPrevious_is_true_if_hashes_are_the_same() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
     addFileSourceInReport(1);
     addCopyFromPreviousChangesetInReport();
@@ -124,7 +124,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void getScmInfo_returns_absent_when_CopyFromPrevious_is_true_but_hashes_are_not_the_same() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1) + "_different");
     addFileSourceInReport(1);
     addCopyFromPreviousChangesetInReport();
@@ -136,7 +136,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void read_from_report_even_if_data_in_db_exists() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
     addChangesetInReport("john", DATE_2, "rev-2");
 
@@ -150,7 +150,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void read_from_db_even_if_data_in_report_exists_when_CopyFromPrevious_is_true() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
     addFileSourceInReport(1);
     addChangesetInReport("john", DATE_2, "rev-2", true);
@@ -165,13 +165,13 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void return_nothing_when_no_data_in_report_nor_db() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     assertThat(underTest.getScmInfo(FILE)).isAbsent();
   }
 
   @Test
   public void return_nothing_when_nothing_in_report_and_db_has_no_scm() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addFileSourceInDb(null, null, null, "don't care");
     addFileSourceInReport(1);
 
@@ -180,7 +180,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void fail_with_NPE_when_component_is_null() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     thrown.expect(NullPointerException.class);
     thrown.expectMessage("Component cannot be bull");
@@ -219,7 +219,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void load_scm_info_from_cache_when_already_read() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     addChangesetInReport("john", DATE_1, "rev-1");
     ScmInfo scmInfo = underTest.getScmInfo(FILE).get();
     assertThat(scmInfo.getAllChangesets()).hasSize(1);
@@ -233,7 +233,7 @@ public class ScmInfoRepositoryImplTest {
 
   @Test
   public void not_read_in_db_on_first_analysis_when_CopyFromPrevious_is_true() throws Exception {
-    analysisMetadataHolder.setBaseProjectSnapshot(null);
+    analysisMetadataHolder.setBaseAnalysis(null);
     addFileSourceInDb("henry", DATE_1, "rev-1", "don't care");
     addFileSourceInReport(1);
     addCopyFromPreviousChangesetInReport();
index 93b7612efa4d6d1d6fb5462be6c620e6b9043cc7..c247afd789b3cd89851aedb3071aeba1fe065075 100644 (file)
@@ -124,7 +124,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   @Test
   public void call_compute_cpd_on_one_duplication() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     ComponentDto otherProject = createProject("OTHER_PROJECT_KEY");
     SnapshotDto otherProjectSnapshot = createProjectSnapshot(otherProject);
@@ -174,7 +174,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   @Test
   public void call_compute_cpd_on_many_duplication() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     ComponentDto otherProject = createProject("OTHER_PROJECT_KEY");
     SnapshotDto otherProjectSnapshot = createProjectSnapshot(otherProject);
@@ -262,7 +262,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   @Test
   public void nothing_to_do_when_cross_project_duplication_is_disabled() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(false);
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     ComponentDto otherProject = createProject("OTHER_PROJECT_KEY");
     SnapshotDto otherProjectSnapshot = createProjectSnapshot(otherProject);
@@ -297,7 +297,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   @Test
   public void nothing_to_do_when_no_cpd_text_blocks_found() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     batchReportReader.putDuplicationBlocks(FILE_REF, Collections.<ScannerReport.CpdTextBlock>emptyList());
 
@@ -309,7 +309,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepTest {
   @Test
   public void nothing_to_do_when_cpd_text_blocks_exists_but_no_duplicated_found() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
-    analysisMetadataHolder.setBaseProjectSnapshot(baseProjectAnalysis);
+    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
 
     ScannerReport.CpdTextBlock originBlock = ScannerReport.CpdTextBlock.newBuilder()
       .setHash("a8998353e96320ec")