diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-25 16:33:31 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2017-09-27 14:50:52 +0200 |
commit | e7868aa03dc555ac4839d0a7c96c7708deb6d6de (patch) | |
tree | 392a2b901ebbabbdec5723b9707173d8ae758ccb | |
parent | 489725dae8e137b669d596a9c9a53e86e6eee2ac (diff) | |
download | sonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.tar.gz sonarqube-e7868aa03dc555ac4839d0a7c96c7708deb6d6de.zip |
SONAR-9575 Revert all changes made to support incremental mode
91 files changed, 142 insertions, 1497 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 +} diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java index 2dd1432bfc4..4063610440e 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java @@ -56,8 +56,7 @@ public class PluginLoader { * Defines the base keys (defined by {@link #basePluginKey(PluginInfo, Map)}) of the plugins which are allowed to * run a full server extensions. */ - private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = unmodifiableSet(new HashSet<>( - asList("billing", "branch", "developer", "governance", "incremental", "license"))); + private static final Set<String> PRIVILEGED_PLUGINS_BASE_KEYS = unmodifiableSet(new HashSet<>(asList("billing", "branch", "developer", "governance", "license"))); public static final Version COMPATIBILITY_MODE_MAX_VERSION = Version.create("5.2"); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java index e6547b0856d..266a3b5476a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/AnalysisMode.java @@ -37,9 +37,4 @@ public interface AnalysisMode { boolean isPublish(); - /** - * When incremental analysis is enabled (means not all files of a project are analyzed) - * @since 6.6 - */ - boolean isIncremental(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/MockAnalysisMode.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/MockAnalysisMode.java index f3f45311cf7..0c3290d03b6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/MockAnalysisMode.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/MockAnalysisMode.java @@ -23,7 +23,6 @@ import org.sonar.api.batch.AnalysisMode; public class MockAnalysisMode implements AnalysisMode { private boolean previewOrIssue = false; - private boolean incremental = false; @Override public boolean isPreview() { @@ -43,13 +42,4 @@ public class MockAnalysisMode implements AnalysisMode { public boolean isPublish() { return !previewOrIssue; } - - @Override - public boolean isIncremental() { - return incremental; - } - - public void setIncremental(boolean incremental) { - this.incremental = incremental; - } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java index 77fd14c6351..68612147d9d 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/DefaultAnalysisMode.java @@ -20,60 +20,37 @@ package org.sonar.scanner.analysis; import java.util.Map; -import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import org.sonar.api.batch.AnalysisMode; -import org.sonar.api.utils.DateUtils; -import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; -import org.sonar.scanner.repository.ProjectRepositories; import org.sonar.scanner.scan.branch.BranchConfiguration; @Immutable public class DefaultAnalysisMode implements AnalysisMode { private static final Logger LOG = Loggers.get(DefaultAnalysisMode.class); private static final String KEY_SCAN_ALL = "sonar.scanAllFiles"; - private static final String KEY_INCREMENTAL = "sonar.incremental"; private final Map<String, String> analysisProps; private final GlobalAnalysisMode analysisMode; private final BranchConfiguration branchConfig; - private final ProjectRepositories projectRepos; - private final IncrementalScannerHandler incrementalScannerHandler; private boolean scanAllFiles; - private boolean incremental; - public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, GlobalAnalysisMode analysisMode, ProjectRepositories projectRepos) { - this(props, branchConfig, analysisMode, projectRepos, null); - } - - public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, - GlobalAnalysisMode analysisMode, ProjectRepositories projectRepos, @Nullable IncrementalScannerHandler incrementalScannerHandler) { + public DefaultAnalysisMode(AnalysisProperties props, BranchConfiguration branchConfig, GlobalAnalysisMode analysisMode) { this.branchConfig = branchConfig; this.analysisMode = analysisMode; - this.projectRepos = projectRepos; - this.incrementalScannerHandler = incrementalScannerHandler; this.analysisProps = props.properties(); load(); printFlags(); } - @Override - public boolean isIncremental() { - return incremental; - } - public boolean scanAllFiles() { return scanAllFiles; } private void printFlags() { - if (incremental) { - LOG.info("Incremental mode"); - } if (!scanAllFiles) { LOG.info("Scanning only changed files"); } @@ -81,36 +58,7 @@ public class DefaultAnalysisMode implements AnalysisMode { private void load() { String scanAllStr = analysisProps.get(KEY_SCAN_ALL); - incremental = incremental(); - scanAllFiles = !incremental && !branchConfig.isShortLivingBranch() && (!analysisMode.isIssues() || "true".equals(scanAllStr)); - } - - private boolean incremental() { - String inc = analysisProps.get(KEY_INCREMENTAL); - if ("true".equals(inc)) { - if (incrementalScannerHandler == null || !incrementalScannerHandler.execute()) { - throw MessageException.of("Incremental mode is not available. Please contact your administrator."); - } - - if (!analysisMode.isPublish()) { - throw MessageException.of("Incremental analysis is only available in publish mode"); - } - - if (branchConfig.branchName() != null) { - LOG.warn("Incremental analysis mode has been activated but it's not compatible with branches so a full analysis will be done."); - return false; - } - - if (!projectRepos.exists() || projectRepos.lastAnalysisDate() == null) { - LOG.warn("Incremental analysis mode has been activated but the project was never analyzed before so a full analysis is about to be done."); - return false; - } - - LOG.debug("Reference analysis is {}", DateUtils.formatDateTime(projectRepos.lastAnalysisDate())); - return true; - } - - return false; + scanAllFiles = !branchConfig.isShortLivingBranch() && (!analysisMode.isIssues() || "true".equals(scanAllStr)); } @Override diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.java deleted file mode 100644 index f657598b26a..00000000000 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/analysis/IncrementalScannerHandler.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.scanner.analysis; - -public interface IncrementalScannerHandler { - boolean execute(); -} diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java index 18390ef6a89..c66213ffbd3 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java @@ -26,7 +26,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.InputModuleHierarchy; import org.sonar.api.config.Configuration; import org.sonar.scanner.ProjectAnalysisInfo; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.bootstrap.ScannerPlugin; import org.sonar.scanner.bootstrap.ScannerPluginRepository; import org.sonar.scanner.cpd.CpdSettings; @@ -46,18 +45,16 @@ public class MetadataPublisher implements ReportPublisherStep { private final ProjectAnalysisInfo projectAnalysisInfo; private final InputModuleHierarchy moduleHierarchy; private final CpdSettings cpdSettings; - private final DefaultAnalysisMode mode; private final ScannerPluginRepository pluginRepository; private final BranchConfiguration branchConfiguration; public MetadataPublisher(ProjectAnalysisInfo projectAnalysisInfo, InputModuleHierarchy moduleHierarchy, Configuration settings, - ModuleQProfiles qProfiles, CpdSettings cpdSettings, DefaultAnalysisMode mode, ScannerPluginRepository pluginRepository, BranchConfiguration branchConfiguration) { + ModuleQProfiles qProfiles, CpdSettings cpdSettings, ScannerPluginRepository pluginRepository, BranchConfiguration branchConfiguration) { this.projectAnalysisInfo = projectAnalysisInfo; this.moduleHierarchy = moduleHierarchy; this.settings = settings; this.qProfiles = qProfiles; this.cpdSettings = cpdSettings; - this.mode = mode; this.pluginRepository = pluginRepository; this.branchConfiguration = branchConfiguration; } @@ -71,8 +68,7 @@ public class MetadataPublisher implements ReportPublisherStep { // Here we want key without branch .setProjectKey(rootDef.getKey()) .setCrossProjectDuplicationActivated(cpdSettings.isCrossProjectDuplicationEnabled()) - .setRootComponentRef(rootProject.batchId()) - .setIncremental(mode.isIncremental()); + .setRootComponentRef(rootProject.batchId()); settings.get(ORGANIZATION).ifPresent(builder::setOrganizationKey); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java index 1504f3e06dc..c9b3b951898 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ReportPublisher.java @@ -44,7 +44,6 @@ import org.sonar.api.utils.TempFolder; import org.sonar.api.utils.ZipUtils; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.protocol.output.ScannerReportWriter; @@ -78,18 +77,16 @@ public class ReportPublisher implements Startable { private final ReportPublisherStep[] publishers; private final Server server; private final BranchConfiguration branchConfiguration; - private final DefaultAnalysisMode analysisFlags; private Path reportDir; private ScannerReportWriter writer; - public ReportPublisher(Configuration settings, ScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher, DefaultAnalysisMode analysisFlags, + public ReportPublisher(Configuration settings, ScannerWsClient wsClient, Server server, AnalysisContextReportPublisher contextPublisher, InputModuleHierarchy moduleHierarchy, GlobalAnalysisMode analysisMode, TempFolder temp, ReportPublisherStep[] publishers, BranchConfiguration branchConfiguration) { this.settings = settings; this.wsClient = wsClient; this.server = server; this.contextPublisher = contextPublisher; - this.analysisFlags = analysisFlags; this.moduleHierarchy = moduleHierarchy; this.analysisMode = analysisMode; this.temp = temp; @@ -181,10 +178,6 @@ public class ReportPublisher implements Startable { .setParam("projectBranch", moduleHierarchy.root().getBranch()) .setPart("report", filePart); - if (analysisFlags.isIncremental()) { - post.setParam(CHARACTERISTIC, "incremental=true"); - } - String branchName = branchConfiguration.branchName(); if (branchName != null) { post.setParam(CHARACTERISTIC, "branch=" + branchName); diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java index 24d1b6a4bca..285a33e81cf 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java @@ -29,7 +29,6 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.utils.MessageException; import org.sonar.core.component.ComponentKeys; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchParamsValidator; import org.sonar.scanner.scan.branch.DefaultBranchParamsValidator; @@ -40,16 +39,14 @@ import org.sonar.scanner.scan.branch.DefaultBranchParamsValidator; public class ProjectReactorValidator { private final AnalysisMode mode; private final BranchParamsValidator branchParamsValidator; - private final DefaultAnalysisMode analysisFlags; - public ProjectReactorValidator(AnalysisMode mode, DefaultAnalysisMode analysisFlags, BranchParamsValidator branchParamsValidator) { + public ProjectReactorValidator(AnalysisMode mode, BranchParamsValidator branchParamsValidator) { this.mode = mode; - this.analysisFlags = analysisFlags; this.branchParamsValidator = branchParamsValidator; } - public ProjectReactorValidator(AnalysisMode mode, DefaultAnalysisMode analysisFlags) { - this(mode, analysisFlags, new DefaultBranchParamsValidator()); + public ProjectReactorValidator(AnalysisMode mode) { + this(mode, new DefaultBranchParamsValidator()); } public void validate(ProjectReactor reactor) { @@ -65,7 +62,7 @@ public class ProjectReactorValidator { String deprecatedBranchName = reactor.getRoot().getBranch(); - branchParamsValidator.validate(validationMessages, deprecatedBranchName, analysisFlags.isIncremental()); + branchParamsValidator.validate(validationMessages, deprecatedBranchName); validateBranch(validationMessages, deprecatedBranchName); if (!validationMessages.isEmpty()) { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java index 99bc2b6a287..bfb8731129c 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/BranchParamsValidator.java @@ -27,5 +27,5 @@ import org.sonar.api.batch.ScannerSide; @ScannerSide @InstantiationStrategy(InstantiationStrategy.PER_BATCH) public interface BranchParamsValidator { - void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode); + void validate(List<String> validationMessages, @Nullable String deprecatedBranchName); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchParamsValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchParamsValidator.java index 09db0edb0f6..c24fe72be56 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchParamsValidator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/DefaultBranchParamsValidator.java @@ -24,7 +24,7 @@ import javax.annotation.Nullable; public class DefaultBranchParamsValidator implements BranchParamsValidator { @Override - public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode) { + public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName) { // no-op } } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java index 9e5d573351d..47b3da27aaf 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStore.java @@ -43,7 +43,6 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.FileExtensionPredicate; import org.sonar.api.scan.filesystem.PathResolver; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchConfiguration; /** @@ -65,12 +64,10 @@ public class InputComponentStore { private final SetMultimap<String, InputFile> filesByNameCache = LinkedHashMultimap.create(); private final SetMultimap<String, InputFile> filesByExtensionCache = LinkedHashMultimap.create(); private final InputModule root; - private final DefaultAnalysisMode analysisFlags; private final BranchConfiguration branchConfiguration; - public InputComponentStore(DefaultInputModule root, DefaultAnalysisMode analysisFlags, BranchConfiguration branchConfiguration) { + public InputComponentStore(DefaultInputModule root, BranchConfiguration branchConfiguration) { this.root = root; - this.analysisFlags = analysisFlags; this.branchConfiguration = branchConfiguration; this.put(root); } @@ -83,7 +80,7 @@ public class InputComponentStore { return inputFileCache.values().stream() .map(f -> (DefaultInputFile) f) .filter(DefaultInputFile::isPublished) - .filter(f -> (!analysisFlags.isIncremental() && !branchConfiguration.isShortLivingBranch()) || f.status() != Status.SAME)::iterator; + .filter(f -> (!branchConfiguration.isShortLivingBranch()) || f.status() != Status.SAME)::iterator; } public Iterable<InputFile> allFiles() { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStoreProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStoreProvider.java index 79ad929d9a9..61ff26c3e27 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStoreProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/InputComponentStoreProvider.java @@ -21,15 +21,14 @@ package org.sonar.scanner.scan.filesystem; import org.picocontainer.injectors.ProviderAdapter; import org.sonar.api.batch.fs.internal.InputModuleHierarchy; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchConfiguration; public class InputComponentStoreProvider extends ProviderAdapter { private InputComponentStore store; - public InputComponentStore provide(InputModuleHierarchy hierarchy, DefaultAnalysisMode analysisFlags, BranchConfiguration branchConfiguration) { + public InputComponentStore provide(InputModuleHierarchy hierarchy, BranchConfiguration branchConfiguration) { if (store == null) { - store = new InputComponentStore(hierarchy.root(), analysisFlags, branchConfiguration); + store = new InputComponentStore(hierarchy.root(), branchConfiguration); } return store; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java index c989f6ef533..63ec17e4640 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java @@ -37,9 +37,6 @@ import org.sonar.api.batch.sensor.coverage.NewCoverage; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.utils.KeyValueFormat; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.measure.MeasureCache; import static org.sonar.core.util.stream.MoreCollectors.toSet; @@ -47,14 +44,10 @@ import static org.sonar.core.util.stream.MoreCollectors.toSet; @Phase(name = Phase.Name.POST) public final class ZeroCoverageSensor implements Sensor { - private static final Logger LOG = Loggers.get(ZeroCoverageSensor.class); - private final MeasureCache measureCache; - private final DefaultAnalysisMode analysisFlags; - public ZeroCoverageSensor(MeasureCache measureCache, DefaultAnalysisMode analysisFlags) { + public ZeroCoverageSensor(MeasureCache measureCache) { this.measureCache = measureCache; - this.analysisFlags = analysisFlags; } @Override @@ -65,10 +58,6 @@ public final class ZeroCoverageSensor implements Sensor { @Override public void execute(final SensorContext context) { - if (analysisFlags.isIncremental()) { - LOG.debug("Incremental mode: not forcing coverage to zero"); - return; - } FileSystem fs = context.fileSystem(); for (InputFile f : fs.inputFiles(fs.predicates().hasType(Type.MAIN))) { if (((DefaultInputFile) f).isExcludedForCoverage()) { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java index 44ce642e99b..9e896ecdc56 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/analysis/DefaultAnalysisModeTest.java @@ -20,14 +20,11 @@ package org.sonar.scanner.analysis; import java.util.Collections; -import java.util.Date; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonar.api.utils.MessageException; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; -import org.sonar.scanner.repository.ProjectRepositories; import org.sonar.scanner.scan.branch.BranchConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -36,16 +33,12 @@ import static org.mockito.Mockito.when; public class DefaultAnalysisModeTest { private BranchConfiguration branchConfig; - private ProjectRepositories projectRepos; private GlobalAnalysisMode globalMode; - private IncrementalScannerHandler incrementalScannerHandler; @Before public void setUp() { branchConfig = mock(BranchConfiguration.class); - projectRepos = mock(ProjectRepositories.class); globalMode = mock(GlobalAnalysisMode.class); - incrementalScannerHandler = mock(IncrementalScannerHandler.class); } @Rule @@ -73,56 +66,6 @@ public class DefaultAnalysisModeTest { } @Test - public void incremental_not_found() { - AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true")); - thrown.expect(MessageException.class); - thrown.expectMessage("Incremental mode is not available. Please contact your administrator."); - createmode(analysisProps); - } - - @Test - public void no_incremental_if_not_publish() { - when(incrementalScannerHandler.execute()).thenReturn(true); - AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true")); - thrown.expect(MessageException.class); - thrown.expectMessage("Incremental analysis is only available in publish mode"); - createmode(analysisProps); - } - - @Test - public void no_incremental_mode_if_branches() { - when(globalMode.isPublish()).thenReturn(true); - when(incrementalScannerHandler.execute()).thenReturn(true); - when(branchConfig.branchName()).thenReturn("branch1"); - AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true")); - DefaultAnalysisMode analysisMode = createmode(analysisProps); - assertThat(analysisMode.isIncremental()).isFalse(); - assertThat(analysisMode.scanAllFiles()).isTrue(); - } - - @Test - public void no_incremental_mode_if_no_previous_analysis() { - when(incrementalScannerHandler.execute()).thenReturn(true); - when(globalMode.isPublish()).thenReturn(true); - AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true")); - DefaultAnalysisMode analysisMode = createmode(analysisProps); - assertThat(analysisMode.isIncremental()).isFalse(); - assertThat(analysisMode.scanAllFiles()).isTrue(); - } - - @Test - public void incremental_mode() { - when(incrementalScannerHandler.execute()).thenReturn(true); - when(globalMode.isPublish()).thenReturn(true); - when(projectRepos.lastAnalysisDate()).thenReturn(new Date()); - when(projectRepos.exists()).thenReturn(true); - AnalysisProperties analysisProps = new AnalysisProperties(Collections.singletonMap("sonar.incremental", "true")); - DefaultAnalysisMode analysisMode = createmode(analysisProps); - assertThat(analysisMode.isIncremental()).isTrue(); - assertThat(analysisMode.scanAllFiles()).isFalse(); - } - - @Test public void scan_all_if_publish() { when(globalMode.isIssues()).thenReturn(false); DefaultAnalysisMode mode = createmode(new AnalysisProperties(Collections.emptyMap())); @@ -147,7 +90,7 @@ public class DefaultAnalysisModeTest { } private DefaultAnalysisMode createmode(AnalysisProperties analysisProps) { - return new DefaultAnalysisMode(analysisProps, branchConfig, globalMode, projectRepos, incrementalScannerHandler); + return new DefaultAnalysisMode(analysisProps, branchConfig, globalMode); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java index 2ef29f1d751..d6263481e06 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/cpd/CpdExecutorTest.java @@ -41,7 +41,6 @@ import org.sonar.duplications.block.Block; import org.sonar.duplications.block.ByteArray; import org.sonar.duplications.index.CloneGroup; import org.sonar.duplications.index.ClonePart; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.cpd.index.SonarCpdBlockIndex; import org.sonar.scanner.protocol.output.ScannerReport.Duplicate; import org.sonar.scanner.protocol.output.ScannerReport.Duplication; @@ -90,7 +89,7 @@ public class CpdExecutorTest { index = new SonarCpdBlockIndex(publisher, settings); DefaultInputModule inputModule = TestInputFileBuilder.newDefaultInputModule("foo", baseDir); - componentStore = new InputComponentStore(inputModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + componentStore = new InputComponentStore(inputModule, mock(BranchConfiguration.class)); executor = new CpdExecutor(settings, index, publisher, componentStore, branchConfig); reader = new ScannerReportReader(outputDir); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java index 1bbd510f6e7..5db8289e4b2 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/postjob/DefaultPostJobContextTest.java @@ -31,7 +31,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.postjob.issue.PostJobIssue; import org.sonar.api.batch.rule.Severity; import org.sonar.api.config.internal.MapSettings; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.issue.IssueCache; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.scan.branch.BranchConfiguration; @@ -56,7 +55,7 @@ public class DefaultPostJobContextTest { public void setUp() throws IOException { issueCache = mock(IssueCache.class); DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule("foo", temp.newFolder()); - componentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); settings = new MapSettings(); analysisMode = mock(AnalysisMode.class); context = new DefaultPostJobContext(settings.asConfig(), settings, issueCache, componentStore, analysisMode); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/CoveragePublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/CoveragePublisherTest.java index b517367c309..cb173b3adca 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/CoveragePublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/CoveragePublisherTest.java @@ -31,7 +31,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.api.measures.CoreMetrics; import org.sonar.core.util.CloseableIterator; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.protocol.output.ScannerReport.LineCoverage; import org.sonar.scanner.protocol.output.ScannerReportReader; import org.sonar.scanner.protocol.output.ScannerReportWriter; @@ -59,7 +58,7 @@ public class CoveragePublisherTest { String moduleKey = "foo"; inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setLines(5).build(); DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder()); - InputComponentStore componentCache = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + InputComponentStore componentCache = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); componentCache.put(inputFile); measureCache = mock(MeasureCache.class); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MeasuresPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MeasuresPublisherTest.java index b42567c73cc..0f61d0c2860 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MeasuresPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MeasuresPublisherTest.java @@ -34,7 +34,6 @@ import org.sonar.api.batch.fs.internal.TestInputFileBuilder; import org.sonar.api.batch.sensor.measure.internal.DefaultMeasure; import org.sonar.api.measures.CoreMetrics; import org.sonar.core.util.CloseableIterator; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.deprecated.test.TestPlanBuilder; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.scanner.protocol.output.ScannerReportReader; @@ -70,7 +69,7 @@ public class MeasuresPublisherTest { String moduleKey = "foo"; inputModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder()); inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setPublish(true).build(); - InputComponentStore componentCache = new InputComponentStore(inputModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + InputComponentStore componentCache = new InputComponentStore(inputModule, mock(BranchConfiguration.class)); componentCache.put(inputFile); measureCache = mock(MeasureCache.class); when(measureCache.byComponentKey(anyString())).thenReturn(Collections.<DefaultMeasure<?>>emptyList()); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java index f00269ac4b1..ce68ecc39a4 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java @@ -88,7 +88,7 @@ public class MetadataPublisherTest { when(inputModuleHierarchy.root()).thenReturn(rootModule); analysisMode = mock(DefaultAnalysisMode.class); branches = mock(BranchConfiguration.class); - underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings.asConfig(), qProfiles, cpdSettings, analysisMode, + underTest = new MetadataPublisher(projectAnalysisInfo, inputModuleHierarchy, settings.asConfig(), qProfiles, cpdSettings, pluginRepository, branches); } @@ -110,7 +110,6 @@ public class MetadataPublisherTest { assertThat(metadata.getAnalysisDate()).isEqualTo(1234567L); assertThat(metadata.getProjectKey()).isEqualTo("foo"); assertThat(metadata.getProjectKey()).isEqualTo("foo"); - assertThat(metadata.getIncremental()).isFalse(); assertThat(metadata.getQprofilesPerLanguage()).containsOnly(entry("java", org.sonar.scanner.protocol.output.ScannerReport.Metadata.QProfile.newBuilder() .setKey("q1") .setName("Q1") diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java index e3bccbd64ff..7309c43975c 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/ReportPublisherTest.java @@ -44,7 +44,6 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.core.config.ScannerProperties; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.bootstrap.GlobalAnalysisMode; import org.sonar.scanner.bootstrap.ScannerWsClient; import org.sonar.scanner.scan.branch.BranchConfiguration; @@ -73,7 +72,6 @@ public class ReportPublisherTest { @Rule public ExpectedException exception = ExpectedException.none(); - DefaultAnalysisMode analysisFlags = mock(DefaultAnalysisMode.class); GlobalAnalysisMode mode = mock(GlobalAnalysisMode.class); MapSettings settings = new MapSettings(new PropertyDefinitions(CorePropertyDefinitions.all())); ScannerWsClient wsClient; @@ -94,7 +92,7 @@ public class ReportPublisherTest { @Test public void log_and_dump_information_about_report_uploading() throws IOException { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); settings.setProperty(ScannerProperties.ORGANIZATION, "MyOrg"); @@ -118,7 +116,7 @@ public class ReportPublisherTest { @Test public void parse_upload_error_message() throws IOException { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); HttpException ex = new HttpException("url", 404, "{\"errors\":[{\"msg\":\"Organization with key 'MyOrg' does not exist\"}]}"); WsResponse response = mock(WsResponse.class); @@ -133,7 +131,7 @@ public class ReportPublisherTest { @Test public void log_public_url_if_defined() throws IOException { when(server.getPublicRootUrl()).thenReturn("https://publicserver/sonarqube"); - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); underTest.logSuccess("TASK-123"); @@ -155,7 +153,7 @@ public class ReportPublisherTest { @Test public void fail_if_public_url_malformed() throws IOException { when(server.getPublicRootUrl()).thenReturn("invalid"); - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); exception.expect(MessageException.class); @@ -165,7 +163,7 @@ public class ReportPublisherTest { @Test public void log_but_not_dump_information_when_report_is_not_uploaded() { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); underTest.logSuccess(/* report not uploaded, no server task */null); @@ -183,7 +181,7 @@ public class ReportPublisherTest { settings.setProperty("sonar.scanner.keepReport", true); Path reportDir = temp.getRoot().toPath().resolve("scanner-report"); Files.createDirectory(reportDir); - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); underTest.start(); @@ -195,7 +193,7 @@ public class ReportPublisherTest { public void should_delete_report_by_default() throws IOException { Path reportDir = temp.getRoot().toPath().resolve("scanner-report"); Files.createDirectory(reportDir); - ReportPublisher job = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher job = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); @@ -206,7 +204,7 @@ public class ReportPublisherTest { @Test public void test_ws_parameters() throws Exception { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); settings.setProperty(ScannerProperties.ORGANIZATION, "MyOrg"); @@ -234,41 +232,8 @@ public class ReportPublisherTest { } @Test - public void test_send_incremental_characteristic() throws Exception { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), - new ReportPublisherStep[0], branchConfiguration); - - when(analysisFlags.isIncremental()).thenReturn(true); - String orgName = "MyOrg"; - settings.setProperty(ScannerProperties.ORGANIZATION, orgName); - - WsResponse response = mock(WsResponse.class); - - PipedOutputStream out = new PipedOutputStream(); - PipedInputStream in = new PipedInputStream(out); - WsCe.SubmitResponse.newBuilder().build().writeTo(out); - out.close(); - - when(response.failIfNotSuccessful()).thenReturn(response); - when(response.contentStream()).thenReturn(in); - - when(wsClient.call(any(WsRequest.class))).thenReturn(response); - underTest.upload(temp.newFile()); - - ArgumentCaptor<WsRequest> capture = ArgumentCaptor.forClass(WsRequest.class); - verify(wsClient).call(capture.capture()); - - WsRequest wsRequest = capture.getValue(); - assertThat(wsRequest.getParameters().getKeys()).hasSize(3); - assertThat(wsRequest.getParameters().getValues("organization")).containsExactly(orgName); - assertThat(wsRequest.getParameters().getValues("projectKey")).containsExactly("struts"); - assertThat(wsRequest.getParameters().getValues("characteristic")) - .containsExactly("incremental=true"); - } - - @Test public void test_send_branches_characteristics() throws Exception { - ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, analysisFlags, moduleHierarchy, mode, mock(TempFolder.class), + ReportPublisher underTest = new ReportPublisher(settings.asConfig(), wsClient, server, contextPublisher, moduleHierarchy, mode, mock(TempFolder.class), new ReportPublisherStep[0], branchConfiguration); String orgName = "MyOrg"; diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/SourcePublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/SourcePublisherTest.java index a343584a911..8af57e2de8f 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/SourcePublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/SourcePublisherTest.java @@ -27,18 +27,15 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.sonar.api.batch.fs.InputFile.Status; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.protocol.output.ScannerReportWriter; import org.sonar.scanner.scan.branch.BranchConfiguration; import org.sonar.scanner.scan.filesystem.InputComponentStore; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; public class SourcePublisherTest { @@ -48,7 +45,6 @@ public class SourcePublisherTest { private File sourceFile; private ScannerReportWriter writer; private DefaultInputFile inputFile; - private DefaultAnalysisMode analysisFlags; @Before public void prepare() throws IOException { @@ -62,8 +58,7 @@ public class SourcePublisherTest { .build(); DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, baseDir); - analysisFlags = mock(DefaultAnalysisMode.class); - InputComponentStore componentStore = new InputComponentStore(rootModule, analysisFlags, mock(BranchConfiguration.class)); + InputComponentStore componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); componentStore.put(inputFile); publisher = new SourcePublisher(componentStore); @@ -122,27 +117,4 @@ public class SourcePublisherTest { assertThat(FileUtils.readFileToString(out, StandardCharsets.UTF_8)).isEqualTo("\n2\n3\n4\n5"); } - @Test - public void publishChangedSourceInIncrementalMode() throws Exception { - when(analysisFlags.isIncremental()).thenReturn(true); - FileUtils.write(sourceFile, "1\n2\n3\n4\n5", StandardCharsets.ISO_8859_1); - inputFile.setStatus(Status.CHANGED); - - publisher.publish(writer); - - File out = writer.getSourceFile(inputFile.batchId()); - assertThat(FileUtils.readFileToString(out, StandardCharsets.UTF_8)).isEqualTo("1\n2\n3\n4\n5"); - } - - @Test - public void dontPublishUnchangedSourceInIncrementalMode() throws Exception { - when(analysisFlags.isIncremental()).thenReturn(true); - FileUtils.write(sourceFile, "foo", StandardCharsets.ISO_8859_1); - inputFile.setStatus(Status.SAME); - - publisher.publish(writer); - - File out = writer.getSourceFile(inputFile.batchId()); - assertThat(out).doesNotExist(); - } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleIndexerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleIndexerTest.java index fbaca69eeca..22059abf196 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleIndexerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ModuleIndexerTest.java @@ -24,7 +24,6 @@ import org.junit.Test; import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.fs.InputModule; import org.sonar.api.batch.fs.internal.DefaultInputModule; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchConfiguration; import org.sonar.scanner.scan.filesystem.InputComponentStore; @@ -39,7 +38,7 @@ public class ModuleIndexerTest { private InputComponentStore componentStore; public void createIndexer(DefaultInputModule rootModule) { - componentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + componentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); tree = new DefaultComponentTree(); moduleHierarchy = mock(DefaultInputModuleHierarchy.class); indexer = new ModuleIndexer(tree, componentStore, moduleHierarchy); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java index 5c88bd4406a..1cb2a037206 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java @@ -28,7 +28,6 @@ import org.sonar.api.batch.AnalysisMode; import org.sonar.api.batch.bootstrap.ProjectDefinition; import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.utils.MessageException; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -39,14 +38,12 @@ public class ProjectReactorValidatorTest { public ExpectedException thrown = ExpectedException.none(); private AnalysisMode mode; - private DefaultAnalysisMode analysisFlags; private ProjectReactorValidator validator; @Before public void prepare() { mode = mock(AnalysisMode.class); - analysisFlags = mock(DefaultAnalysisMode.class); - validator = new ProjectReactorValidator(mode, analysisFlags); + validator = new ProjectReactorValidator(mode); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java index 9d96bd65dfb..8a0dd49347b 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/InputComponentStoreTest.java @@ -35,7 +35,6 @@ import org.sonar.api.batch.fs.InputPath; import org.sonar.api.batch.fs.internal.DefaultInputFile; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -60,7 +59,7 @@ public class InputComponentStoreTest { DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(rootDef); DefaultInputModule subModule = TestInputFileBuilder.newDefaultInputModule(moduleDef); - InputComponentStore cache = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + InputComponentStore cache = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); cache.put(subModule); DefaultInputFile fooFile = new TestInputFileBuilder(rootModuleKey, "src/main/java/Foo.java") @@ -104,7 +103,7 @@ public class InputComponentStoreTest { static class InputComponentStoreTester extends InputComponentStore { InputComponentStoreTester() throws IOException { - super(TestInputFileBuilder.newDefaultInputModule("root", temp.newFolder()), mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + super(TestInputFileBuilder.newDefaultInputModule("root", temp.newFolder()), mock(BranchConfiguration.class)); } InputFile addFile(String moduleKey, String relpath, String language) { diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java index a50f8de9572..51c36adc739 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/ModuleInputComponentStoreTest.java @@ -29,7 +29,6 @@ import org.sonar.api.batch.fs.InputModule; import org.sonar.api.batch.fs.internal.DefaultInputModule; import org.sonar.api.batch.fs.internal.SensorStrategy; import org.sonar.api.batch.fs.internal.TestInputFileBuilder; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.scan.branch.BranchConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -49,7 +48,7 @@ public class ModuleInputComponentStoreTest { @Before public void setUp() throws IOException { DefaultInputModule root = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder()); - componentStore = new InputComponentStore(root, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + componentStore = new InputComponentStore(root, mock(BranchConfiguration.class)); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java index 1819252ae3c..cf93a19c2f4 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/report/JSONReportTest.java @@ -45,7 +45,6 @@ import org.sonar.api.config.internal.MapSettings; import org.sonar.api.issue.Issue; import org.sonar.api.platform.Server; import org.sonar.api.rule.RuleKey; -import org.sonar.scanner.analysis.DefaultAnalysisMode; import org.sonar.scanner.issue.IssueCache; import org.sonar.scanner.issue.tracking.TrackedIssue; import org.sonar.scanner.scan.DefaultComponentTree; @@ -84,7 +83,7 @@ public class JSONReportTest { DefaultComponentTree inputComponentTree = new DefaultComponentTree(); ProjectDefinition def = ProjectDefinition.create().setBaseDir(projectBaseDir).setWorkDir(temp.newFolder()).setKey("struts"); DefaultInputModule rootModule = new DefaultInputModule(def, 1); - InputComponentStore inputComponentStore = new InputComponentStore(rootModule, mock(DefaultAnalysisMode.class), mock(BranchConfiguration.class)); + InputComponentStore inputComponentStore = new InputComponentStore(rootModule, mock(BranchConfiguration.class)); DefaultInputModule moduleA = new DefaultInputModule(ProjectDefinition.create().setKey("struts-core").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder())); inputComponentTree.index(moduleA, rootModule); diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java deleted file mode 100644 index ab3295ac409..00000000000 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/source/ZeroCoverageSensorTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.scanner.source; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.api.utils.log.LogTester; -import org.sonar.api.utils.log.LoggerLevel; -import org.sonar.scanner.analysis.DefaultAnalysisMode; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ZeroCoverageSensorTest { - - @Rule - public LogTester logTester = new LogTester(); - - @Test - public void dontForceCoverageInIncrementalMode() { - DefaultAnalysisMode analysisFlags = mock(DefaultAnalysisMode.class); - when(analysisFlags.isIncremental()).thenReturn(true); - ZeroCoverageSensor zeroCoverageSensor = new ZeroCoverageSensor(null, analysisFlags); - zeroCoverageSensor.execute(null); - assertThat(logTester.logs(LoggerLevel.DEBUG)).contains("Incremental mode: not forcing coverage to zero"); - } - -} diff --git a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto index 732f121609d..5662ed6cfb2 100644 --- a/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto +++ b/sonar-scanner-protocol/src/main/protobuf/scanner_report.proto @@ -39,10 +39,9 @@ message Metadata { bool cross_project_duplication_activated = 6; map<string, QProfile> qprofiles_per_language = 7; map<string, Plugin> plugins_by_key = 8; - bool incremental = 9; - string branch_name = 10; - BranchType branch_type = 11; - string merge_branch_name = 12; + string branch_name = 9; + BranchType branch_type = 10; + string merge_branch_name = 11; message QProfile { string key = 1; @@ -118,7 +117,6 @@ message Component { FILE = 4; } - // For incremental mode enum FileStatus { UNAVAILABLE = 0; SAME = 1; diff --git a/sonar-ws/src/main/protobuf/ws-ce.proto b/sonar-ws/src/main/protobuf/ws-ce.proto index 87ec36a7fcf..aa183b79325 100644 --- a/sonar-ws/src/main/protobuf/ws-ce.proto +++ b/sonar-ws/src/main/protobuf/ws-ce.proto @@ -89,9 +89,8 @@ message Task { optional string scannerContext = 18; optional bool hasScannerContext = 19; optional string organization = 20; - optional bool incremental = 21; - optional string branch = 22; - optional sonarqube.ws.commons.BranchType branchType = 23; + optional string branch = 21; + optional sonarqube.ws.commons.BranchType branchType = 22; } enum TaskStatus { |