]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9575 Revert all changes made to support incremental mode
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 25 Sep 2017 14:33:31 +0000 (16:33 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Wed, 27 Sep 2017 12:50:52 +0000 (14:50 +0200)
91 files changed:
server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java
server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml
server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java [deleted file]
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java [deleted file]
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java
server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
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/duplication/IncrementalDuplicationMeasures.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/measure/IncrementalMeasureTransition.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStep.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/ValidateIncremental.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/package-info.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java
server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.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/issue/IntegrateIssuesVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStepTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java
sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/MockAnalysisMode.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.java [deleted file]
sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchParamsValidator.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStoreProvider.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/CoveragePublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MeasuresPublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/report/SourcePublisherTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleIndexerTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java
sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java [deleted file]
sonar-scanner-protocol/src/main/protobuf/scanner_report.proto
sonar-ws/src/main/protobuf/ws-ce.proto

index ec2b6a3ac7995f6443117fb857cc4215fb9bfccc..760b11ce89dd11f3716bd9de69da94ce4506264f 100644 (file)
@@ -124,8 +124,7 @@ CREATE TABLE "SNAPSHOTS" (
   "PERIOD4_DATE" BIGINT,
   "PERIOD5_MODE" VARCHAR(100),
   "PERIOD5_PARAM" VARCHAR(100),
-  "PERIOD5_DATE" BIGINT,
-  "INCREMENTAL" BOOLEAN DEFAULT FALSE
+  "PERIOD5_DATE" BIGINT
 );
 CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS" ("COMPONENT_UUID");
 CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS" ("UUID");
index 7a60a07f98634f697ab205de8c92a63b0eb3e196..9d757ceb0772cb29aa8bcbde2350dad2617ba007 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.db.ce;
 
 public class CeTaskCharacteristicDto {
 
-  public static final String INCREMENTAL_KEY = "incremental";
   public static final String BRANCH_KEY = "branch";
   public static final String BRANCH_TYPE_KEY = "branchType";
 
index e2bb957ea7f2b1901ed6f309d401917dda4bf6ae..e326b4da5115f9a7a40097f905d64b91ccfb388d 100644 (file)
@@ -42,7 +42,6 @@ public final class SnapshotDto {
   private String periodMode;
   private String periodParam;
   private Long periodDate;
-  private boolean incremental = false;
 
   public Long getId() {
     return id;
@@ -156,15 +155,6 @@ public final class SnapshotDto {
     return this;
   }
 
-  public boolean getIncremental() {
-    return incremental;
-  }
-
-  public SnapshotDto setIncremental(boolean incremental) {
-    this.incremental = incremental;
-    return this;
-  }
-
   /**
    * @return analysis date
    */
index b838cf23afe1532f070059a70300eb7034a98808..8060e105448de0112583b9730a688628b4001019 100644 (file)
@@ -14,8 +14,7 @@
     s.version as version,
     s.period1_mode as periodMode,
     s.period1_param as periodParam,
-    s.period1_date as periodDate,
-    s.incremental as incremental
+    s.period1_date as periodDate
   </sql>
 
   <sql id="viewsSnapshotColumns">
     version,
     period1_mode,
     period1_param,
-    period1_date,
-    incremental)
+    period1_date)
     values (
     #{uuid, jdbcType=VARCHAR},
     #{componentUuid, jdbcType=VARCHAR},
     #{version, jdbcType=VARCHAR},
     #{periodMode, jdbcType=VARCHAR},
     #{periodParam, jdbcType=VARCHAR},
-    #{periodDate, jdbcType=BIGINT},
-    #{incremental, jdbcType=BOOLEAN})
+    #{periodDate, jdbcType=BIGINT})
   </insert>
 </mapper>
 
index 291143024b4878c478b98bff7fc28271d621ec2f..46c5bb93ab14fb97880f97f6056fbc56d6b42ffe 100644 (file)
@@ -73,7 +73,6 @@ public class SnapshotDaoTest {
       .setPeriodParam("30")
       .setPeriodDate(1500000000001L)
       .setVersion("2.1-SNAPSHOT")
-      .setIncremental(false)
       .setBuildDate(1500000000006L)
       .setCreatedAt(1403042400000L));
 
@@ -91,8 +90,6 @@ public class SnapshotDaoTest {
     assertThat(result.getBuildDate()).isEqualTo(1500000000006L);
     assertThat(result.getCreatedAt()).isEqualTo(1403042400000L);
     assertThat(result.getVersion()).isEqualTo("2.1-SNAPSHOT");
-    assertThat(result.getIncremental()).isFalse();
-
 
     assertThat(underTest.selectByUuid(db.getSession(), "DOES_NOT_EXIST").isPresent()).isFalse();
   }
@@ -269,7 +266,6 @@ public class SnapshotDaoTest {
       .setPeriodDate(1500000000001L)
       .setVersion("2.1-SNAPSHOT")
       .setBuildDate(1500000000006L)
-      .setIncremental(true)
       .setCreatedAt(1403042400000L));
 
     assertThat(dto.getId()).isNotNull();
@@ -284,7 +280,6 @@ public class SnapshotDaoTest {
     assertThat(dto.getBuildDate()).isEqualTo(1500000000006L);
     assertThat(dto.getCreatedAt()).isEqualTo(1403042400000L);
     assertThat(dto.getVersion()).isEqualTo("2.1-SNAPSHOT");
-    assertThat(dto.getIncremental()).isTrue();
 
   }
 
@@ -393,8 +388,7 @@ public class SnapshotDaoTest {
       .setPeriodMode("days1")
       .setPeriodParam("30")
       .setPeriodDate(1_500_000_000_001L)
-      .setBuildDate(1_500_000_000_006L)
-      .setIncremental(false);
+      .setBuildDate(1_500_000_000_006L);
   }
 
   private CeActivityDto insertActivity(SnapshotDto analysis, CeActivityDto.Status status) {
index 04ad42674546eb06d681f301f0172eb1dd79f51b..4b8dd3e26afe9caa8bee81c75dd01654713f19bc 100644 (file)
@@ -36,7 +36,6 @@ public class SnapshotDtoTest {
       .setVersion("1.0")
       .setPeriodMode("mode1")
       .setPeriodParam("param1")
-      .setIncremental(true)
       .setPeriodDate(parseDate("2014-06-01").getTime());
 
     assertThat(snapshotDto.getId()).isEqualTo(10L);
@@ -46,7 +45,6 @@ public class SnapshotDtoTest {
     assertThat(snapshotDto.getVersion()).isEqualTo("1.0");
     assertThat(snapshotDto.getPeriodMode()).isEqualTo("mode1");
     assertThat(snapshotDto.getPeriodModeParameter()).isEqualTo("param1");
-    assertThat(snapshotDto.getIncremental()).isTrue();
     assertThat(snapshotDto.getPeriodDate()).isEqualTo(parseDate("2014-06-01").getTime());
   }
 
index ef080fd3f6417056894edae1b6206208933ce19a..6cb45a58538f79abf31a712f21b154a417793e84 100644 (file)
@@ -32,7 +32,6 @@ Note that measures, events and reviews are not deleted.
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!--switched_off="[null]" permanent_id="[null]" FAILURE_LEVEL="2"-->
@@ -97,7 +96,6 @@ Note that measures, events and reviews are not deleted.
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 
index 15104619310baee1dabc8adf6c3fce056e3eaeff..d086021a1514d9c48034ff5464519a809e819b2b 100644 (file)
@@ -24,7 +24,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <project_measures ID="1"
@@ -89,7 +88,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <project_measures ID="2"
index 00ee6f678a89073dc84d63296da50c078fbe8dee..287f41e23deac3c66800443beb1057ee36ec9dff 100644 (file)
@@ -149,7 +149,6 @@ What has been changed :
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
       />
 
   <!-- Open issue on file -->
index 4e7905239dfbcdc30511d5d8d8d9b6a8cf1e5c00..40c2ae8f4f7706422673322fa8b0dcf4081d38bf 100644 (file)
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- Open issue on file -->
index dd294d38bf2429a032a49b165b800fef37f7fc70..e5c679bf4c5e0a8f00740c71db85505e794dccc5 100644 (file)
@@ -50,7 +50,6 @@ Snapshot 2 has been deleted
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshot with status "processed" and flagged as "last" -> do not purge and do not delete -->
@@ -78,7 +77,6 @@ Snapshot 2 has been deleted
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index 3f493acd7eb722fa9c094477775c3a2e5389c1cf..9acb701f9e9b700ff819aaad00fad401cb3fadbc 100644 (file)
@@ -45,7 +45,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshot with status "unprocessed" -> to be deleted -->
@@ -73,7 +72,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshot with status "processed" and flagged as "last" -> do not purge and do not delete -->
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index d5393b6756a74799925d4338feeab3aa898cd06c..878595a3c80740039128b238798d9b2df320ca30 100644 (file)
@@ -25,7 +25,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- delete only resource 1 -->
@@ -53,7 +52,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index 9d351499f2a01b015020c6b76f82da85e2813834..d4cdd2565323c4c8975a56aee326cd1680ab187d 100644 (file)
@@ -25,7 +25,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- delete only resource 1 -->
@@ -53,7 +52,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- to be deleted -->
@@ -81,7 +79,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index e32aeb548d0a7c85fa5964bd05db9e71fdc0cba8..3e6532b606a4dfeca470adb8e3e67a2124ae3e7d 100644 (file)
@@ -151,7 +151,6 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshots to be purged -->
@@ -179,7 +178,6 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index eef613afa84bd5c79663a323f64a0a176f220946..c6f8da44917be129b7799298034315430c381f1f 100644 (file)
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshots to be purged -->
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index 0ce2b40b57e9461a0236a53504be0e249db0526a..5de7ce994c78cfc56f362a9ceb33c5572c70e0db 100644 (file)
@@ -66,7 +66,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 
@@ -95,7 +94,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshot to be purged -->
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
index 69fb0fd3418bdc2f5c0b0b65442b79f2b64d59d6..4590dc6260b819d7e856c5a0697debe9dd488049 100644 (file)
@@ -65,7 +65,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 
@@ -94,7 +93,6 @@
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
   <!-- snapshot to be purged -->
              created_at="1228222680000"
              build_date="1228222680000"
              version="[null]"
-             incremental="[false]"
   />
 
 </dataset>
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java
deleted file mode 100644 (file)
index 960626c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.platform.db.migration.version.v66;
-
-import java.sql.SQLException;
-
-import org.sonar.db.Database;
-import org.sonar.server.platform.db.migration.def.BooleanColumnDef;
-import org.sonar.server.platform.db.migration.sql.AddColumnsBuilder;
-import org.sonar.server.platform.db.migration.step.DdlChange;
-
-public class AddIncrementalColumnToSnapshotsTable extends DdlChange {
-
-  public AddIncrementalColumnToSnapshotsTable(Database db) {
-    super(db);
-  }
-
-  @Override
-  public void execute(Context context) throws SQLException {
-    context.execute(new AddColumnsBuilder(getDialect(), "snapshots")
-      .addColumn(BooleanColumnDef.newBooleanColumnDefBuilder()
-        .setColumnName("incremental")
-        .setDefaultValue(false)
-        .build())
-      .build());
-  }
-
-}
index e50531e123e68b95d785ab1b4017e88d1ba20e88..3bfe2ec422f963a65a33a417dc7a7414811f594c 100644 (file)
@@ -27,7 +27,6 @@ public class DbVersion66 implements DbVersion {
   @Override
   public void addSteps(MigrationStepRegistry registry) {
     registry
-      .add(1800, "Add incremental column to snapshots table", AddIncrementalColumnToSnapshotsTable.class)
       .add(1801, "Create table CE task characteristics", CreateTableCeTaskCharacteristics.class)
       .add(1802, "Delete leak settings on views", DeleteLeakSettingsOnViews.class)
       .add(1803, "Fix empty USERS.EXTERNAL_IDENTITY and USERS.EXTERNAL_IDENTITY_PROVIDER", FixEmptyIdentityProviderInUsers.class)
@@ -36,7 +35,6 @@ public class DbVersion66 implements DbVersion {
       .add(1806, "Create table project_branches", CreateTableProjectBranches.class)
       .add(1807, "Add on project_branches key", AddIndexOnProjectBranchesKey.class)
       .add(1808, "Add branch column to projects table", AddBranchColumnToProjectsTable.class)
-      .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class)
-    ;
+      .add(1809, "Populate project_branches with existing main branches", PopulateMainProjectBranches.class);
   }
 }
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java
deleted file mode 100644 (file)
index 0519ba2..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.platform.db.migration.version.v66;
-
-import java.sql.SQLException;
-import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.sonar.db.CoreDbTester;
-
-public class AddIncrementalColumnToSnapshotsTableTest {
-  @Rule
-  public CoreDbTester db = CoreDbTester.createForSchema(AddIncrementalColumnToSnapshotsTableTest.class, "old_snapshots.sql");
-  @Rule
-  public ExpectedException expectedException = ExpectedException.none();
-
-  private AddIncrementalColumnToSnapshotsTable underTest = new AddIncrementalColumnToSnapshotsTable(db.database());
-
-  @Test
-  public void migration_adds_column_to_empty_table() throws SQLException {
-    underTest.execute();
-
-    verifyAddedColumns();
-  }
-
-  @Test
-  public void migration_is_not_reentrant() throws SQLException {
-    underTest.execute();
-
-    expectedException.expect(IllegalStateException.class);
-    expectedException.expectMessage("Fail to execute ");
-    underTest.execute();
-  }
-
-  private void verifyAddedColumns() {
-    db.assertColumnDefinition("snapshots", "incremental", Types.BOOLEAN, null, true);
-  }
-
-}
index 74fa9c04b6d4e1706c4d35001024539277c9ff34..76a9365740c7fd1e35c7aabb87f69894a52ab6d3 100644 (file)
@@ -30,13 +30,13 @@ public class DbVersion66Test {
   private DbVersion66 underTest = new DbVersion66();
 
   @Test
-  public void migrationNumber_starts_at_1800() {
-    verifyMinimumMigrationNumber(underTest, 1800);
+  public void migrationNumber_starts_at_1801() {
+    verifyMinimumMigrationNumber(underTest, 1801);
   }
 
   @Test
   public void verify_migration_count() {
-    verifyMigrationCount(underTest, 10);
+    verifyMigrationCount(underTest, 9);
   }
 
 }
index 598a574e6fa271d6f55f1595ec39aa1ada62d903..e54d06826cfcbc712ba5942bba6318631dd4368b 100644 (file)
@@ -99,9 +99,8 @@ public class ActivityAction implements CeWsAction {
       .setResponseExample(getClass().getResource("activity-example.json"))
       .setHandler(this)
       .setChangelog(
-        new Change("5.5", "it's no more possible to specify the page parameter.<"),
+        new Change("5.5", "it's no more possible to specify the page parameter."),
         new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
-        new Change("6.6", "field \"incremental\" is added"),
         new Change("6.6", "fields \"branch\" and \"branchType\" added"))
       .setSince("5.2");
 
index 71301984c9ba960f89c473e535f08b1285958cdb..0f109ec370aea729c2e07e900e0a0888c6b20473 100644 (file)
@@ -35,11 +35,11 @@ import org.sonar.db.component.ComponentDto;
 import org.sonar.server.component.ComponentFinder;
 import org.sonar.server.user.UserSession;
 import org.sonar.server.ws.KeyExamples;
+import org.sonarqube.ws.WsCe.ProjectResponse;
 
 import static org.sonar.db.Pagination.forPage;
 import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
 import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.WsCe.ProjectResponse;
 import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
@@ -69,7 +69,6 @@ public class ComponentAction implements CeWsAction {
       .setResponseExample(getClass().getResource("component-example.json"))
       .setChangelog(
         new Change("6.1", "field \"logs\" is deprecated and its value is always false"),
-        new Change("6.6", "field \"incremental\" is added"),
         new Change("6.6", "fields \"branch\" and \"branchType\" added"))
       .setHandler(this);
 
index 1b5dd39b5972bb25ea1fbe430db26fec95a55947..8fbcdc69a6c7c52cd60f5eece463f5c3d4b66409 100644 (file)
  */
 package org.sonar.server.ce.ws;
 
-import static org.sonar.server.ws.WsUtils.checkRequest;
-
 import java.io.BufferedInputStream;
 import java.io.InputStream;
 import java.util.LinkedHashMap;
 import java.util.Map;
-
 import org.apache.commons.lang.StringUtils;
 import org.sonar.api.server.ws.Request;
 import org.sonar.api.server.ws.Response;
@@ -36,6 +33,8 @@ import org.sonar.server.organization.DefaultOrganizationProvider;
 import org.sonar.server.ws.WsUtils;
 import org.sonarqube.ws.WsCe;
 
+import static org.sonar.server.ws.WsUtils.checkRequest;
+
 public class SubmitAction implements CeWsAction {
 
   private static final String PARAM_ORGANIZATION_KEY = "organization";
@@ -96,7 +95,7 @@ public class SubmitAction implements CeWsAction {
       .createParam(PARAM_ANALYSIS_CHARACTERISTIC)
       .setRequired(false)
       .setDescription("Optional characteristic of the analysis. Can be repeated to define multiple characteristics.")
-      .setExampleValue("incremental=true")
+      .setExampleValue("branchType=long")
       .setSince("6.6");
   }
 
index 40b7b4089284b2baa03f7d9dff2ab822dea6160a..9e809380ce7318bcd47f1b62749cf91f02a34ea0 100644 (file)
@@ -74,7 +74,6 @@ public class TaskAction implements CeWsAction {
       .setResponseExample(getClass().getResource("task-example.json"))
       .setSince("5.2")
       .setChangelog(
-        new Change("6.6", "field \"incremental\" is added"),
         new Change("6.6", "fields \"branch\" and \"branchType\" added"))
       .setHandler(this);
 
index 606c361218e1ad038348dc44c5d1cbbff9f72077..1e8bf7ee9cda93da70f9cd1bea12a6b8cb2d33ea 100644 (file)
@@ -89,7 +89,6 @@ public class TaskFormatter {
     builder.setSubmittedAt(formatDateTime(new Date(dto.getCreatedAt())));
     setNullable(dto.getStartedAt(), builder::setStartedAt, DateUtils::formatDateTime);
     setNullable(computeExecutionTimeMs(dto), builder::setExecutionTimeMs);
-    setIncremental(builder, dto.getUuid(), componentDtoCache);
     setBranch(builder, dto.getUuid(), componentDtoCache);
     return builder.build();
   }
@@ -119,7 +118,6 @@ public class TaskFormatter {
     if (analysisUuid != null) {
       builder.setAnalysisId(analysisUuid);
     }
-    setIncremental(builder, dto.getUuid(), componentDtoCache);
     setBranch(builder, dto.getUuid(), componentDtoCache);
     setNullable(analysisUuid, builder::setAnalysisId);
     setNullable(dto.getSubmitterLogin(), builder::setSubmitterLogin);
@@ -145,11 +143,6 @@ public class TaskFormatter {
     return builder;
   }
 
-  private static WsCe.Task.Builder setIncremental(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
-    builder.setIncremental(componentDtoCache.hasIncrementalCharacteristic(taskUuid));
-    return builder;
-  }
-
   private static WsCe.Task.Builder setBranch(WsCe.Task.Builder builder, String taskUuid, DtoCache componentDtoCache) {
     componentDtoCache.getBranchName(taskUuid).ifPresent(
       b -> {
@@ -243,12 +236,6 @@ public class TaskFormatter {
       return organizationDto.getKey();
     }
 
-    boolean hasIncrementalCharacteristic(String taskUuid) {
-      return characteristicsByTaskUuid.get(taskUuid).stream()
-        .filter(c -> c.getKey().equals(CeTaskCharacteristicDto.INCREMENTAL_KEY))
-        .anyMatch(c -> c.getValue().equals("true"));
-    }
-
     Optional<String> getBranchName(String taskUuid) {
       return characteristicsByTaskUuid.get(taskUuid).stream()
         .filter(c -> c.getKey().equals(CeTaskCharacteristicDto.BRANCH_KEY))
index 8334cc14b0e3be05ce17e28e9c48472356201fe4..e8dffaad582acd3ec068f4fb63ad1873078aa192 100644 (file)
@@ -55,11 +55,6 @@ public interface AnalysisMetadataHolder {
    */
   boolean isFirstAnalysis();
 
-  /**
-   * Whether this is an incremental analysis or a full analysis.
-   */
-  boolean isIncrementalAnalysis();
-
   /**
    * Return the last analysis of the project.
    * If it's the first analysis, it will return null.
index 5a6b5dd74b2ea01feceb67427df2991fe56ff3ea..654755b04541aa9f9aab1d796f98cb85eba1c5e1 100644 (file)
@@ -24,7 +24,6 @@ import java.util.Map;
 import java.util.Optional;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nullable;
-
 import org.sonar.db.component.BranchType;
 import org.sonar.server.computation.util.InitializedProperty;
 import org.sonar.server.qualityprofile.QualityProfile;
@@ -37,7 +36,6 @@ public class AnalysisMetadataHolderImpl implements MutableAnalysisMetadataHolder
   private final InitializedProperty<Organization> organization = new InitializedProperty<>();
   private final InitializedProperty<String> uuid = new InitializedProperty<>();
   private final InitializedProperty<Long> analysisDate = new InitializedProperty<>();
-  private final InitializedProperty<Boolean> incrementalAnalysis = new InitializedProperty<>();
   private final InitializedProperty<Analysis> baseProjectSnapshot = new InitializedProperty<>();
   private final InitializedProperty<Boolean> crossProjectDuplicationEnabled = new InitializedProperty<>();
   private final InitializedProperty<Branch> branch = new InitializedProperty<>();
@@ -97,19 +95,6 @@ public class AnalysisMetadataHolderImpl implements MutableAnalysisMetadataHolder
     return getBaseAnalysis() == null;
   }
 
-  @Override
-  public MutableAnalysisMetadataHolder setIncrementalAnalysis(boolean isIncrementalAnalysis) {
-    checkState(!incrementalAnalysis.isInitialized(), "Incremental analysis flag has already been set");
-    this.incrementalAnalysis.setProperty(isIncrementalAnalysis);
-    return this;
-  }
-
-  @Override
-  public boolean isIncrementalAnalysis() {
-    checkState(incrementalAnalysis.isInitialized(), "Incremental analysis flag has not been set");
-    return this.incrementalAnalysis.getProperty();
-  }
-
   @Override
   public MutableAnalysisMetadataHolder setBaseAnalysis(@Nullable Analysis baseAnalysis) {
     checkState(!this.baseProjectSnapshot.isInitialized(), "Base project snapshot has already been set");
index de4cc6ee2c839cb1a4a0e1feac814e61746dd983..4b5477caf8c423482e0622582a1a2c9c4df0d9cf 100644 (file)
@@ -40,11 +40,6 @@ public interface MutableAnalysisMetadataHolder extends AnalysisMetadataHolder {
    */
   MutableAnalysisMetadataHolder setAnalysisDate(long date);
 
-  /**
-   * @throws IllegalStateException if it has already been set
-   */
-  MutableAnalysisMetadataHolder setIncrementalAnalysis(boolean isIncrementalAnalysis);
-
   /**
    * @throws IllegalStateException if baseAnalysis has already been set
    */
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/duplication/IncrementalDuplicationMeasures.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/duplication/IncrementalDuplicationMeasures.java
deleted file mode 100644 (file)
index c6e825b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation.task.projectanalysis.duplication;
-
-public interface IncrementalDuplicationMeasures {
-  void execute();
-}
index 3a282e0663ce0506c5c9171c77d748486cbd634f..557de8de602b39fe42ff6167a61a48a6d46059ec 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.issue;
 
-import static org.sonar.server.computation.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER;
-
-import java.util.Collection;
-import java.util.List;
 import java.util.Map;
-
 import org.sonar.core.issue.DefaultIssue;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit;
 import org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter;
 import org.sonar.server.util.cache.DiskCache;
 
+import static org.sonar.server.computation.task.projectanalysis.component.ComponentVisitor.Order.POST_ORDER;
+
 public class IntegrateIssuesVisitor extends TypeAwareVisitorAdapter {
 
   private final IssueCache issueCache;
   private final IssueLifecycle issueLifecycle;
   private final IssueVisitors issueVisitors;
-  private final ComponentIssuesLoader issuesLoader;
-  private final AnalysisMetadataHolder analysisMetadataHolder;
   private final IssueTrackingDelegator issueTracking;
 
-  public IntegrateIssuesVisitor(IssueCache issueCache, IssueLifecycle issueLifecycle, IssueVisitors issueVisitors, ComponentIssuesLoader issuesLoader,
-    AnalysisMetadataHolder analysisMetadataHolder, IssueTrackingDelegator issueTracking) {
+  public IntegrateIssuesVisitor(IssueCache issueCache, IssueLifecycle issueLifecycle, IssueVisitors issueVisitors, IssueTrackingDelegator issueTracking) {
     super(CrawlerDepthLimit.FILE, POST_ORDER);
     this.issueCache = issueCache;
     this.issueLifecycle = issueLifecycle;
     this.issueVisitors = issueVisitors;
-    this.issuesLoader = issuesLoader;
-    this.analysisMetadataHolder = analysisMetadataHolder;
     this.issueTracking = issueTracking;
   }
 
@@ -58,27 +48,17 @@ public class IntegrateIssuesVisitor extends TypeAwareVisitorAdapter {
     try (DiskCache<DefaultIssue>.DiskAppender cacheAppender = issueCache.newAppender()) {
       issueVisitors.beforeComponent(component);
 
-      if (isIncremental(component)) {
-        // no tracking needed, simply re-use existing issues
-        List<DefaultIssue> issues = issuesLoader.loadForComponentUuid(component.getUuid());
-        reuseOpenIssues(component, issues, cacheAppender);
-      } else {
-        TrackingResult tracking = issueTracking.track(component);
-        fillNewOpenIssues(component, tracking.newIssues(), cacheAppender);
-        fillExistingOpenIssues(component, tracking.issuesToMerge(), cacheAppender);
-        closeIssues(component, tracking.issuesToClose(), cacheAppender);
-        copyIssues(component, tracking.issuesToCopy(), cacheAppender);
-      }
+      TrackingResult tracking = issueTracking.track(component);
+      fillNewOpenIssues(component, tracking.newIssues(), cacheAppender);
+      fillExistingOpenIssues(component, tracking.issuesToMerge(), cacheAppender);
+      closeIssues(component, tracking.issuesToClose(), cacheAppender);
+      copyIssues(component, tracking.issuesToCopy(), cacheAppender);
       issueVisitors.afterComponent(component);
     } catch (Exception e) {
       throw new IllegalStateException(String.format("Fail to process issues of component '%s'", component.getKey()), e);
     }
   }
 
-  private boolean isIncremental(Component component) {
-    return analysisMetadataHolder.isIncrementalAnalysis() && component.getStatus() == Status.SAME;
-  }
-
   private void fillNewOpenIssues(Component component, Iterable<DefaultIssue> issues, DiskCache<DefaultIssue>.DiskAppender cacheAppender) {
     for (DefaultIssue issue : issues) {
       issueLifecycle.initNewOpenIssue(issue);
@@ -95,12 +75,6 @@ public class IntegrateIssuesVisitor extends TypeAwareVisitorAdapter {
     }
   }
 
-  private void reuseOpenIssues(Component component, Collection<DefaultIssue> issues, DiskCache<DefaultIssue>.DiskAppender cacheAppender) {
-    for (DefaultIssue issue : issues) {
-      process(component, issue, cacheAppender);
-    }
-  }
-
   private void fillExistingOpenIssues(Component component, Map<DefaultIssue, DefaultIssue> matched, DiskCache<DefaultIssue>.DiskAppender cacheAppender) {
     for (Map.Entry<DefaultIssue, DefaultIssue> entry : matched.entrySet()) {
       DefaultIssue raw = entry.getKey();
index 8bfc6fe06d558e386a86ddb1c3594dc8a3eeb874..af327cf70903c2ca037cc81bf8a1226d40085acf 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.server.issue.workflow.IssueWorkflow;
  * Sets the appropriate fields when an issue is :
  * <ul>
  *   <li>newly created</li>
- *   <li>reused in incremental analysis</li>
  *   <li>merged the related base issue</li>
  *   <li>relocated (only manual issues)</li>
  * </ul>
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/measure/IncrementalMeasureTransition.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/measure/IncrementalMeasureTransition.java
deleted file mode 100644 (file)
index e05410b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation.task.projectanalysis.measure;
-
-/**
- * Provided by the incremental plugin
- */
-public interface IncrementalMeasureTransition extends Runnable {
-
-}
index 5a66cd4a66a25ae604e1a5391d116e256e3e6af9..4452891005256a61853ae8c7523501c5c1f2e4a2 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import javax.annotation.Nullable;
-
 import org.sonar.api.measures.CoreMetrics;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.duplication.DuplicationMeasures;
-import org.sonar.server.computation.task.projectanalysis.duplication.IncrementalDuplicationMeasures;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 /**
@@ -33,22 +29,10 @@ import org.sonar.server.computation.task.step.ComputationStep;
  * This step must be executed after {@link CommentMeasuresStep} as it depends on {@link CoreMetrics#COMMENT_LINES}
  */
 public class DuplicationMeasuresStep implements ComputationStep {
-  private final AnalysisMetadataHolder analysisMetadataHolder;
   private final DuplicationMeasures defaultDuplicationMeasures;
-  private final IncrementalDuplicationMeasures incrementalDuplicationsMeasures;
 
-  public DuplicationMeasuresStep(AnalysisMetadataHolder analysisMetadataHolder, DuplicationMeasures defaultDuplicationMeasures,
-    @Nullable IncrementalDuplicationMeasures incrementalDuplicationMeasures) {
-    this.analysisMetadataHolder = analysisMetadataHolder;
+  public DuplicationMeasuresStep(DuplicationMeasures defaultDuplicationMeasures) {
     this.defaultDuplicationMeasures = defaultDuplicationMeasures;
-    this.incrementalDuplicationsMeasures = incrementalDuplicationMeasures;
-  }
-
-  /**
-   * Constructor used by Pico in Views where no IncrementalDuplicationMeasures is available.
-   */
-  public DuplicationMeasuresStep(AnalysisMetadataHolder analysisMetadataHolder, DuplicationMeasures defaultDuplicationMeasures) {
-    this(analysisMetadataHolder, defaultDuplicationMeasures, null);
   }
 
   @Override
@@ -58,10 +42,6 @@ public class DuplicationMeasuresStep implements ComputationStep {
 
   @Override
   public void execute() {
-    if (analysisMetadataHolder.isIncrementalAnalysis()) {
-      incrementalDuplicationsMeasures.execute();
-    } else {
-      defaultDuplicationMeasures.execute();
-    }
+    defaultDuplicationMeasures.execute();
   }
 }
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStep.java
deleted file mode 100644 (file)
index 78f7c16..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation.task.projectanalysis.step;
-
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
-import org.sonar.server.computation.task.projectanalysis.measure.IncrementalMeasureTransition;
-import org.sonar.server.computation.task.step.ComputationStep;
-
-public class IncrementalMeasureTransitionStep implements ComputationStep {
-  private final AnalysisMetadataHolder analysisMetadataHolder;
-  private final IncrementalMeasureTransition runnable;
-
-  public IncrementalMeasureTransitionStep(AnalysisMetadataHolder analysisMetadataHolder) {
-    this(analysisMetadataHolder, null);
-  }
-
-  public IncrementalMeasureTransitionStep(AnalysisMetadataHolder analysisMetadataHolder, IncrementalMeasureTransition runnable) {
-    this.analysisMetadataHolder = analysisMetadataHolder;
-    this.runnable = runnable;
-  }
-
-  @Override
-  public void execute() {
-    if (analysisMetadataHolder.isIncrementalAnalysis()) {
-      runnable.run();
-    }
-  }
-
-  @Override
-  public String getDescription() {
-    return "Incremental measure transition";
-  }
-}
index 5c7c70a58f12d617c2abb01ab747adf507889bfe..82702754de644eaeeb3e6f81ab633867fbd10f9e 100644 (file)
@@ -23,7 +23,6 @@ import com.google.common.base.Function;
 import javax.annotation.Nonnull;
 import org.sonar.core.util.CloseableIterator;
 import org.sonar.scanner.protocol.output.ScannerReport;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit;
@@ -50,14 +49,11 @@ public class LoadDuplicationsFromReportStep implements ComputationStep {
   private final TreeRootHolder treeRootHolder;
   private final BatchReportReader batchReportReader;
   private final DuplicationRepository duplicationRepository;
-  private final AnalysisMetadataHolder analysisMetadataHolder;
 
-  public LoadDuplicationsFromReportStep(TreeRootHolder treeRootHolder, BatchReportReader batchReportReader,
-    DuplicationRepository duplicationRepository, AnalysisMetadataHolder analysisMetadataHolder) {
+  public LoadDuplicationsFromReportStep(TreeRootHolder treeRootHolder, BatchReportReader batchReportReader, DuplicationRepository duplicationRepository) {
     this.treeRootHolder = treeRootHolder;
     this.batchReportReader = batchReportReader;
     this.duplicationRepository = duplicationRepository;
-    this.analysisMetadataHolder = analysisMetadataHolder;
   }
 
   @Override
@@ -67,21 +63,19 @@ public class LoadDuplicationsFromReportStep implements ComputationStep {
 
   @Override
   public void execute() {
-    if (!analysisMetadataHolder.isIncrementalAnalysis()) {
-      new DepthTraversalTypeAwareCrawler(
-        new TypeAwareVisitorAdapter(CrawlerDepthLimit.FILE, POST_ORDER) {
-          @Override
-          public void visitFile(Component file) {
-            try (CloseableIterator<ScannerReport.Duplication> duplications = batchReportReader.readComponentDuplications(file.getReportAttributes().getRef())) {
-              int idGenerator = 1;
-              while (duplications.hasNext()) {
-                loadDuplications(file, duplications.next(), idGenerator);
-                idGenerator++;
-              }
+    new DepthTraversalTypeAwareCrawler(
+      new TypeAwareVisitorAdapter(CrawlerDepthLimit.FILE, POST_ORDER) {
+        @Override
+        public void visitFile(Component file) {
+          try (CloseableIterator<ScannerReport.Duplication> duplications = batchReportReader.readComponentDuplications(file.getReportAttributes().getRef())) {
+            int idGenerator = 1;
+            while (duplications.hasNext()) {
+              loadDuplications(file, duplications.next(), idGenerator);
+              idGenerator++;
             }
           }
-        }).visit(treeRootHolder.getRoot());
-    }
+        }
+      }).visit(treeRootHolder.getRoot());
   }
 
   private void loadDuplications(Component file, ScannerReport.Duplication duplication, int id) {
index e5f5f6bf33bead5c99ed3fb74cc90339112b3b1d..1010269638c43787f177e99504323e69ac9bf027 100644 (file)
@@ -50,11 +50,9 @@ import org.sonar.server.computation.task.step.ComputationStep;
 import org.sonar.server.organization.DefaultOrganizationProvider;
 import org.sonar.server.qualityprofile.QualityProfile;
 
-import static java.util.stream.Collectors.toMap;
 import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Maps.transformValues;
 import static java.lang.String.format;
-import static org.apache.commons.lang.StringUtils.isNotEmpty;
+import static java.util.stream.Collectors.toMap;
 import static org.sonar.core.util.stream.MoreCollectors.toList;
 
 /**
@@ -87,7 +85,6 @@ public class LoadReportAnalysisMetadataHolderStep implements ComputationStep {
     loadMetadata(reportMetadata);
     Organization organization = loadOrganization(reportMetadata);
     loadProject(reportMetadata, organization);
-    loadIncrementalMode(reportMetadata);
     loadQualityProfiles(reportMetadata, organization);
     branchLoader.load(reportMetadata);
   }
@@ -141,10 +138,6 @@ public class LoadReportAnalysisMetadataHolderStep implements ComputationStep {
     return pluginInfo.getBasePlugin();
   }
 
-  private void loadIncrementalMode(ScannerReport.Metadata reportMetadata) {
-    analysisMetadata.setIncrementalAnalysis(reportMetadata.getIncremental());
-  }
-
   /**
    * Check that the Quality profiles sent by scanner correctly relate to the project organization.
    */
index df884f39c5c2b160e93311286463cb9328459917..ef8e57dc3a20625fc5f2346619fa43c786f0b188 100644 (file)
@@ -76,14 +76,14 @@ public class PersistAnalysisStep implements ComputationStep {
 
     @Override
     public void visitProject(Component project) {
-      SnapshotDto snapshot = createAnalysis(analysisMetadataHolder.getUuid(), project, true, analysisMetadataHolder.isIncrementalAnalysis());
+      SnapshotDto snapshot = createAnalysis(analysisMetadataHolder.getUuid(), project, true);
       updateSnapshotPeriods(snapshot);
       persist(snapshot, dbSession);
     }
 
     @Override
     public void visitView(Component view) {
-      SnapshotDto snapshot = createAnalysis(analysisMetadataHolder.getUuid(), view, false, false);
+      SnapshotDto snapshot = createAnalysis(analysisMetadataHolder.getUuid(), view, false);
       updateSnapshotPeriods(snapshot);
       persist(snapshot, dbSession);
     }
@@ -98,13 +98,12 @@ public class PersistAnalysisStep implements ComputationStep {
       snapshotDto.setPeriodDate(period.getSnapshotDate());
     }
 
-    private SnapshotDto createAnalysis(String snapshotUuid, Component component, boolean setVersion, boolean incremental) {
+    private SnapshotDto createAnalysis(String snapshotUuid, Component component, boolean setVersion) {
       String componentUuid = component.getUuid();
       return new SnapshotDto()
         .setUuid(snapshotUuid)
         .setVersion(setVersion ? component.getReportAttributes().getVersion() : null)
         .setComponentUuid(componentUuid)
-        .setIncremental(incremental)
         .setLast(false)
         .setStatus(SnapshotDto.STATUS_UNPROCESSED)
         .setCreatedAt(analysisDate)
index 8d57e9bf5cde19064c15d60d23af1aa30c79694f..f0be9ded75dfe929a0ca5dcd9d166b018b9968c9 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import java.util.List;
-import javax.annotation.Nullable;
 import org.sonar.core.util.CloseableIterator;
 import org.sonar.db.DbClient;
 import org.sonar.db.DbSession;
 import org.sonar.db.duplication.DuplicationUnitDto;
 import org.sonar.scanner.protocol.output.ScannerReport;
-import org.sonar.server.computation.task.projectanalysis.analysis.Analysis;
 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit;
 import org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder;
@@ -69,9 +65,7 @@ public class PersistCrossProjectDuplicationIndexStep implements ComputationStep
 
     try (DbSession dbSession = dbClient.openSession(true)) {
       Component project = treeRootHolder.getRoot();
-      Analysis baseAnalysis = analysisMetadataHolder.getBaseAnalysis();
-      String lastAnalysysUuid = (baseAnalysis != null) ? baseAnalysis.getUuid() : null;
-      new DepthTraversalTypeAwareCrawler(new DuplicationVisitor(dbSession, analysisMetadataHolder.getUuid(), lastAnalysysUuid)).visit(project);
+      new DepthTraversalTypeAwareCrawler(new DuplicationVisitor(dbSession, analysisMetadataHolder.getUuid())).visit(project);
       dbSession.commit();
     }
   }
@@ -80,13 +74,11 @@ public class PersistCrossProjectDuplicationIndexStep implements ComputationStep
 
     private final DbSession session;
     private final String analysisUuid;
-    private final String lastAnalysisUuid;
 
-    private DuplicationVisitor(DbSession session, String analysisUuid, @Nullable String lastAnalysisUuid) {
+    private DuplicationVisitor(DbSession session, String analysisUuid) {
       super(CrawlerDepthLimit.FILE, PRE_ORDER);
       this.session = session;
       this.analysisUuid = analysisUuid;
-      this.lastAnalysisUuid = lastAnalysisUuid;
     }
 
     @Override
@@ -95,11 +87,7 @@ public class PersistCrossProjectDuplicationIndexStep implements ComputationStep
     }
 
     private void visitComponent(Component component) {
-      if (analysisMetadataHolder.isIncrementalAnalysis() && component.getStatus() == Status.SAME) {
-        readFromDb(component);
-      } else {
-        readFromReport(component);
-      }
+      readFromReport(component);
     }
 
     private void readFromReport(Component component) {
@@ -121,16 +109,6 @@ public class PersistCrossProjectDuplicationIndexStep implements ComputationStep
       }
     }
 
-    private void readFromDb(Component component) {
-      int indexInFile = 0;
-      List<DuplicationUnitDto> units = dbClient.duplicationDao().selectComponent(session, component.getUuid(), lastAnalysisUuid);
-      for (DuplicationUnitDto unit : units) {
-        unit.setAnalysisUuid(analysisUuid);
-        unit.setIndexInFile(indexInFile);
-        dbClient.duplicationDao().insert(session, unit);
-        indexInFile++;
-      }
-    }
   }
 
   @Override
index 79a8aeec7261e9bbb982b12deb664a8cfebddffa..b0219d2b094cdfe03ecefacf7868cce66fa425aa 100644 (file)
@@ -37,10 +37,8 @@ import org.sonar.db.protobuf.DbFileSources;
 import org.sonar.db.source.FileSourceDto;
 import org.sonar.db.source.FileSourceDto.Type;
 import org.sonar.scanner.protocol.output.ScannerReport;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReader;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit;
 import org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder;
@@ -71,10 +69,9 @@ public class PersistFileSourcesStep implements ComputationStep {
   private final SourceLinesRepository sourceLinesRepository;
   private final ScmInfoRepository scmInfoRepository;
   private final DuplicationRepository duplicationRepository;
-  private final AnalysisMetadataHolder analysisMetadataHolder;
 
   public PersistFileSourcesStep(DbClient dbClient, System2 system2, TreeRootHolder treeRootHolder, BatchReportReader reportReader, SourceLinesRepository sourceLinesRepository,
-    ScmInfoRepository scmInfoRepository, DuplicationRepository duplicationRepository, AnalysisMetadataHolder analysisMetadataHolder) {
+    ScmInfoRepository scmInfoRepository, DuplicationRepository duplicationRepository) {
     this.dbClient = dbClient;
     this.system2 = system2;
     this.treeRootHolder = treeRootHolder;
@@ -82,7 +79,6 @@ public class PersistFileSourcesStep implements ComputationStep {
     this.sourceLinesRepository = sourceLinesRepository;
     this.scmInfoRepository = scmInfoRepository;
     this.duplicationRepository = duplicationRepository;
-    this.analysisMetadataHolder = analysisMetadataHolder;
   }
 
   @Override
@@ -118,12 +114,8 @@ public class PersistFileSourcesStep implements ComputationStep {
 
     @Override
     public void visitFile(Component file) {
-      if (analysisMetadataHolder.isIncrementalAnalysis() && file.getStatus() == Status.SAME) {
-        return;
-      }
-
       try (CloseableIterator<String> linesIterator = sourceLinesRepository.readLines(file);
-           LineReaders lineReaders = new LineReaders(reportReader, scmInfoRepository, duplicationRepository, file)) {
+        LineReaders lineReaders = new LineReaders(reportReader, scmInfoRepository, duplicationRepository, file)) {
         ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData(linesIterator, lineReaders.readers(), file.getFileAttributes().getLines());
         ComputeFileSourceData.Data fileSourceData = computeFileSourceData.compute();
         persistSource(fileSourceData, file.getUuid(), lineReaders.getLatestChange());
index 975422d8b268b27b777198b6c3ee451820308c37..8c1504086099e532353df6da200a1dbd5c31c903 100644 (file)
@@ -42,9 +42,6 @@ public class ReportComputationSteps extends AbstractComputationSteps {
     ValidateProjectStep.class,
 
     LoadQualityProfilesStep.class,
-    
-    // copy data in the incremental mode
-    IncrementalMeasureTransitionStep.class,
 
     // load project related stuffs
     LoadQualityGateStep.class,
index 77417850dad6ae69be5b64ad7e16c4908bc1d014..62cf283c8ec87dddcdffa91875c8b403d55d1a57 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import static com.google.common.collect.FluentIterable.from;
-import static java.lang.String.format;
-import static org.sonar.api.utils.DateUtils.formatDateTime;
-
+import com.google.common.base.Joiner;
+import com.google.common.base.Optional;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-
-import javax.annotation.Nullable;
-
 import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.Scopes;
 import org.sonar.api.utils.MessageException;
@@ -47,11 +42,11 @@ import org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthL
 import org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder;
 import org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter;
-import org.sonar.server.computation.task.projectanalysis.validation.ValidateIncremental;
 import org.sonar.server.computation.task.step.ComputationStep;
 
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
+import static com.google.common.collect.FluentIterable.from;
+import static java.lang.String.format;
+import static org.sonar.api.utils.DateUtils.formatDateTime;
 
 /**
  * Validate project and modules. It will fail in the following cases :
@@ -71,19 +66,13 @@ public class ValidateProjectStep implements ComputationStep {
   private final BatchReportReader reportReader;
   private final TreeRootHolder treeRootHolder;
   private final AnalysisMetadataHolder analysisMetadataHolder;
-  private final ValidateIncremental validateIncremental;
-
-  public ValidateProjectStep(DbClient dbClient, BatchReportReader reportReader, TreeRootHolder treeRootHolder, AnalysisMetadataHolder analysisMetadataHolder) {
-    this(dbClient, reportReader, treeRootHolder, analysisMetadataHolder, null);
-  }
 
   public ValidateProjectStep(DbClient dbClient, BatchReportReader reportReader, TreeRootHolder treeRootHolder,
-    AnalysisMetadataHolder analysisMetadataHolder, @Nullable ValidateIncremental validateIncremental) {
+    AnalysisMetadataHolder analysisMetadataHolder) {
     this.dbClient = dbClient;
     this.reportReader = reportReader;
     this.treeRootHolder = treeRootHolder;
     this.analysisMetadataHolder = analysisMetadataHolder;
-    this.validateIncremental = validateIncremental;
   }
 
   @Override
@@ -126,8 +115,6 @@ public class ValidateProjectStep implements ComputationStep {
     public void visitProject(Component rawProject) {
       this.rawProject = rawProject;
       String rawProjectKey = rawProject.getKey();
-      validateIncremental(rawProjectKey);
-      validateNotIncrementalAndFirstAnalysis(rawProjectKey);
       validateBatchKey(rawProject);
 
       Optional<ComponentDto> baseProject = loadBaseComponent(rawProjectKey);
@@ -146,25 +133,6 @@ public class ValidateProjectStep implements ComputationStep {
       }
     }
 
-    private void validateIncremental(String rawProjectKey) {
-      if (analysisMetadataHolder.isIncrementalAnalysis()) {
-        if (validateIncremental == null) {
-          validationMessages.add(format("Can't process an incremental analysis of the project \"%s\" because the incremental plugin is not loaded."
-            + " Please install the plugin or launch a full analysis of the project.", rawProjectKey));
-        } else if (!validateIncremental.execute()) {
-          validationMessages.add(format("The installation of the incremental plugin is invalid. Can't process the incremental analysis "
-            + "of the project \"%s\".", rawProjectKey));
-        }
-      }
-    }
-
-    private void validateNotIncrementalAndFirstAnalysis(String rawProjectKey) {
-      if (analysisMetadataHolder.isIncrementalAnalysis() && analysisMetadataHolder.isFirstAnalysis()) {
-        validationMessages.add(format("The project \"%s\" hasn't been analysed before and the first analysis can't be incremental."
-          + " Please launch a full analysis of the project.", rawProjectKey));
-      }
-    }
-
     private void validateProjectKey(Optional<ComponentDto> baseProject, String rawProjectKey) {
       if (baseProject.isPresent() && !baseProject.get().projectUuid().equals(baseProject.get().uuid())) {
         // Project key is already used as a module of another project
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/ValidateIncremental.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/ValidateIncremental.java
deleted file mode 100644 (file)
index ea022e8..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation.task.projectanalysis.validation;
-
-public interface ValidateIncremental {
-  boolean execute();
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/package-info.java
deleted file mode 100644 (file)
index ad6b743..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.server.computation.task.projectanalysis.validation;
-
-import javax.annotation.ParametersAreNonnullByDefault;
index 85297de65b279f01042be4560f14a01317891e36..856ef29b1d6c148aa85c3fc1fea72ebd6c214413 100644 (file)
@@ -68,7 +68,6 @@ import static org.sonar.db.ce.CeQueueDto.Status.IN_PROGRESS;
 import static org.sonar.db.ce.CeQueueDto.Status.PENDING;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY;
-import static org.sonar.db.ce.CeTaskCharacteristicDto.INCREMENTAL_KEY;
 import static org.sonar.db.component.BranchType.LONG;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_QUERY;
@@ -116,7 +115,6 @@ public class ActivityActionTest {
     assertThat(task.hasAnalysisId()).isFalse();
     assertThat(task.getExecutionTimeMs()).isEqualTo(500L);
     assertThat(task.getLogs()).isFalse();
-    assertThat(task.getIncremental()).isFalse();
 
     task = activityResponse.getTasks(1);
     assertThat(task.getId()).isEqualTo("T1");
@@ -124,7 +122,6 @@ public class ActivityActionTest {
     assertThat(task.getComponentId()).isEqualTo(project1.uuid());
     assertThat(task.getLogs()).isFalse();
     assertThat(task.getOrganization()).isEqualTo(org1.getKey());
-    assertThat(task.getIncremental()).isFalse();
   }
 
   @Test
@@ -343,78 +340,6 @@ public class ActivityActionTest {
     assertThat(result.getTasksCount()).isEqualTo(2);
   }
 
-  @Test
-  public void incremental_analysis_on_single_project() {
-    ComponentDto project = db.components().insertPrivateProject();
-    SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
-    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
-    userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
-
-    ActivityResponse activityResponse = call(ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, project.uuid()));
-
-    assertThat(activityResponse.getTasksList())
-      .extracting(Task::getId, Task::getIncremental)
-      .containsExactlyInAnyOrder(tuple("T1", true));
-  }
-
-  @Test
-  public void incremental_analysis_on_search_text() {
-    ComponentDto project = db.components().insertPrivateProject();
-    SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    SnapshotDto standardAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(false));
-    CeActivityDto incrementalTask = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
-    insertCharacteristic(incrementalTask, INCREMENTAL_KEY, "true");
-    insertActivity("T2", project, SUCCESS, standardAnalysis);
-    logInAsSystemAdministrator();
-
-    ActivityResponse activityResponse = call(ws.newRequest()
-      .setParam(PARAM_COMPONENT_QUERY, project.name()));
-
-    assertThat(activityResponse.getTasksList())
-      .extracting(Task::getId, Task::getIncremental)
-      .containsExactlyInAnyOrder(
-        tuple("T1", true),
-        tuple("T2", false));
-  }
-
-  @Test
-  public void incremental_analysis_on_search_uuid() {
-    ComponentDto project = db.components().insertPrivateProject();
-    SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
-    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
-    logInAsSystemAdministrator();
-
-    ActivityResponse activityResponse = call(ws.newRequest()
-      .setParam(PARAM_COMPONENT_QUERY, "T1"));
-
-    assertThat(activityResponse.getTasksList())
-      .extracting(Task::getId, Task::getIncremental)
-      .containsExactlyInAnyOrder(tuple("T1", true));
-  }
-
-  @Test
-  public void incremental_on_in_queue_analysis() {
-    ComponentDto project = db.components().insertPrivateProject();
-    CeQueueDto queue1 = insertQueue("T1", project, PENDING);
-    insertCharacteristic(queue1, INCREMENTAL_KEY, "true");
-    CeQueueDto queue2 = insertQueue("T2", project, IN_PROGRESS);
-    insertCharacteristic(queue2, INCREMENTAL_KEY, "true");
-    userSession.logIn().addProjectPermission(UserRole.ADMIN, project);
-
-    ActivityResponse activityResponse = call(ws.newRequest()
-      .setParam(PARAM_COMPONENT_ID, project.uuid())
-      .setParam("status", "PENDING,FAILED,IN_PROGRESS"));
-
-    assertThat(activityResponse.getTasksList())
-      .extracting(Task::getId, Task::getIncremental)
-      .containsExactlyInAnyOrder(
-        tuple("T1", true),
-        tuple("T2", true));
-  }
-
   @Test
   public void long_living_branch_in_past_activity() {
     logInAsSystemAdministrator();
index aabe69a6f3b20ff1ddd53e976aefc37d18bb9abf..cf75d3afc540eb57143a40d8c144b60ad2fda697 100644 (file)
@@ -51,7 +51,6 @@ import static org.sonar.db.ce.CeQueueDto.Status.IN_PROGRESS;
 import static org.sonar.db.ce.CeQueueDto.Status.PENDING;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY;
 import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY;
-import static org.sonar.db.ce.CeTaskCharacteristicDto.INCREMENTAL_KEY;
 import static org.sonar.db.component.BranchType.LONG;
 import static org.sonar.db.component.BranchType.SHORT;
 import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
@@ -110,7 +109,6 @@ public class ComponentActionTest {
       .extracting(WsCe.Task::getOrganization)
       .containsOnly(organization.getKey());
     assertThat(response.getCurrent().getOrganization()).isEqualTo(organization.getKey());
-    assertThat(response.getCurrent().getIncremental()).isFalse();
   }
 
   @Test
@@ -162,44 +160,6 @@ public class ComponentActionTest {
     assertThat(response.getCurrent().getId()).isEqualTo("T3");
   }
 
-  @Test
-  public void incremental_analysis_by_component_key() {
-    ComponentDto project = db.components().insertPrivateProject();
-    userSession.logIn().addProjectPermission(UserRole.USER, project);
-    SnapshotDto incrementalAnalysis = db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    CeActivityDto activity = insertActivity("T1", project, SUCCESS, incrementalAnalysis);
-    insertCharacteristic(activity, INCREMENTAL_KEY, "true");
-
-    WsCe.ProjectResponse response = ws.newRequest()
-      .setParam(PARAM_COMPONENT, project.getKey())
-      .executeProtobuf(WsCe.ProjectResponse.class);
-
-    assertThat(response.getCurrent())
-      .extracting(WsCe.Task::getId, WsCe.Task::getIncremental)
-      .containsExactlyInAnyOrder("T1", true);
-  }
-
-  @Test
-  public void incremental_on_in_queue_analysis() {
-    OrganizationDto organization = db.organizations().insert();
-    ComponentDto project = db.components().insertPrivateProject(organization);
-    userSession.addProjectPermission(UserRole.USER, project);
-    CeQueueDto queue1 = insertQueue("T1", project, IN_PROGRESS);
-    insertCharacteristic(queue1, INCREMENTAL_KEY, "true");
-    CeQueueDto queue2 = insertQueue("T2", project, PENDING);
-    insertCharacteristic(queue2, INCREMENTAL_KEY, "true");
-
-    WsCe.ProjectResponse response = ws.newRequest()
-      .setParam(PARAM_COMPONENT, project.getKey())
-      .executeProtobuf(WsCe.ProjectResponse.class);
-
-    assertThat(response.getQueueList())
-      .extracting(WsCe.Task::getId, WsCe.Task::getIncremental)
-      .containsOnly(
-        tuple("T1", true),
-        tuple("T2", true));
-  }
-
   @Test
   public void long_living_branch_in_activity() {
     ComponentDto project = db.components().insertMainBranch();
@@ -256,20 +216,17 @@ public class ComponentActionTest {
     CeQueueDto shortLivingBranchQueue = insertQueue("Short", project, PENDING);
     insertCharacteristic(shortLivingBranchQueue, BRANCH_KEY, shortLivingBranch.getBranch());
     insertCharacteristic(shortLivingBranchQueue, BRANCH_TYPE_KEY, SHORT.name());
-    CeQueueDto incrementalQueue = insertQueue("Incremental", project, PENDING);
-    insertCharacteristic(incrementalQueue, INCREMENTAL_KEY, "true");
 
     WsCe.ProjectResponse response = ws.newRequest()
       .setParam(PARAM_COMPONENT, longLivingBranch.getKey())
       .executeProtobuf(WsCe.ProjectResponse.class);
 
     assertThat(response.getQueueList())
-      .extracting(WsCe.Task::getId, WsCe.Task::getComponentKey, WsCe.Task::getBranch, WsCe.Task::getBranchType, WsCe.Task::getIncremental)
+      .extracting(WsCe.Task::getId, WsCe.Task::getComponentKey, WsCe.Task::getBranch, WsCe.Task::getBranchType)
       .containsOnly(
-        tuple("Main", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE, false),
-        tuple("Long", longLivingBranch.getKey(), longLivingBranch.getBranch(), Common.BranchType.LONG, false),
-        tuple("Short", shortLivingBranch.getKey(), shortLivingBranch.getBranch(), Common.BranchType.SHORT, false),
-        tuple("Incremental", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE, true));
+        tuple("Main", project.getKey(), "", Common.BranchType.UNKNOWN_BRANCH_TYPE),
+        tuple("Long", longLivingBranch.getKey(), longLivingBranch.getBranch(), Common.BranchType.LONG),
+        tuple("Short", shortLivingBranch.getKey(), shortLivingBranch.getBranch(), Common.BranchType.SHORT));
   }
 
   @Test
index 4f08695fa3a0a3d0d8c2ddaaf4be4bae59027001..2e92ee646efecd462471138c730042682796991c 100644 (file)
  */
 package org.sonar.server.ce.ws;
 
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.entry;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyMapOf;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Map;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
@@ -50,6 +40,15 @@ import org.sonar.test.JsonAssert;
 import org.sonarqube.ws.MediaTypes;
 import org.sonarqube.ws.WsCe;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.entry;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyMapOf;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 public class SubmitActionTest {
 
   private static final CeTask A_CE_TASK = new CeTask.Builder()
@@ -97,7 +96,7 @@ public class SubmitActionTest {
     when(reportSubmitter.submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"),
       anyMapOf(String.class, String.class), any(InputStream.class))).thenReturn(A_CE_TASK);
 
-    String[] characteristics = {"branch=branch1", "incremental=true", "key=value1=value2"};
+    String[] characteristics = {"branch=branch1", "key=value1=value2"};
     WsCe.SubmitResponse submitResponse = tester.newRequest()
       .setParam("projectKey", "my_project")
       .setParam("projectName", "My Project")
@@ -110,7 +109,7 @@ public class SubmitActionTest {
     verify(reportSubmitter).submit(eq(organizationKey), eq("my_project"), Matchers.isNull(String.class), eq("My Project"),
       map.capture(), any(InputStream.class));
 
-    assertThat(map.getValue()).containsOnly(entry("incremental", "true"), entry("branch", "branch1"), entry("key", "value1=value2"));
+    assertThat(map.getValue()).containsOnly(entry("branch", "branch1"), entry("key", "value1=value2"));
   }
 
   @Test
index b2f66b0eff1b235b5db034bd7873940e0114aae2..14d998d9231ba7d7a354e7238390475815d38f0f 100644 (file)
@@ -100,7 +100,6 @@ public class TaskActionTest {
     assertThat(taskResponse.getTask().getComponentName()).isEqualTo(project.name());
     assertThat(taskResponse.getTask().hasExecutionTimeMs()).isFalse();
     assertThat(taskResponse.getTask().getLogs()).isFalse();
-    assertThat(taskResponse.getTask().getIncremental()).isFalse();
   }
 
   @Test
@@ -125,37 +124,6 @@ public class TaskActionTest {
     assertThat(task.getLogs()).isFalse();
   }
 
-  @Test
-  public void incremental_on_queued_task() {
-    logInAsRoot();
-
-    ComponentDto project = db.components().insertPrivateProject();
-    CeQueueDto queueDto = createAndPersistQueueTask(project);
-    insertCharacteristic(queueDto, "incremental", "true");
-
-    WsCe.TaskResponse taskResponse = ws.newRequest()
-      .setParam("id", SOME_TASK_UUID)
-      .executeProtobuf(WsCe.TaskResponse.class);
-
-    assertThat(taskResponse.getTask().getIncremental()).isTrue();
-  }
-
-  @Test
-  public void incremental_on_archived_task() {
-    logInAsRoot();
-
-    ComponentDto project = db.components().insertPrivateProject();
-    db.components().insertSnapshot(project, s -> s.setIncremental(true));
-    CeActivityDto activity = createAndPersistArchivedTask(project);
-    insertCharacteristic(activity, "incremental", "true");
-
-    WsCe.TaskResponse taskResponse = ws.newRequest()
-      .setParam("id", SOME_TASK_UUID)
-      .executeProtobuf(WsCe.TaskResponse.class);
-
-    assertThat(taskResponse.getTask().getIncremental()).isTrue();
-  }
-
   @Test
   public void long_living_branch_in_past_activity() {
     logInAsRoot();
index d27897d7523e75a4f5d88658b174e528cac1b223..998087518f38310ec23551f0513be0a3907c8ff7 100644 (file)
@@ -214,52 +214,6 @@ public class AnalysisMetadataHolderImplTest {
     underTest.setCrossProjectDuplicationEnabled(false);
   }
 
-  @Test
-  public void setIsIncrementalAnalysis_throws_ISE_when_called_twice() {
-    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
-    underTest.setIncrementalAnalysis(true);
-
-    expectedException.expect(IllegalStateException.class);
-    expectedException.expectMessage("Incremental analysis flag has already been set");
-    underTest.setIncrementalAnalysis(false);
-  }
-
-  @Test
-  public void isIncrementalAnalysis_return_true() {
-    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
-
-    underTest.setIncrementalAnalysis(true);
-
-    assertThat(underTest.isIncrementalAnalysis()).isEqualTo(true);
-  }
-
-  @Test
-  public void isIncrementalAnalysis_return_false() {
-    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
-
-    underTest.setIncrementalAnalysis(false);
-
-    assertThat(underTest.isIncrementalAnalysis()).isEqualTo(false);
-  }
-
-  @Test
-  public void isIncrementalAnalysisEnabled_throws_ISE_when_holder_is_not_initialized() {
-    expectedException.expect(IllegalStateException.class);
-    expectedException.expectMessage("Incremental analysis flag has not been set");
-
-    new AnalysisMetadataHolderImpl().isIncrementalAnalysis();
-  }
-
-  @Test
-  public void setIsIncrementalAnalys_throws_ISE_when_called_twice() {
-    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
-    underTest.setIncrementalAnalysis(true);
-
-    expectedException.expect(IllegalStateException.class);
-    expectedException.expectMessage("Incremental analysis flag has already been set");
-    underTest.setIncrementalAnalysis(false);
-  }
-
   @Test
   public void set_branch() {
     AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl();
index 8f310b303314fb8c0790d9314b80a8ce0641b4cf..01b243ad582960cee17d6e824577f29640474bf7 100644 (file)
@@ -42,8 +42,6 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
 
   private final InitializedProperty<Long> analysisDate = new InitializedProperty<>();
 
-  private final InitializedProperty<Boolean> incremental = new InitializedProperty<>();
-
   private final InitializedProperty<Analysis> baseAnalysis = new InitializedProperty<>();
 
   private final InitializedProperty<Boolean> crossProjectDuplicationEnabled = new InitializedProperty<>();
@@ -204,18 +202,6 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
     return pluginsByKey.getProperty();
   }
 
-  @Override
-  public boolean isIncrementalAnalysis() {
-    checkState(incremental.isInitialized(), "Incremental mode flag has not been set");
-    return incremental.getProperty();
-  }
-
-  @Override
-  public AnalysisMetadataHolderRule setIncrementalAnalysis(boolean isIncrementalAnalysis) {
-    this.incremental.setProperty(isIncrementalAnalysis);
-    return this;
-  }
-
   @Override
   public boolean isShortLivingBranch() {
     Branch property = this.branch.getProperty();
index 32d7cdbe5c960952f0e3d5eab2e2461cba6e777a..4d6a7124f6a48928d46c9f90a9d02beb7f426979 100644 (file)
@@ -154,17 +154,6 @@ public class MutableAnalysisMetadataHolderRule extends ExternalResource implemen
     return delegate.getScannerPluginsByKey();
   }
 
-  @Override
-  public boolean isIncrementalAnalysis() {
-    return delegate.isIncrementalAnalysis();
-  }
-
-  @Override
-  public MutableAnalysisMetadataHolder setIncrementalAnalysis(boolean isIncrementalAnalysis) {
-    delegate.setIncrementalAnalysis(isIncrementalAnalysis);
-    return this;
-  }
-
   @Override
   public boolean isShortLivingBranch() {
     return delegate.isShortLivingBranch();
index 31039ddee50b46e59e940014c6d308e5d1cab16a..2ad15bd70935927ad7aa04fe6b1dee9999efcaef 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.issue;
 
-import static com.google.common.collect.Lists.newArrayList;
-import static java.util.Arrays.asList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.sonar.server.computation.task.projectanalysis.component.ReportComponent.builder;
-
+import com.google.common.base.Optional;
 import java.util.List;
-
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -55,7 +46,6 @@ import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolder;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
 import org.sonar.server.computation.task.projectanalysis.component.MergeBranchComponentUuids;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
@@ -66,7 +56,14 @@ import org.sonar.server.computation.task.projectanalysis.issue.filter.IssueFilte
 import org.sonar.server.computation.task.projectanalysis.qualityprofile.ActiveRulesHolderRule;
 import org.sonar.server.computation.task.projectanalysis.source.SourceLinesRepositoryRule;
 
-import com.google.common.base.Optional;
+import static com.google.common.collect.Lists.newArrayList;
+import static java.util.Arrays.asList;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.sonar.server.computation.task.projectanalysis.component.ReportComponent.builder;
 
 public class IntegrateIssuesVisitorTest {
 
@@ -144,30 +141,8 @@ public class IntegrateIssuesVisitorTest {
     trackingDelegator = new IssueTrackingDelegator(shortBranchTracker, mergeBranchTracker, tracker, analysisMetadataHolder);
     treeRootHolder.setRoot(PROJECT);
     issueCache = new IssueCache(temp.newFile(), System2.INSTANCE);
-    when(analysisMetadataHolder.isIncrementalAnalysis()).thenReturn(false);
-    when(analysisMetadataHolder.getBranch()).thenReturn(java.util.Optional.of(new DefaultBranchImpl()));
     when(issueFilter.accept(any(DefaultIssue.class), eq(FILE))).thenReturn(true);
-    underTest = new IntegrateIssuesVisitor(issueCache, issueLifecycle, issueVisitors, issuesLoader, analysisMetadataHolder, trackingDelegator);
-  }
-
-  @Test
-  public void process_issues_on_incremental_mode() {
-    when(analysisMetadataHolder.isIncrementalAnalysis()).thenReturn(true);
-
-    Component file = builder(Component.Type.FILE, FILE_REF)
-      .setKey(FILE_KEY)
-      .setUuid(FILE_UUID)
-      .setStatus(Status.SAME)
-      .build();
-
-    addBaseIssue(RuleTesting.XOO_X1);
-
-    underTest.visitAny(file);
-
-    verify(issueLifecycle).doAutomaticTransition(defaultIssueCaptor.capture());
-    assertThat(defaultIssueCaptor.getValue().ruleKey().rule()).isEqualTo("x1");
-
-    assertThat(newArrayList(issueCache.traverse())).hasSize(1);
+    underTest = new IntegrateIssuesVisitor(issueCache, issueLifecycle, issueVisitors, trackingDelegator);
   }
 
   @Test
index dc1c6b98f564582f61e9f2cabccff66cf91de7a6..22b950770fb00d9ff4c98260b316aed9a5c5934d 100644 (file)
@@ -37,7 +37,6 @@ import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetada
 import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.MergeBranchComponentUuids;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryImpl.NoScmInfo;
 import org.sonar.server.computation.task.projectanalysis.source.SourceHashRepositoryImpl;
@@ -76,26 +75,10 @@ public class ScmInfoDbLoaderTest {
 
   private ScmInfoDbLoader underTest = new ScmInfoDbLoader(analysisMetadataHolder, dbTester.getDbClient(), sourceHashRepository, mergeBranchComponentUuids);
 
-  @Test
-  public void dont_check_hash_for_unmodified_files_incremental_analysis() {
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-    analysisMetadataHolder.setBranch(null);
-    analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
-
-    addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
-
-    Component file = builder(Component.Type.FILE, FILE_REF).setKey("FILE_KEY").setUuid("FILE_UUID").setStatus(Status.SAME).build();
-    ScmInfo scmInfo = underTest.getScmInfoFromDb(file);
-    assertThat(scmInfo.getAllChangesets()).hasSize(1);
-
-    assertThat(logTester.logs(TRACE)).containsOnly("Reading SCM info from db for file 'FILE_UUID'");
-  }
-
   @Test
   public void returns_ScmInfo_from_DB_if_hashes_are_the_same() throws Exception {
     analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     analysisMetadataHolder.setBranch(null);
-    analysisMetadataHolder.setIncrementalAnalysis(false);
 
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1));
     addFileSourceInReport(1);
@@ -110,7 +93,6 @@ public class ScmInfoDbLoaderTest {
   public void read_from_merge_branch_if_no_base() {
     analysisMetadataHolder.setBaseAnalysis(null);
     analysisMetadataHolder.setBranch(branch);
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     String mergeFileUuid = "mergeFileUuid";
 
     when(mergeBranchComponentUuids.getUuid(FILE.getKey())).thenReturn(mergeFileUuid);
@@ -126,7 +108,6 @@ public class ScmInfoDbLoaderTest {
   public void returns_absent_when_branch_and_source_is_different() {
     analysisMetadataHolder.setBaseAnalysis(null);
     analysisMetadataHolder.setBranch(branch);
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     String mergeFileUuid = "mergeFileUuid";
 
     when(mergeBranchComponentUuids.getUuid(FILE.getKey())).thenReturn(mergeFileUuid);
@@ -141,7 +122,6 @@ public class ScmInfoDbLoaderTest {
   public void returns_absent_when__hashes_are_not_the_same() throws Exception {
     analysisMetadataHolder.setBaseAnalysis(baseProjectAnalysis);
     analysisMetadataHolder.setBranch(null);
-    analysisMetadataHolder.setIncrementalAnalysis(false);
 
     addFileSourceInReport(1);
     addFileSourceInDb("henry", DATE_1, "rev-1", computeSourceHash(1) + "_different");
index 380c64ecbf9a0f4e1697f911b3053b9f8f457605..b572835270e9abb6da7a7c4483c9da0cdf8b9b62 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.duplication.DuplicationMeasures;
-import org.sonar.server.computation.task.projectanalysis.duplication.IncrementalDuplicationMeasures;
 import org.sonar.server.computation.task.step.ComputationStep;
 
+import static org.mockito.Mockito.verify;
+
 public class DuplicationMeasuresStepTest extends BaseStepTest {
   @Mock
   private DuplicationMeasures defaultDuplicationMeasures;
-  @Mock
-  private IncrementalDuplicationMeasures incrementalDuplicationMeasures;
-  @Rule
-  public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
 
   private DuplicationMeasuresStep underTest;
 
   @Before
   public void before() {
     MockitoAnnotations.initMocks(this);
-    underTest = new DuplicationMeasuresStep(analysisMetadataHolder, defaultDuplicationMeasures, incrementalDuplicationMeasures);
-  }
-
-  @Test
-  public void incremental_analysis_mode() {
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-    underTest.execute();
-    verify(incrementalDuplicationMeasures).execute();
-    verifyZeroInteractions(defaultDuplicationMeasures);
+    underTest = new DuplicationMeasuresStep(defaultDuplicationMeasures);
   }
 
   @Test
   public void full_analysis_mode() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     underTest.execute();
     verify(defaultDuplicationMeasures).execute();
-    verifyZeroInteractions(incrementalDuplicationMeasures);
   }
 
   @Override
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStepTest.java
deleted file mode 100644 (file)
index 2afefb6..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.server.computation.task.projectanalysis.step;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
-import org.sonar.server.computation.task.projectanalysis.measure.IncrementalMeasureTransition;
-import org.sonar.server.computation.task.step.ComputationStep;
-
-public class IncrementalMeasureTransitionStepTest extends BaseStepTest {
-  @Rule
-  public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
-
-  IncrementalMeasureTransitionStep underTest = new IncrementalMeasureTransitionStep(analysisMetadataHolder);
-
-  @Override
-  protected ComputationStep step() {
-    return underTest;
-  }
-
-  @Test
-  public void skip_if_not_incremental() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
-    underTest.execute();
-  }
-
-  @Test
-  public void execute_if_incremental() {
-    IncrementalMeasureTransition runnable = mock(IncrementalMeasureTransition.class);
-    IncrementalMeasureTransitionStep underTest = new IncrementalMeasureTransitionStep(analysisMetadataHolder, runnable);
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-
-    underTest.execute();
-    verify(runnable).run();
-  }
-
-}
index 98b4a8a0f034e7859a0d7f5dd6d5fe3f44ecff6f..cc3ddb7b3822939035c30b0ddb3e3f23051351c1 100644 (file)
@@ -24,10 +24,9 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.sonar.scanner.protocol.output.ScannerReport;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
-import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
+import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.VisitException;
 import org.sonar.server.computation.task.projectanalysis.duplication.DetailedTextBlock;
 import org.sonar.server.computation.task.projectanalysis.duplication.Duplicate;
@@ -55,47 +54,24 @@ public class LoadDuplicationsFromReportStepTest {
     builder(PROJECT, ROOT_REF)
       .addChildren(
         builder(FILE, FILE_1_REF).build(),
-        builder(FILE, FILE_2_REF).build()
-      )
-      .build()
-    );
+        builder(FILE, FILE_2_REF).build())
+      .build());
   @Rule
   public BatchReportReaderRule reportReader = new BatchReportReaderRule();
   @Rule
   public DuplicationRepositoryRule duplicationRepository = DuplicationRepositoryRule.create(treeRootHolder);
   @Rule
   public ExpectedException expectedException = ExpectedException.none();
-  @Rule
-  public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
 
-  private LoadDuplicationsFromReportStep underTest = new LoadDuplicationsFromReportStep(treeRootHolder, reportReader, duplicationRepository, analysisMetadataHolder);
+  private LoadDuplicationsFromReportStep underTest = new LoadDuplicationsFromReportStep(treeRootHolder, reportReader, duplicationRepository);
 
   @Test
   public void verify_description() {
     assertThat(underTest.getDescription()).isEqualTo("Load inner file and in project duplications");
   }
-  
-  @Test
-  public void skip_if_incremental_analysis() {
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-    reportReader.putDuplications(FILE_2_REF, createDuplication(singleLineTextRange(LINE), createInnerDuplicate(LINE + 1)));
-
-    underTest.execute();
-
-    assertNoDuplication(FILE_2_REF);
-  }
-
-  @Test
-  public void loads_no_duplications_if_reader_has_no_duplication() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
-    underTest.execute();
-
-    assertNoDuplication(FILE_1_REF);
-  }
 
   @Test
   public void loads_duplication_without_otherFileRef_as_inner_duplication() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     reportReader.putDuplications(FILE_2_REF, createDuplication(singleLineTextRange(LINE), createInnerDuplicate(LINE + 1)));
 
     underTest.execute();
@@ -106,7 +82,6 @@ public class LoadDuplicationsFromReportStepTest {
 
   @Test
   public void loads_duplication_with_otherFileRef_as_inProject_duplication() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(LINE), createInProjectDuplicate(FILE_2_REF, LINE + 1)));
 
     underTest.execute();
@@ -117,7 +92,6 @@ public class LoadDuplicationsFromReportStepTest {
 
   @Test
   public void loads_multiple_duplications_with_multiple_duplicates() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     reportReader.putDuplications(
       FILE_2_REF,
       createDuplication(
@@ -128,8 +102,7 @@ public class LoadDuplicationsFromReportStepTest {
         createInProjectDuplicate(FILE_1_REF, OTHER_LINE)),
       createDuplication(
         singleLineTextRange(OTHER_LINE + 80),
-        createInnerDuplicate(LINE), createInnerDuplicate(LINE + 10))
-      );
+        createInnerDuplicate(LINE), createInnerDuplicate(LINE + 10)));
 
     underTest.execute();
 
@@ -141,18 +114,14 @@ public class LoadDuplicationsFromReportStepTest {
         new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 10))),
       duplication(
         singleLineDetailedTextBlock(2, OTHER_LINE),
-        new InProjectDuplicate(file1Component, singleLineTextBlock(OTHER_LINE))
-      ),
+        new InProjectDuplicate(file1Component, singleLineTextBlock(OTHER_LINE))),
       duplication(
         singleLineDetailedTextBlock(3, OTHER_LINE + 80),
-        new InnerDuplicate(singleLineTextBlock(LINE)), new InnerDuplicate(singleLineTextBlock(LINE + 10))
-      )
-      );
+        new InnerDuplicate(singleLineTextBlock(LINE)), new InnerDuplicate(singleLineTextBlock(LINE + 10))));
   }
 
   @Test
   public void loads_never_consider_originals_from_batch_on_same_lines_as_the_equals() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     reportReader.putDuplications(
       FILE_2_REF,
       createDuplication(
@@ -160,8 +129,7 @@ public class LoadDuplicationsFromReportStepTest {
         createInnerDuplicate(LINE + 1), createInnerDuplicate(LINE + 2), createInProjectDuplicate(FILE_1_REF, LINE + 2)),
       createDuplication(
         singleLineTextRange(LINE),
-        createInnerDuplicate(LINE + 2), createInnerDuplicate(LINE + 3), createInProjectDuplicate(FILE_1_REF, LINE + 2))
-      );
+        createInnerDuplicate(LINE + 2), createInnerDuplicate(LINE + 3), createInProjectDuplicate(FILE_1_REF, LINE + 2)));
 
     underTest.execute();
 
@@ -170,19 +138,15 @@ public class LoadDuplicationsFromReportStepTest {
       duplication(
         singleLineDetailedTextBlock(1, LINE),
         new InnerDuplicate(singleLineTextBlock(LINE + 1)), new InnerDuplicate(singleLineTextBlock(LINE + 2)),
-        new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))
-      ),
+        new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))),
       duplication(
         singleLineDetailedTextBlock(2, LINE),
         new InnerDuplicate(singleLineTextBlock(LINE + 2)), new InnerDuplicate(singleLineTextBlock(LINE + 3)),
-        new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))
-      )
-      );
+        new InProjectDuplicate(file1Component, singleLineTextBlock(LINE + 2))));
   }
 
   @Test
   public void loads_duplication_with_otherFileRef_throws_IAE_if_component_does_not_exist() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     int line = 2;
     reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(line), createInProjectDuplicate(666, line + 1)));
 
@@ -194,7 +158,6 @@ public class LoadDuplicationsFromReportStepTest {
 
   @Test
   public void loads_duplication_with_otherFileRef_throws_IAE_if_references_itself() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     int line = 2;
     reportReader.putDuplications(FILE_1_REF, createDuplication(singleLineTextRange(line), createInProjectDuplicate(FILE_1_REF, line + 1)));
 
index 49b273283a86860004801a1c15356c898b9de80f..ba8bf417e1e8cd9d492a2f0b7f752e4c586f302e 100644 (file)
@@ -121,30 +121,6 @@ public class LoadReportAnalysisMetadataHolderStepTest {
     assertThat(analysisMetadataHolder.isCrossProjectDuplicationEnabled()).isEqualTo(false);
   }
 
-  @Test
-  public void set_incremental_analysis_to_true() {
-    reportReader.setMetadata(
-      newBatchReportBuilder()
-        .setIncremental(true)
-        .build());
-
-    underTest.execute();
-
-    assertThat(analysisMetadataHolder.isIncrementalAnalysis()).isTrue();
-  }
-
-  @Test
-  public void set_incremental_analysis_to_false() {
-    reportReader.setMetadata(
-      newBatchReportBuilder()
-        .setIncremental(false)
-        .build());
-
-    underTest.execute();
-
-    assertThat(analysisMetadataHolder.isIncrementalAnalysis()).isFalse();
-  }
-
   @Test
   public void set_cross_project_duplication_to_false_when_nothing_in_the_report() {
     reportReader.setMetadata(
index bbb35da5f17a701a9978629fbbe694c80c49b188..5eb3e51d4a308db2879d203f21e29fdb77120ec8 100644 (file)
@@ -30,9 +30,7 @@ import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.sonar.api.utils.System2;
 import org.sonar.db.DbClient;
-import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
-import org.sonar.db.duplication.DuplicationUnitDto;
 import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.server.computation.task.projectanalysis.analysis.Analysis;
 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
@@ -95,39 +93,9 @@ public class PersistCrossProjectDuplicationIndexStepTest {
     when(baseAnalysis.getUuid()).thenReturn(BASE_ANALYSIS_UUID);
     analysisMetadataHolder.setUuid(ANALYSIS_UUID);
     analysisMetadataHolder.setBaseAnalysis(baseAnalysis);
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     underTest = new PersistCrossProjectDuplicationIndexStep(crossProjectDuplicationStatusHolder, dbClient, treeRootHolder, analysisMetadataHolder, reportReader);
   }
 
-  @Test
-  public void copy_base_analysis_in_incremental_mode() {
-    when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-    DuplicationUnitDto dup = new DuplicationUnitDto();
-    dup.setAnalysisUuid(BASE_ANALYSIS_UUID);
-    dup.setComponentUuid(FILE_2_UUID);
-    dup.setEndLine(0);
-    dup.setHash("asd");
-    dup.setStartLine(0);
-    dup.setId(1);
-    dup.setIndexInFile(1);
-    try (DbSession session = dbTester.getSession()) {
-      dbClient.duplicationDao().insert(session, dup);
-      session.commit();
-    }
-    assertThat(dbTester.countRowsOfTable("duplications_index")).isEqualTo(1);
-    underTest.execute();
-
-    Map<String, Object> dto = dbTester.selectFirst("select HASH, START_LINE, END_LINE, INDEX_IN_FILE, COMPONENT_UUID, ANALYSIS_UUID "
-      + "from duplications_index where analysis_uuid = '" + ANALYSIS_UUID + "'");
-    assertThat(dto.get("HASH")).isEqualTo("asd");
-    assertThat(dto.get("START_LINE")).isEqualTo(0L);
-    assertThat(dto.get("END_LINE")).isEqualTo(0L);
-    assertThat(dto.get("INDEX_IN_FILE")).isEqualTo(0L);
-    assertThat(dto.get("COMPONENT_UUID")).isEqualTo(FILE_2.getUuid());
-    assertThat(dto.get("ANALYSIS_UUID")).isEqualTo(ANALYSIS_UUID);
-  }
-
   @Test
   public void persist_cpd_text_block() throws Exception {
     when(crossProjectDuplicationStatusHolder.isEnabled()).thenReturn(true);
index 33437bf9b65c3fbdf5b116b1fcf2fa4daa3281e6..83dddc8cf4091ebb49013ec27aa4273b6feefc08 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import static com.google.common.collect.Lists.newArrayList;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import java.util.Arrays;
-
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -40,10 +34,8 @@ import org.sonar.db.source.FileSourceDto.Type;
 import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
 import org.sonar.scanner.protocol.output.ScannerReport.SyntaxHighlightingRule.HighlightingType;
-import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
-import org.sonar.server.computation.task.projectanalysis.component.Component.Status;
 import org.sonar.server.computation.task.projectanalysis.component.FileAttributes;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
@@ -57,6 +49,11 @@ import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRu
 import org.sonar.server.computation.task.projectanalysis.source.SourceLinesRepositoryRule;
 import org.sonar.server.computation.task.step.ComputationStep;
 
+import static com.google.common.collect.Lists.newArrayList;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 public class PersistFileSourcesStepTest extends BaseStepTest {
 
   private static final int FILE1_REF = 3;
@@ -84,8 +81,6 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
   public SourceLinesRepositoryRule fileSourceRepository = new SourceLinesRepositoryRule();
   @Rule
   public DuplicationRepositoryRule duplicationRepository = DuplicationRepositoryRule.create(treeRootHolder);
-  @Rule
-  public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule().setIncrementalAnalysis(false);
 
   private DbClient dbClient = dbTester.getDbClient();
   private DbSession session = dbTester.getSession();
@@ -96,7 +91,7 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
   public void setup() {
     when(system2.now()).thenReturn(NOW);
     underTest = new PersistFileSourcesStep(dbClient, system2, treeRootHolder, reportReader, fileSourceRepository, scmInfoRepository,
-      duplicationRepository, analysisMetadataHolder);
+      duplicationRepository);
   }
 
   @Override
@@ -128,15 +123,6 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
     assertThat(data.getLines(1).getSource()).isEqualTo("line2");
   }
 
-  @Test
-  public void dont_persist_unchanged_sources_if_incremental() {
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-    initIncrementalReport(2);
-
-    underTest.execute();
-    assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
-  }
-
   @Test
   public void persist_source_hashes() {
     initBasicReport(2);
@@ -473,58 +459,6 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
     assertThat(fileSourceDto.getRevision()).isNull();
   }
 
-  private void initIncrementalReport(int numberOfLines) {
-    treeRootHolder.setRoot(ReportComponent
-      .builder(Component.Type.PROJECT, 1)
-      .setUuid(PROJECT_UUID)
-      .setKey(PROJECT_KEY)
-      .addChildren(
-        ReportComponent
-          .builder(Component.Type.MODULE, 2)
-          .setUuid("MODULE")
-          .setKey("MODULE_KEY")
-          .addChildren(
-            ReportComponent
-              .builder(Component.Type.FILE, FILE1_REF)
-              .setUuid(FILE1_UUID)
-              .setKey("MODULE_KEY:src/Foo.java")
-              .setFileAttributes(new FileAttributes(false, null, numberOfLines))
-              .setStatus(Status.CHANGED)
-              .build())
-          .build(),
-        ReportComponent
-          .builder(Component.Type.FILE, FILE2_REF)
-          .setUuid(FILE2_UUID)
-          .setKey("MODULE_KEY:src/Foo2.java")
-          .setStatus(Status.SAME).build())
-      .build());
-
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(1)
-      .setType(ComponentType.PROJECT)
-      .addChildRef(2)
-      .build());
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(2)
-      .setType(ComponentType.MODULE)
-      .addChildRef(FILE1_REF)
-      .build());
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(FILE1_REF)
-      .setType(ComponentType.FILE)
-      .setLines(numberOfLines)
-      .build());
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(FILE2_REF)
-      .setType(ComponentType.FILE)
-      .setLines(numberOfLines)
-      .build());
-
-    for (int i = 1; i <= numberOfLines; i++) {
-      fileSourceRepository.addLine(FILE1_REF, "line" + i);
-    }
-  }
-
   private void initBasicReport(int numberOfLines) {
     treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).addChildren(
       ReportComponent.builder(Component.Type.MODULE, 2).setUuid("MODULE").setKey("MODULE_KEY").addChildren(
index a892fc57f9d3fe778c8f02d577573c1aca58fc18..40fbf42f13384a631dbc63e7935ca41740640b7a 100644 (file)
@@ -98,7 +98,6 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
 
   @Test
   public void persist_analysis() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     OrganizationDto organizationDto = dbTester.organizations().insert();
     ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
@@ -133,7 +132,6 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
     assertThat(projectSnapshot.getStatus()).isEqualTo("U");
     assertThat(projectSnapshot.getCreatedAt()).isEqualTo(analysisDate);
     assertThat(projectSnapshot.getBuildDate()).isEqualTo(now);
-    assertThat(projectSnapshot.getIncremental()).isFalse();
 
     assertThat(dbIdsRepository.getComponentId(module)).isEqualTo(moduleDto.getId());
     assertThat(dbIdsRepository.getComponentId(directory)).isEqualTo(directoryDto.getId());
@@ -142,7 +140,6 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
 
   @Test
   public void persist_snapshots_with_leak_period() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     OrganizationDto organizationDto = dbTester.organizations().insert();
     ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(organizationDto, "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
@@ -165,7 +162,6 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
 
   @Test
   public void only_persist_snapshots_with_leak_period_on_project_and_module() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     periodsHolder.setPeriod(new Period(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, analysisDate, "u1"));
 
     OrganizationDto organizationDto = dbTester.organizations().insert();
@@ -204,7 +200,6 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
 
   @Test
   public void set_no_period_on_snapshots_when_no_period() {
-    analysisMetadataHolder.setIncrementalAnalysis(false);
     ComponentDto projectDto = ComponentTesting.newPrivateProjectDto(dbTester.organizations().insert(), "ABCD").setDbKey(PROJECT_KEY).setName("Project");
     dbClient.componentDao().insert(dbTester.getSession(), projectDto);
     SnapshotDto snapshotDto = SnapshotTesting.newAnalysis(projectDto);
index e4ae60c52f027628658f8821ae754d928f0f1120..1c175d0d7d1f5476618971eb5553fc550f5f0c31 100644 (file)
  */
 package org.sonar.server.computation.task.projectanalysis.step;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 import java.util.Date;
-
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -38,15 +34,13 @@ import org.sonar.db.component.SnapshotTesting;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType;
-import org.sonar.server.computation.task.projectanalysis.analysis.Analysis;
 import org.sonar.server.computation.task.projectanalysis.analysis.AnalysisMetadataHolderRule;
 import org.sonar.server.computation.task.projectanalysis.analysis.Branch;
-import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
 import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
+import org.sonar.server.computation.task.projectanalysis.component.DefaultBranchImpl;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
-import org.sonar.server.computation.task.projectanalysis.validation.ValidateIncremental;
 
 public class ValidateProjectStepTest {
 
@@ -70,14 +64,11 @@ public class ValidateProjectStepTest {
   @Rule
   public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule()
     .setAnalysisDate(new Date(DEFAULT_ANALYSIS_TIME))
-    .setIncrementalAnalysis(false)
     .setBranch(DEFAULT_BRANCH);
 
-  public ValidateIncremental validateIncremental = mock(ValidateIncremental.class);
-
   DbClient dbClient = dbTester.getDbClient();
 
-  ValidateProjectStep underTest = new ValidateProjectStep(dbClient, reportReader, treeRootHolder, analysisMetadataHolder, validateIncremental);
+  ValidateProjectStep underTest = new ValidateProjectStep(dbClient, reportReader, treeRootHolder, analysisMetadataHolder);
 
   @Test
   public void fail_if_root_component_is_not_a_project_in_db() {
@@ -272,71 +263,4 @@ public class ValidateProjectStepTest {
     underTest.execute();
   }
 
-  @Test
-  public void fail_if_incremental_plugin_not_found() {
-    ValidateProjectStep underTest = new ValidateProjectStep(dbClient, reportReader, treeRootHolder, analysisMetadataHolder, null);
-
-    when(validateIncremental.execute()).thenReturn(false);
-    analysisMetadataHolder.setBaseAnalysis(new Analysis.Builder().setId(1).setUuid("base").setCreatedAt(DEFAULT_ANALYSIS_TIME).build());
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(1)
-      .setType(ComponentType.PROJECT)
-      .setKey(PROJECT_KEY)
-      .addChildRef(2)
-      .build());
-
-    treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build());
-
-    thrown.expect(MessageException.class);
-    thrown.expectMessage("Validation of project failed:");
-    thrown.expectMessage("Can't process an incremental analysis of the project \"PROJECT_KEY\" because the incremental plugin is not loaded");
-
-    underTest.execute();
-  }
-
-  @Test
-  public void fail_if_incremental_validation_fails() {
-    when(validateIncremental.execute()).thenReturn(false);
-    analysisMetadataHolder.setBaseAnalysis(new Analysis.Builder().setId(1).setUuid("base").setCreatedAt(DEFAULT_ANALYSIS_TIME).build());
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(1)
-      .setType(ComponentType.PROJECT)
-      .setKey(PROJECT_KEY)
-      .addChildRef(2)
-      .build());
-
-    treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build());
-
-    thrown.expect(MessageException.class);
-    thrown.expectMessage("Validation of project failed:");
-    thrown.expectMessage("The installation of the incremental plugin is invalid");
-
-    underTest.execute();
-  }
-
-  @Test
-  public void fail_if_incremental_and_first_analysis() {
-    when(validateIncremental.execute()).thenReturn(true);
-    analysisMetadataHolder.setBaseAnalysis(null);
-    analysisMetadataHolder.setIncrementalAnalysis(true);
-
-    reportReader.putComponent(ScannerReport.Component.newBuilder()
-      .setRef(1)
-      .setType(ComponentType.PROJECT)
-      .setKey(PROJECT_KEY)
-      .addChildRef(2)
-      .build());
-
-    treeRootHolder.setRoot(ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build());
-
-    thrown.expect(MessageException.class);
-    thrown.expectMessage("Validation of project failed:");
-    thrown.expectMessage("hasn't been analysed before and the first analysis can't be incremental. Please launch a full analysis of the project.");
-
-    underTest.execute();
-  }
-}
\ No newline at end of file
+}
index 2dd1432bfc4d17ddedf6f9095de6d684883e09e3..4063610440e45ae0dd8e07b0d8f179755c95073f 100644 (file)
@@ -56,8 +56,7 @@ public class PluginLoader {
    * Defines the base keys (defined by {@link #basePluginKey(PluginInfo, Map)}) of the plugins which are allowed to
    * run a full server extensions.
    */
-  private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = unmodifiableSet(new HashSet<>(
-    asList("billing", "branch", "developer", "governance", "incremental", "license")));
+  private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = unmodifiableSet(new HashSet<>(asList("billing", "branch", "developer", "governance", "license")));
 
   public static final Version COMPATIBILITY_MODE_MAX_VERSION = Version.create("5.2");
 
index e6547b0856df619d33bdd89d931d4f8b3179039f..266a3b5476ae8bbc7437912713ec8cb706a68926 100644 (file)
@@ -37,9 +37,4 @@ public interface AnalysisMode {
 
   boolean isPublish();
 
-  /**
-   * When incremental analysis is enabled (means not all files of a project are analyzed)
-   * @since 6.6
-   */
-  boolean isIncremental();
 }
index f3f45311cf78257c385b0dafd08da0a5a007afec..0c3290d03b653ca4826bba32bbe24119d13b673e 100644 (file)
@@ -23,7 +23,6 @@ import org.sonar.api.batch.AnalysisMode;
 
 public class MockAnalysisMode implements AnalysisMode {
   private boolean previewOrIssue = false;
-  private boolean incremental = false;
 
   @Override
   public boolean isPreview() {
@@ -43,13 +42,4 @@ public class MockAnalysisMode implements AnalysisMode {
   public boolean isPublish() {
     return !previewOrIssue;
   }
-
-  @Override
-  public boolean isIncremental() {
-    return incremental;
-  }
-
-  public void setIncremental(boolean incremental) {
-    this.incremental = incremental;
-  }
 }
index 77fd14c63517c361076e0b90c05c417910a49f05..68612147d9d50e196d1e03321c3dd407946069b5 100644 (file)
 package org.sonar.scanner.analysis;
 
 import java.util.Map;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.Immutable;
 import org.sonar.api.batch.AnalysisMode;
-import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.MessageException;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.repository.ProjectRepositories;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 @Immutable
 public class DefaultAnalysisMode implements AnalysisMode {
   private static final Logger LOG = Loggers.get(DefaultAnalysisMode.class);
   private static final String KEY_SCAN_ALL = "sonar.scanAllFiles";
-  private static final String KEY_INCREMENTAL = "sonar.incremental";
 
   private final Map<String, String> analysisProps;
   private final GlobalAnalysisMode analysisMode;
   private final BranchConfiguration branchConfig;
-  private final ProjectRepositories projectRepos;
-  private final IncrementalScannerHandler incrementalScannerHandler;
 
   private boolean scanAllFiles;
-  private boolean incremental;
 
-  public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, GlobalAnalysisMode analysisMode, ProjectRepositories projectRepos) {
-    this(props, branchConfig, analysisMode, projectRepos, null);
-  }
-
-  public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig,
-    GlobalAnalysisMode analysisMode, ProjectRepositories projectRepos, @Nullable IncrementalScannerHandler incrementalScannerHandler) {
+  public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, GlobalAnalysisMode analysisMode) {
     this.branchConfig = branchConfig;
     this.analysisMode = analysisMode;
-    this.projectRepos = projectRepos;
-    this.incrementalScannerHandler = incrementalScannerHandler;
     this.analysisProps = props.properties();
     load();
     printFlags();
   }
 
-  @Override
-  public boolean isIncremental() {
-    return incremental;
-  }
-
   public boolean scanAllFiles() {
     return scanAllFiles;
   }
 
   private void printFlags() {
-    if (incremental) {
-      LOG.info("Incremental mode");
-    }
     if (!scanAllFiles) {
       LOG.info("Scanning only changed files");
     }
@@ -81,36 +58,7 @@ public class DefaultAnalysisMode implements AnalysisMode {
 
   private void load() {
     String scanAllStr = analysisProps.get(KEY_SCAN_ALL);
-    incremental = incremental();
-    scanAllFiles = !incremental && !branchConfig.isShortLivingBranch() && (!analysisMode.isIssues() || "true".equals(scanAllStr));
-  }
-
-  private boolean incremental() {
-    String inc = analysisProps.get(KEY_INCREMENTAL);
-    if ("true".equals(inc)) {
-      if (incrementalScannerHandler == null || !incrementalScannerHandler.execute()) {
-        throw MessageException.of("Incremental mode is not available. Please contact your administrator.");
-      }
-
-      if (!analysisMode.isPublish()) {
-        throw MessageException.of("Incremental analysis is only available in publish mode");
-      }
-
-      if (branchConfig.branchName() != null) {
-        LOG.warn("Incremental analysis mode has been activated but it's not compatible with branches so a full analysis will be done.");
-        return false;
-      }
-
-      if (!projectRepos.exists() || projectRepos.lastAnalysisDate() == null) {
-        LOG.warn("Incremental analysis mode has been activated but the project was never analyzed before so a full analysis is about to be done.");
-        return false;
-      }
-
-      LOG.debug("Reference analysis is {}", DateUtils.formatDateTime(projectRepos.lastAnalysisDate()));
-      return true;
-    }
-
-    return false;
+    scanAllFiles = !branchConfig.isShortLivingBranch() && (!analysisMode.isIssues() || "true".equals(scanAllStr));
   }
 
   @Override
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.java
deleted file mode 100644 (file)
index f657598..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.scanner.analysis;
-
-public interface IncrementalScannerHandler {
-  boolean execute();
-}
index 18390ef6a89131fc1ed098963b9a4cb5cbdc6a4a..c66213ffbd3558f92fc46bebaad07e7c581e0a8e 100644 (file)
@@ -26,7 +26,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputModule;
 import org.sonar.api.batch.fs.internal.InputModuleHierarchy;
 import org.sonar.api.config.Configuration;
 import org.sonar.scanner.ProjectAnalysisInfo;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.bootstrap.ScannerPlugin;
 import org.sonar.scanner.bootstrap.ScannerPluginRepository;
 import org.sonar.scanner.cpd.CpdSettings;
@@ -46,18 +45,16 @@ public class MetadataPublisher implements ReportPublisherStep {
   private final ProjectAnalysisInfo projectAnalysisInfo;
   private final InputModuleHierarchy moduleHierarchy;
   private final CpdSettings cpdSettings;
-  private final DefaultAnalysisMode mode;
   private final ScannerPluginRepository pluginRepository;
   private final BranchConfiguration branchConfiguration;
 
   public MetadataPublisher(ProjectAnalysisInfo projectAnalysisInfo, InputModuleHierarchy moduleHierarchy, Configuration settings,
-    ModuleQProfiles qProfiles, CpdSettings cpdSettings, DefaultAnalysisMode mode, ScannerPluginRepository pluginRepository, BranchConfiguration branchConfiguration) {
+    ModuleQProfiles qProfiles, CpdSettings cpdSettings, ScannerPluginRepository pluginRepository, BranchConfiguration branchConfiguration) {
     this.projectAnalysisInfo = projectAnalysisInfo;
     this.moduleHierarchy = moduleHierarchy;
     this.settings = settings;
     this.qProfiles = qProfiles;
     this.cpdSettings = cpdSettings;
-    this.mode = mode;
     this.pluginRepository = pluginRepository;
     this.branchConfiguration = branchConfiguration;
   }
@@ -71,8 +68,7 @@ public class MetadataPublisher implements ReportPublisherStep {
       // Here we want key without branch
       .setProjectKey(rootDef.getKey())
       .setCrossProjectDuplicationActivated(cpdSettings.isCrossProjectDuplicationEnabled())
-      .setRootComponentRef(rootProject.batchId())
-      .setIncremental(mode.isIncremental());
+      .setRootComponentRef(rootProject.batchId());
 
     settings.get(ORGANIZATION).ifPresent(builder::setOrganizationKey);
 
index 1504f3e06dc1718f060393a0db1e7bc6e54d3773..c9b3b9518985b0b93dda4eb8f98790884b13aa36 100644 (file)
@@ -44,7 +44,6 @@ import org.sonar.api.utils.TempFolder;
 import org.sonar.api.utils.ZipUtils;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.Loggers;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
 import org.sonar.scanner.bootstrap.ScannerWsClient;
 import org.sonar.scanner.protocol.output.ScannerReportWriter;
@@ -78,18 +77,16 @@ public class ReportPublisher implements Startable {
   private final ReportPublisherStep[] publishers;
   private final Server server;
   private final BranchConfiguration branchConfiguration;
-  private final DefaultAnalysisMode analysisFlags;
 
   private Path reportDir;
   private ScannerReportWriter writer;
 
-  public ReportPublisher(Configuration settings, ScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher, DefaultAnalysisMode analysisFlags,
+  public ReportPublisher(Configuration settings, ScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher,
     InputModuleHierarchy moduleHierarchy, GlobalAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers, BranchConfiguration branchConfiguration) {
     this.settings = settings;
     this.wsClient = wsClient;
     this.server = server;
     this.contextPublisher = contextPublisher;
-    this.analysisFlags = analysisFlags;
     this.moduleHierarchy = moduleHierarchy;
     this.analysisMode = analysisMode;
     this.temp = temp;
@@ -181,10 +178,6 @@ public class ReportPublisher implements Startable {
       .setParam("projectBranch", moduleHierarchy.root().getBranch())
       .setPart("report", filePart);
 
-    if (analysisFlags.isIncremental()) {
-      post.setParam(CHARACTERISTIC, "incremental=true");
-    }
-
     String branchName = branchConfiguration.branchName();
     if (branchName != null) {
       post.setParam(CHARACTERISTIC, "branch=" + branchName);
index 24d1b6a4bcaa13b18de0cca6616f2e56cd9e1d86..285a33e81cfb3609dde5d7ab6c5da53a81a33ec7 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
 import org.sonar.api.batch.bootstrap.ProjectReactor;
 import org.sonar.api.utils.MessageException;
 import org.sonar.core.component.ComponentKeys;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchParamsValidator;
 import org.sonar.scanner.scan.branch.DefaultBranchParamsValidator;
 
@@ -40,16 +39,14 @@ import org.sonar.scanner.scan.branch.DefaultBranchParamsValidator;
 public class ProjectReactorValidator {
   private final AnalysisMode mode;
   private final BranchParamsValidator branchParamsValidator;
-  private final DefaultAnalysisMode analysisFlags;
 
-  public ProjectReactorValidator(AnalysisMode mode, DefaultAnalysisMode analysisFlags, BranchParamsValidator branchParamsValidator) {
+  public ProjectReactorValidator(AnalysisMode mode, BranchParamsValidator branchParamsValidator) {
     this.mode = mode;
-    this.analysisFlags = analysisFlags;
     this.branchParamsValidator = branchParamsValidator;
   }
 
-  public ProjectReactorValidator(AnalysisMode mode, DefaultAnalysisMode analysisFlags) {
-    this(mode, analysisFlags, new DefaultBranchParamsValidator());
+  public ProjectReactorValidator(AnalysisMode mode) {
+    this(mode, new DefaultBranchParamsValidator());
   }
 
   public void validate(ProjectReactor reactor) {
@@ -65,7 +62,7 @@ public class ProjectReactorValidator {
 
     String deprecatedBranchName = reactor.getRoot().getBranch();
 
-    branchParamsValidator.validate(validationMessages, deprecatedBranchName, analysisFlags.isIncremental());
+    branchParamsValidator.validate(validationMessages, deprecatedBranchName);
     validateBranch(validationMessages, deprecatedBranchName);
 
     if (!validationMessages.isEmpty()) {
index 99bc2b6a2874ce1d364cdf3bbf0017b3f7000036..bfb8731129cb9c629ea2d8db8cc27fb73dcec309 100644 (file)
@@ -27,5 +27,5 @@ import org.sonar.api.batch.ScannerSide;
 @ScannerSide
 @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
 public interface BranchParamsValidator {
-  void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode);
+  void validate(List<String> validationMessages, @Nullable String deprecatedBranchName);
 }
index 09db0edb0f6ceb88548691518c59a40ff23ee8d8..c24fe72be564c7865c462032a9203a1ad1487a8a 100644 (file)
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
 
 public class DefaultBranchParamsValidator implements BranchParamsValidator {
   @Override
-  public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode) {
+  public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName) {
     // no-op
   }
 }
index 9e5d573351d62d64e3b6ffb5bd70c133c4ff7dce..47b3da27aaf78f60bf33ff826bb08c6118876069 100644 (file)
@@ -43,7 +43,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile;
 import org.sonar.api.batch.fs.internal.DefaultInputModule;
 import org.sonar.api.batch.fs.internal.FileExtensionPredicate;
 import org.sonar.api.scan.filesystem.PathResolver;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 /**
@@ -65,12 +64,10 @@ public class InputComponentStore {
   private final SetMultimap<String, InputFile> filesByNameCache = LinkedHashMultimap.create();
   private final SetMultimap<String, InputFile> filesByExtensionCache = LinkedHashMultimap.create();
   private final InputModule root;
-  private final DefaultAnalysisMode analysisFlags;
   private final BranchConfiguration branchConfiguration;
 
-  public InputComponentStore(DefaultInputModule root, DefaultAnalysisMode analysisFlags, BranchConfiguration branchConfiguration) {
+  public InputComponentStore(DefaultInputModule root, BranchConfiguration branchConfiguration) {
     this.root = root;
-    this.analysisFlags = analysisFlags;
     this.branchConfiguration = branchConfiguration;
     this.put(root);
   }
@@ -83,7 +80,7 @@ public class InputComponentStore {
     return inputFileCache.values().stream()
       .map(f -> (DefaultInputFile) f)
       .filter(DefaultInputFile::isPublished)
-      .filter(f -> (!analysisFlags.isIncremental() && !branchConfiguration.isShortLivingBranch()) || f.status() != Status.SAME)::iterator;
+      .filter(f -> (!branchConfiguration.isShortLivingBranch()) || f.status() != Status.SAME)::iterator;
   }
 
   public Iterable<InputFile> allFiles() {
index 79ad929d9a91b7426faddf7e7ae99d974c7d5159..61ff26c3e27a4631219151a71afe73d2a7198ca1 100644 (file)
@@ -21,15 +21,14 @@ package org.sonar.scanner.scan.filesystem;
 
 import org.picocontainer.injectors.ProviderAdapter;
 import org.sonar.api.batch.fs.internal.InputModuleHierarchy;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 public class InputComponentStoreProvider extends ProviderAdapter {
   private InputComponentStore store;
 
-  public InputComponentStore provide(InputModuleHierarchy hierarchy, DefaultAnalysisMode analysisFlags, BranchConfiguration branchConfiguration) {
+  public InputComponentStore provide(InputModuleHierarchy hierarchy, BranchConfiguration branchConfiguration) {
     if (store == null) {
-      store = new InputComponentStore(hierarchy.root(), analysisFlags, branchConfiguration);
+      store = new InputComponentStore(hierarchy.root(), branchConfiguration);
     }
     return store;
   }
index c989f6ef533552a76afe882404f096ce12c62419..63ec17e46407477822cbfb44d38df9c1660791f9 100644 (file)
@@ -37,9 +37,6 @@ import org.sonar.api.batch.sensor.coverage.NewCoverage;
 import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure;
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.api.utils.KeyValueFormat;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.measure.MeasureCache;
 
 import static org.sonar.core.util.stream.MoreCollectors.toSet;
@@ -47,14 +44,10 @@ import static org.sonar.core.util.stream.MoreCollectors.toSet;
 @Phase(name = Phase.Name.POST)
 public final class ZeroCoverageSensor implements Sensor {
 
-  private static final Logger LOG = Loggers.get(ZeroCoverageSensor.class);
-
   private final MeasureCache measureCache;
-  private final DefaultAnalysisMode analysisFlags;
 
-  public ZeroCoverageSensor(MeasureCache measureCache, DefaultAnalysisMode analysisFlags) {
+  public ZeroCoverageSensor(MeasureCache measureCache) {
     this.measureCache = measureCache;
-    this.analysisFlags = analysisFlags;
   }
 
   @Override
@@ -65,10 +58,6 @@ public final class ZeroCoverageSensor implements Sensor {
 
   @Override
   public void execute(final SensorContext context) {
-    if (analysisFlags.isIncremental()) {
-      LOG.debug("Incremental mode: not forcing coverage to zero");
-      return;
-    }
     FileSystem fs = context.fileSystem();
     for (InputFile f : fs.inputFiles(fs.predicates().hasType(Type.MAIN))) {
       if (((DefaultInputFile) f).isExcludedForCoverage()) {
index 44ce642e99b1e574569f0e9750a1085f29b50e90..9e896ecdc5668c779ec53a44215850cdb4136cc0 100644 (file)
 package org.sonar.scanner.analysis;
 
 import java.util.Collections;
-import java.util.Date;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.sonar.api.utils.MessageException;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
-import org.sonar.scanner.repository.ProjectRepositories;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -36,16 +33,12 @@ import static org.mockito.Mockito.when;
 
 public class DefaultAnalysisModeTest {
   private BranchConfiguration branchConfig;
-  private ProjectRepositories projectRepos;
   private GlobalAnalysisMode globalMode;
-  private IncrementalScannerHandler incrementalScannerHandler;
 
   @Before
   public void setUp() {
     branchConfig = mock(BranchConfiguration.class);
-    projectRepos = mock(ProjectRepositories.class);
     globalMode = mock(GlobalAnalysisMode.class);
-    incrementalScannerHandler = mock(IncrementalScannerHandler.class);
   }
 
   @Rule
@@ -72,56 +65,6 @@ public class DefaultAnalysisModeTest {
     assertThat(mode.isPreview()).isTrue();
   }
 
-  @Test
-  public void incremental_not_found() {
-    AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true"));
-    thrown.expect(MessageException.class);
-    thrown.expectMessage("Incremental mode is not available. Please contact your administrator.");
-    createmode(analysisProps);
-  }
-
-  @Test
-  public void no_incremental_if_not_publish() {
-    when(incrementalScannerHandler.execute()).thenReturn(true);
-    AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true"));
-    thrown.expect(MessageException.class);
-    thrown.expectMessage("Incremental analysis is only available in publish mode");
-    createmode(analysisProps);
-  }
-
-  @Test
-  public void no_incremental_mode_if_branches() {
-    when(globalMode.isPublish()).thenReturn(true);
-    when(incrementalScannerHandler.execute()).thenReturn(true);
-    when(branchConfig.branchName()).thenReturn("branch1");
-    AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true"));
-    DefaultAnalysisMode analysisMode = createmode(analysisProps);
-    assertThat(analysisMode.isIncremental()).isFalse();
-    assertThat(analysisMode.scanAllFiles()).isTrue();
-  }
-
-  @Test
-  public void no_incremental_mode_if_no_previous_analysis() {
-    when(incrementalScannerHandler.execute()).thenReturn(true);
-    when(globalMode.isPublish()).thenReturn(true);
-    AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true"));
-    DefaultAnalysisMode analysisMode = createmode(analysisProps);
-    assertThat(analysisMode.isIncremental()).isFalse();
-    assertThat(analysisMode.scanAllFiles()).isTrue();
-  }
-
-  @Test
-  public void incremental_mode() {
-    when(incrementalScannerHandler.execute()).thenReturn(true);
-    when(globalMode.isPublish()).thenReturn(true);
-    when(projectRepos.lastAnalysisDate()).thenReturn(new Date());
-    when(projectRepos.exists()).thenReturn(true);
-    AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true"));
-    DefaultAnalysisMode analysisMode = createmode(analysisProps);
-    assertThat(analysisMode.isIncremental()).isTrue();
-    assertThat(analysisMode.scanAllFiles()).isFalse();
-  }
-
   @Test
   public void scan_all_if_publish() {
     when(globalMode.isIssues()).thenReturn(false);
@@ -147,7 +90,7 @@ public class DefaultAnalysisModeTest {
   }
 
   private DefaultAnalysisMode createmode(AnalysisProperties analysisProps) {
-    return new DefaultAnalysisMode(analysisProps, branchConfig, globalMode, projectRepos, incrementalScannerHandler);
+    return new DefaultAnalysisMode(analysisProps, branchConfig, globalMode);
   }
 
 }
index 2ef29f1d751df2d681d796d1f98580c8fa4d7b9c..d6263481e06b5ddec610dfded248d3016f536ca9 100644 (file)
@@ -41,7 +41,6 @@ import org.sonar.duplications.block.Block;
 import org.sonar.duplications.block.ByteArray;
 import org.sonar.duplications.index.CloneGroup;
 import org.sonar.duplications.index.ClonePart;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.cpd.index.SonarCpdBlockIndex;
 import org.sonar.scanner.protocol.output.ScannerReport.Duplicate;
 import org.sonar.scanner.protocol.output.ScannerReport.Duplication;
@@ -90,7 +89,7 @@ public class CpdExecutorTest {
 
     index = new SonarCpdBlockIndex(publisher, settings);
     DefaultInputModule inputModule = TestInputFileBuilder.newDefaultInputModule("foo", baseDir);
-    componentStore = new InputComponentStore(inputModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    componentStore = new InputComponentStore(inputModule, mock(BranchConfiguration.class));
     executor = new CpdExecutor(settings, index, publisher, componentStore, branchConfig);
     reader = new ScannerReportReader(outputDir);
 
index 1bbd510f6e7e7be472e3a12d5a5dfe9975cc33d0..5db8289e4b239533135a93687cad6dfe8b0654b4 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
 import org.sonar.api.batch.postjob.issue.PostJobIssue;
 import org.sonar.api.batch.rule.Severity;
 import org.sonar.api.config.internal.MapSettings;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.issue.IssueCache;
 import org.sonar.scanner.issue.tracking.TrackedIssue;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
@@ -56,7 +55,7 @@ public class DefaultPostJobContextTest {
   public void setUp() throws IOException {
     issueCache = mock(IssueCache.class);
     DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule("foo", temp.newFolder());
-    componentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
     settings = new MapSettings();
     analysisMode = mock(AnalysisMode.class);
     context = new DefaultPostJobContext(settings.asConfig(), settings, issueCache, componentStore, analysisMode);
index b517367c309b4daac061e9cfc5ed5e446c3cc233..cb173b3adca373a21b705b26d08b3d135ae86961 100644 (file)
@@ -31,7 +31,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
 import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure;
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.core.util.CloseableIterator;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.protocol.output.ScannerReport.LineCoverage;
 import org.sonar.scanner.protocol.output.ScannerReportReader;
 import org.sonar.scanner.protocol.output.ScannerReportWriter;
@@ -59,7 +58,7 @@ public class CoveragePublisherTest {
     String moduleKey = "foo";
     inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setLines(5).build();
     DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder());
-    InputComponentStore componentCache = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    InputComponentStore componentCache = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
     componentCache.put(inputFile);
 
     measureCache = mock(MeasureCache.class);
index b42567c73cc55c67cb4820efc87c0eb39438085f..0f61d0c28602c0b22731f275e8463b1f16078338 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
 import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure;
 import org.sonar.api.measures.CoreMetrics;
 import org.sonar.core.util.CloseableIterator;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.deprecated.test.TestPlanBuilder;
 import org.sonar.scanner.protocol.output.ScannerReport;
 import org.sonar.scanner.protocol.output.ScannerReportReader;
@@ -70,7 +69,7 @@ public class MeasuresPublisherTest {
     String moduleKey = "foo";
     inputModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder());
     inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setPublish(true).build();
-    InputComponentStore componentCache = new InputComponentStore(inputModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    InputComponentStore componentCache = new InputComponentStore(inputModule, mock(BranchConfiguration.class));
     componentCache.put(inputFile);
     measureCache = mock(MeasureCache.class);
     when(measureCache.byComponentKey(anyString())).thenReturn(Collections.<DefaultMeasure<?>>emptyList());
index f00269ac4b145a4bdbd2017bafc0f584f7303935..ce68ecc39a4855992b0a7ff91bc3379ab460a126 100644 (file)
@@ -88,7 +88,7 @@ public class MetadataPublisherTest {
     when(inputModuleHierarchy.root()).thenReturn(rootModule);
     analysisMode = mock(DefaultAnalysisMode.class);
     branches = mock(BranchConfiguration.class);
-    underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings.asConfig(), qProfiles, cpdSettings, analysisMode,
+    underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings.asConfig(), qProfiles, cpdSettings,
       pluginRepository, branches);
   }
 
@@ -110,7 +110,6 @@ public class MetadataPublisherTest {
     assertThat(metadata.getAnalysisDate()).isEqualTo(1234567L);
     assertThat(metadata.getProjectKey()).isEqualTo("foo");
     assertThat(metadata.getProjectKey()).isEqualTo("foo");
-    assertThat(metadata.getIncremental()).isFalse();
     assertThat(metadata.getQprofilesPerLanguage()).containsOnly(entry("java", org.sonar.scanner.protocol.output.ScannerReport.Metadata.QProfile.newBuilder()
       .setKey("q1")
       .setName("Q1")
index e3bccbd64ff31a7d079ae822e0769e855702019d..7309c43975c9a4a0850f1783ade9ad1ef360e469 100644 (file)
@@ -44,7 +44,6 @@ import org.sonar.api.utils.log.LogTester;
 import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.core.config.CorePropertyDefinitions;
 import org.sonar.core.config.ScannerProperties;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.bootstrap.GlobalAnalysisMode;
 import org.sonar.scanner.bootstrap.ScannerWsClient;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
@@ -73,7 +72,6 @@ public class ReportPublisherTest {
   @Rule
   public ExpectedException exception = ExpectedException.none();
 
-  DefaultAnalysisMode analysisFlags = mock(DefaultAnalysisMode.class);
   GlobalAnalysisMode mode = mock(GlobalAnalysisMode.class);
   MapSettings settings = new MapSettings(new PropertyDefinitions(CorePropertyDefinitions.all()));
   ScannerWsClient wsClient;
@@ -94,7 +92,7 @@ public class ReportPublisherTest {
 
   @Test
   public void log_and_dump_information_about_report_uploading() throws IOException {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode,
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode,
       mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration);
     settings.setProperty(ScannerProperties.ORGANIZATION, "MyOrg");
 
@@ -118,7 +116,7 @@ public class ReportPublisherTest {
 
   @Test
   public void parse_upload_error_message() throws IOException {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode,
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode,
       mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration);
     HttpException ex = new HttpException("url", 404, "{\"errors\":[{\"msg\":\"Organization with key 'MyOrg' does not exist\"}]}");
     WsResponse response = mock(WsResponse.class);
@@ -133,7 +131,7 @@ public class ReportPublisherTest {
   @Test
   public void log_public_url_if_defined() throws IOException {
     when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube");
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     underTest.logSuccess("TASK-123");
@@ -155,7 +153,7 @@ public class ReportPublisherTest {
   @Test
   public void fail_if_public_url_malformed() throws IOException {
     when(server.getPublicRootUrl()).thenReturn("invalid");
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     exception.expect(MessageException.class);
@@ -165,7 +163,7 @@ public class ReportPublisherTest {
 
   @Test
   public void log_but_not_dump_information_when_report_is_not_uploaded() {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     underTest.logSuccess(/* report not uploaded, no server task */null);
@@ -183,7 +181,7 @@ public class ReportPublisherTest {
     settings.setProperty("sonar.scanner.keepReport", true);
     Path reportDir = temp.getRoot().toPath().resolve("scanner-report");
     Files.createDirectory(reportDir);
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     underTest.start();
@@ -195,7 +193,7 @@ public class ReportPublisherTest {
   public void should_delete_report_by_default() throws IOException {
     Path reportDir = temp.getRoot().toPath().resolve("scanner-report");
     Files.createDirectory(reportDir);
-    ReportPublisher job = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher job = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0],
       branchConfiguration);
 
@@ -206,7 +204,7 @@ public class ReportPublisherTest {
 
   @Test
   public void test_ws_parameters() throws Exception {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     settings.setProperty(ScannerProperties.ORGANIZATION, "MyOrg");
@@ -233,42 +231,9 @@ public class ReportPublisherTest {
       entry("projectKey", "struts"));
   }
 
-  @Test
-  public void test_send_incremental_characteristic() throws Exception {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
-      new ReportPublisherStep[0], branchConfiguration);
-
-    when(analysisFlags.isIncremental()).thenReturn(true);
-    String orgName = "MyOrg";
-    settings.setProperty(ScannerProperties.ORGANIZATION, orgName);
-
-    WsResponse response = mock(WsResponse.class);
-
-    PipedOutputStream out = new PipedOutputStream();
-    PipedInputStream in = new PipedInputStream(out);
-    WsCe.SubmitResponse.newBuilder().build().writeTo(out);
-    out.close();
-
-    when(response.failIfNotSuccessful()).thenReturn(response);
-    when(response.contentStream()).thenReturn(in);
-
-    when(wsClient.call(any(WsRequest.class))).thenReturn(response);
-    underTest.upload(temp.newFile());
-
-    ArgumentCaptor<WsRequest> capture = ArgumentCaptor.forClass(WsRequest.class);
-    verify(wsClient).call(capture.capture());
-
-    WsRequest wsRequest = capture.getValue();
-    assertThat(wsRequest.getParameters().getKeys()).hasSize(3);
-    assertThat(wsRequest.getParameters().getValues("organization")).containsExactly(orgName);
-    assertThat(wsRequest.getParameters().getValues("projectKey")).containsExactly("struts");
-    assertThat(wsRequest.getParameters().getValues("characteristic"))
-      .containsExactly("incremental=true");
-  }
-
   @Test
   public void test_send_branches_characteristics() throws Exception {
-    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class),
+    ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class),
       new ReportPublisherStep[0], branchConfiguration);
 
     String orgName = "MyOrg";
index a343584a9114b848c9a2d0ba693dc0ba79c9a135..8af57e2de8f2b8ec5b6231b3bffc6e7435c3fdbb 100644 (file)
@@ -27,18 +27,15 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.sonar.api.batch.fs.InputFile.Status;
 import org.sonar.api.batch.fs.internal.DefaultInputFile;
 import org.sonar.api.batch.fs.internal.DefaultInputModule;
 import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.protocol.output.ScannerReportWriter;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 import org.sonar.scanner.scan.filesystem.InputComponentStore;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 public class SourcePublisherTest {
 
@@ -48,7 +45,6 @@ public class SourcePublisherTest {
   private File sourceFile;
   private ScannerReportWriter writer;
   private DefaultInputFile inputFile;
-  private DefaultAnalysisMode analysisFlags;
 
   @Before
   public void prepare() throws IOException {
@@ -62,8 +58,7 @@ public class SourcePublisherTest {
       .build();
 
     DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, baseDir);
-    analysisFlags = mock(DefaultAnalysisMode.class);
-    InputComponentStore componentStore = new InputComponentStore(rootModule, analysisFlags, mock(BranchConfiguration.class));
+    InputComponentStore componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
     componentStore.put(inputFile);
 
     publisher = new SourcePublisher(componentStore);
@@ -122,27 +117,4 @@ public class SourcePublisherTest {
     assertThat(FileUtils.readFileToString(out, StandardCharsets.UTF_8)).isEqualTo("\n2\n3\n4\n5");
   }
 
-  @Test
-  public void publishChangedSourceInIncrementalMode() throws Exception {
-    when(analysisFlags.isIncremental()).thenReturn(true);
-    FileUtils.write(sourceFile, "1\n2\n3\n4\n5", StandardCharsets.ISO_8859_1);
-    inputFile.setStatus(Status.CHANGED);
-
-    publisher.publish(writer);
-
-    File out = writer.getSourceFile(inputFile.batchId());
-    assertThat(FileUtils.readFileToString(out, StandardCharsets.UTF_8)).isEqualTo("1\n2\n3\n4\n5");
-  }
-
-  @Test
-  public void dontPublishUnchangedSourceInIncrementalMode() throws Exception {
-    when(analysisFlags.isIncremental()).thenReturn(true);
-    FileUtils.write(sourceFile, "foo", StandardCharsets.ISO_8859_1);
-    inputFile.setStatus(Status.SAME);
-
-    publisher.publish(writer);
-
-    File out = writer.getSourceFile(inputFile.batchId());
-    assertThat(out).doesNotExist();
-  }
 }
index fbaca69eecadb7fcd2bb67d6d8b5d3c88de991cb..22059abf19629688deab41aba4dce5ebf2803242 100644 (file)
@@ -24,7 +24,6 @@ import org.junit.Test;
 import org.sonar.api.batch.bootstrap.ProjectDefinition;
 import org.sonar.api.batch.fs.InputModule;
 import org.sonar.api.batch.fs.internal.DefaultInputModule;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 import org.sonar.scanner.scan.filesystem.InputComponentStore;
 
@@ -39,7 +38,7 @@ public class ModuleIndexerTest {
   private InputComponentStore componentStore;
 
   public void createIndexer(DefaultInputModule rootModule) {
-    componentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
     tree = new DefaultComponentTree();
     moduleHierarchy = mock(DefaultInputModuleHierarchy.class);
     indexer = new ModuleIndexer(tree, componentStore, moduleHierarchy);
index 5c88bd4406a8be9ed065fb9a6d25da5fa2601798..1cb2a037206d6420560e0f9a323f8c5cbe75b941 100644 (file)
@@ -28,7 +28,6 @@ import org.sonar.api.batch.AnalysisMode;
 import org.sonar.api.batch.bootstrap.ProjectDefinition;
 import org.sonar.api.batch.bootstrap.ProjectReactor;
 import org.sonar.api.utils.MessageException;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -39,14 +38,12 @@ public class ProjectReactorValidatorTest {
   public ExpectedException thrown = ExpectedException.none();
 
   private AnalysisMode mode;
-  private DefaultAnalysisMode analysisFlags;
   private ProjectReactorValidator validator;
 
   @Before
   public void prepare() {
     mode = mock(AnalysisMode.class);
-    analysisFlags = mock(DefaultAnalysisMode.class);
-    validator = new ProjectReactorValidator(mode, analysisFlags);
+    validator = new ProjectReactorValidator(mode);
   }
 
   @Test
index 9d96bd65dfb53ddc69c41b1fddf46880e8acb673..8a0dd49347b1c0f30e53c6560e071fda56b2e73e 100644 (file)
@@ -35,7 +35,6 @@ import org.sonar.api.batch.fs.InputPath;
 import org.sonar.api.batch.fs.internal.DefaultInputFile;
 import org.sonar.api.batch.fs.internal.DefaultInputModule;
 import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -60,7 +59,7 @@ public class InputComponentStoreTest {
     DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(rootDef);
     DefaultInputModule subModule = TestInputFileBuilder.newDefaultInputModule(moduleDef);
 
-    InputComponentStore cache = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    InputComponentStore cache = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
     cache.put(subModule);
 
     DefaultInputFile fooFile = new TestInputFileBuilder(rootModuleKey, "src/main/java/Foo.java")
@@ -104,7 +103,7 @@ public class InputComponentStoreTest {
 
   static class InputComponentStoreTester extends InputComponentStore {
     InputComponentStoreTester() throws IOException {
-      super(TestInputFileBuilder.newDefaultInputModule("root", temp.newFolder()), mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+      super(TestInputFileBuilder.newDefaultInputModule("root", temp.newFolder()), mock(BranchConfiguration.class));
     }
 
     InputFile addFile(String moduleKey, String relpath, String language) {
index a50f8de957233b392a95883948a5bd1d1c22a0a4..51c36adc739354354fcbbbf8e5df38af53737619 100644 (file)
@@ -29,7 +29,6 @@ import org.sonar.api.batch.fs.InputModule;
 import org.sonar.api.batch.fs.internal.DefaultInputModule;
 import org.sonar.api.batch.fs.internal.SensorStrategy;
 import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.scan.branch.BranchConfiguration;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -49,7 +48,7 @@ public class ModuleInputComponentStoreTest {
   @Before
   public void setUp() throws IOException {
     DefaultInputModule root = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder());
-    componentStore = new InputComponentStore(root, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    componentStore = new InputComponentStore(root, mock(BranchConfiguration.class));
   }
 
   @Test
index 1819252ae3c4c7f9ce10b89fe98b7e5828d44d2b..cf93a19c2f4e047743d5709636181f32ee3cf818 100644 (file)
@@ -45,7 +45,6 @@ import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.issue.Issue;
 import org.sonar.api.platform.Server;
 import org.sonar.api.rule.RuleKey;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
 import org.sonar.scanner.issue.IssueCache;
 import org.sonar.scanner.issue.tracking.TrackedIssue;
 import org.sonar.scanner.scan.DefaultComponentTree;
@@ -84,7 +83,7 @@ public class JSONReportTest {
     DefaultComponentTree inputComponentTree = new DefaultComponentTree();
     ProjectDefinition def = ProjectDefinition.create().setBaseDir(projectBaseDir).setWorkDir(temp.newFolder()).setKey("struts");
     DefaultInputModule rootModule = new DefaultInputModule(def, 1);
-    InputComponentStore inputComponentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class));
+    InputComponentStore inputComponentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class));
 
     DefaultInputModule moduleA = new DefaultInputModule(ProjectDefinition.create().setKey("struts-core").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder()));
     inputComponentTree.index(moduleA, rootModule);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java
deleted file mode 100644 (file)
index ab3295a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.scanner.source;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
-import org.sonar.scanner.analysis.DefaultAnalysisMode;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class ZeroCoverageSensorTest {
-
-  @Rule
-  public LogTester logTester = new LogTester();
-
-  @Test
-  public void dontForceCoverageInIncrementalMode() {
-    DefaultAnalysisMode analysisFlags = mock(DefaultAnalysisMode.class);
-    when(analysisFlags.isIncremental()).thenReturn(true);
-    ZeroCoverageSensor zeroCoverageSensor = new ZeroCoverageSensor(null, analysisFlags);
-    zeroCoverageSensor.execute(null);
-    assertThat(logTester.logs(LoggerLevel.DEBUG)).contains("Incremental mode: not forcing coverage to zero");
-  }
-
-}
index 732f121609d224062fedf34e8c3ec95fdf5f00f0..5662ed6cfb282bbdb3c731145799df4eac3f497a 100644 (file)
@@ -39,10 +39,9 @@ message Metadata {
   bool cross_project_duplication_activated = 6;
   map<string, QProfile> qprofiles_per_language = 7;
   map<string, Plugin> plugins_by_key = 8;
-  bool incremental = 9;
-  string branch_name = 10;
-  BranchType branch_type = 11;
-  string merge_branch_name = 12;
+  string branch_name = 9;
+  BranchType branch_type = 10;
+  string merge_branch_name = 11;
 
   message QProfile {
     string key = 1;
@@ -118,7 +117,6 @@ message Component {
          FILE = 4;
        }
        
-       // For incremental mode
        enum FileStatus {
          UNAVAILABLE = 0;
          SAME = 1;
index 87ec36a7fcf634974ba83f7481b817d6db655696..aa183b7932596408d99d8771399620e03717f816 100644 (file)
@@ -89,9 +89,8 @@ message Task {
   optional string scannerContext = 18;
   optional bool hasScannerContext = 19;
   optional string organization = 20;
-  optional bool incremental = 21;
-  optional string branch = 22;
-  optional sonarqube.ws.commons.BranchType branchType = 23;
+  optional string branch = 21;
+  optional sonarqube.ws.commons.BranchType branchType = 22;
 }
 
 enum TaskStatus {