aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-09-25 16:33:31 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-09-27 14:50:52 +0200
commite7868aa03dc555ac4839d0a7c96c7708deb6d6de (patch)
tree392a2b901ebbabbdec5723b9707173d8ae758ccb /server
parent489725dae8e137b669d596a9c9a53e86e6eee2ac (diff)
downloadsonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.tar.gz
sonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.zip
SONAR-9575 Revert all changes made to support incremental mode
Diffstat (limited to 'server')
-rw-r--r--server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl3
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java1
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java10
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml9
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java8
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml1
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml1
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml3
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml3
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml3
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml3
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java45
-rw-r--r--server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java4
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java58
-rw-r--r--server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java6
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java13
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java15
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/duplication/IncrementalDuplicationMeasures.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java42
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/measure/IncrementalMeasureTransition.java27
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStep.java50
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java30
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java7
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java28
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java44
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/ValidateIncremental.java24
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/package-info.java23
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java75
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java51
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java23
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java32
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java46
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java14
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java11
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java45
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java20
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStepTest.java58
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java57
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java32
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java78
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java5
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java82
62 files changed, 98 insertions, 1151 deletions
diff --git a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
index ec2b6a3ac79..760b11ce89d 100644
--- a/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
+++ b/server/sonar-db-core/src/main/resources/org/sonar/db/version/schema-h2.ddl
@@ -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");
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
index 7a60a07f986..9d757ceb077 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
@@ -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";
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java
index e2bb957ea7f..e326b4da511 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDto.java
@@ -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
*/
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml
index b838cf23afe..8060e105448 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml
@@ -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">
@@ -181,8 +180,7 @@
version,
period1_mode,
period1_param,
- period1_date,
- incremental)
+ period1_date)
values (
#{uuid, jdbcType=VARCHAR},
#{componentUuid, jdbcType=VARCHAR},
@@ -194,8 +192,7 @@
#{version, jdbcType=VARCHAR},
#{periodMode, jdbcType=VARCHAR},
#{periodParam, jdbcType=VARCHAR},
- #{periodDate, jdbcType=BIGINT},
- #{incremental, jdbcType=BOOLEAN})
+ #{periodDate, jdbcType=BIGINT})
</insert>
</mapper>
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
index 291143024b4..46c5bb93ab1 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java
@@ -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) {
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java
index 04ad4267454..4b8dd3e26af 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDtoTest.java
@@ -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());
}
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml
index ef080fd3f64..6cb45a58538 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis-result.xml
@@ -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]"
/>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml
index 15104619310..d086021a151 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldPurgeAnalysis.xml
@@ -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"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml
index 00ee6f678a8..287f41e23de 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components-result.xml
@@ -149,7 +149,6 @@ What has been changed :
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
<!-- Open issue on file -->
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml
index 4e7905239df..40c2ae8f4f7 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/close_issues_clean_index_and_files_sources_of_specified_components.xml
@@ -138,7 +138,6 @@
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
<!-- Open issue on file -->
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml
index dd294d38bf2..e5c679bf4c5 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml
@@ -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>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml
index 3f493acd7eb..9acb701f9e9 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml
@@ -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 -->
@@ -101,7 +99,6 @@
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml
index d5393b6756a..878595a3c80 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses-result.xml
@@ -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>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml
index 9d351499f2a..d4cdd256532 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAnalyses.xml
@@ -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>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml
index e32aeb548d0..3e6532b606a 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml
@@ -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>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml
index eef613afa84..c6f8da44917 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml
@@ -139,7 +139,6 @@
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
<!-- snapshots to be purged -->
@@ -167,7 +166,6 @@
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml
index 0ce2b40b57e..5de7ce994c7 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml
@@ -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 -->
@@ -123,7 +121,6 @@
created_at="1228222680000"
build_date="1228222680000"
version="[null]"
- incremental="[false]"
/>
</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml
index 69fb0fd3418..4590dc6260b 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml
@@ -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 -->
@@ -122,7 +120,6 @@
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
index 960626c0ccf..00000000000
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTable.java
+++ /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());
- }
-
-}
diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
index e50531e123e..3bfe2ec422f 100644
--- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
+++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66.java
@@ -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
index 0519ba270b7..00000000000
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/AddIncrementalColumnToSnapshotsTableTest.java
+++ /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);
- }
-
-}
diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java
index 74fa9c04b6d..76a9365740c 100644
--- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java
+++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v66/DbVersion66Test.java
@@ -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);
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
index 598a574e6fa..e54d06826cf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java
@@ -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");
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java
index 71301984c9b..0f109ec370a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java
@@ -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);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java
index 1b5dd39b597..8fbcdc69a6c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java
@@ -19,13 +19,10 @@
*/
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");
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java
index 40b7b408928..9e809380ce7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java
@@ -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);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
index 606c361218e..1e8bf7ee9cd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java
@@ -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))
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
index 8334cc14b0e..e8dffaad582 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolder.java
@@ -56,11 +56,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.
*
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
index 5a6b5dd74b2..654755b0454 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImpl.java
@@ -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<>();
@@ -98,19 +96,6 @@ public class AnalysisMetadataHolderImpl implements MutableAnalysisMetadataHolder
}
@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");
this.baseProjectSnapshot.setProperty(baseAnalysis);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
index de4cc6ee2c8..4b5477caf8c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolder.java
@@ -41,11 +41,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
*/
MutableAnalysisMetadataHolder setBaseAnalysis(@Nullable Analysis baseAnalysis);
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
index c6e825ba602..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/duplication/IncrementalDuplicationMeasures.java
+++ /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();
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java
index 3a282e0663c..557de8de602 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitor.java
@@ -19,37 +19,27 @@
*/
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();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java
index 8bfc6fe06d5..af327cf7090 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueLifecycle.java
@@ -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
index e05410b1d9c..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/measure/IncrementalMeasureTransition.java
+++ /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 {
-
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java
index 5a66cd4a66a..44528910052 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStep.java
@@ -19,12 +19,8 @@
*/
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
index 78f7c16fa69..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStep.java
+++ /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";
- }
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
index 5c7c70a58f1..82702754de6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStep.java
@@ -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) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
index e5f5f6bf33b..1010269638c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java
@@ -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.
*/
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java
index df884f39c5c..ef8e57dc3a2 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java
@@ -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)
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java
index 8d57e9bf5cd..f0be9ded75d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStep.java
@@ -19,18 +19,14 @@
*/
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
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java
index 79a8aeec726..b0219d2b094 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStep.java
@@ -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());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java
index 975422d8b26..8c150408609 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputationSteps.java
@@ -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,
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java
index 77417850dad..62cf283c8ec 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStep.java
@@ -19,17 +19,12 @@
*/
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
index ea022e82067..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/ValidateIncremental.java
+++ /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
index ad6b743f16a..00000000000
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/validation/package-info.java
+++ /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;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
index 85297de65b2..856ef29b1d6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java
@@ -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
@@ -344,78 +341,6 @@ public class ActivityActionTest {
}
@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();
ComponentDto project = db.components().insertMainBranch();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
index aabe69a6f3b..cf75d3afc54 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java
@@ -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
@@ -163,44 +161,6 @@ public class ComponentActionTest {
}
@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();
userSession.addProjectPermission(UserRole.USER, project);
@@ -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
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java
index 4f08695fa3a..2e92ee646ef 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java
@@ -19,20 +19,10 @@
*/
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
diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
index b2f66b0eff1..14d998d9231 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java
@@ -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
@@ -126,37 +125,6 @@ public class TaskActionTest {
}
@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();
ComponentDto project = db.components().insertMainBranch();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
index d27897d7523..998087518f3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderImplTest.java
@@ -215,52 +215,6 @@ public class AnalysisMetadataHolderImplTest {
}
@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();
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
index 8f310b30331..01b243ad582 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/AnalysisMetadataHolderRule.java
@@ -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<>();
@@ -205,18 +203,6 @@ public class AnalysisMetadataHolderRule extends ExternalResource implements Muta
}
@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();
return property != null && property.getType() == BranchType.SHORT;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
index 32d7cdbe5c9..4d6a7124f6a 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/analysis/MutableAnalysisMetadataHolderRule.java
@@ -155,17 +155,6 @@ public class MutableAnalysisMetadataHolderRule extends ExternalResource implemen
}
@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();
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
index 31039ddee50..2ad15bd7093 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IntegrateIssuesVisitorTest.java
@@ -19,17 +19,8 @@
*/
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
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
index dc1c6b98f56..22b950770fb 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoDbLoaderTest.java
@@ -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;
@@ -77,25 +76,9 @@ 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");
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java
index 380c64ecbf9..b572835270e 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/DuplicationMeasuresStepTest.java
@@ -19,49 +19,31 @@
*/
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
index 2afefb61595..00000000000
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/IncrementalMeasureTransitionStepTest.java
+++ /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();
- }
-
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java
index 98b4a8a0f03..cc3ddb7b382 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadDuplicationsFromReportStepTest.java
@@ -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)));
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
index 49b273283a8..ba8bf417e1e 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStepTest.java
@@ -122,30 +122,6 @@ public class LoadReportAnalysisMetadataHolderStepTest {
}
@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(
newBatchReportBuilder()
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
index bbb35da5f17..5eb3e51d4a3 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistCrossProjectDuplicationIndexStepTest.java
@@ -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,40 +93,10 @@ 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);
reportReader.putDuplicationBlocks(FILE_1_REF, singletonList(CPD_TEXT_BLOCK));
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java
index 33437bf9b65..83dddc8cf40 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistFileSourcesStepTest.java
@@ -19,13 +19,7 @@
*/
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
@@ -129,15 +124,6 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
}
@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(
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
index a892fc57f9d..40fbf42f133 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
@@ -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);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java
index e4ae60c52f0..1c175d0d7d1 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ValidateProjectStepTest.java
@@ -19,11 +19,7 @@
*/
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
+}