diff options
author | Eric Hartmann <hartmann.eric@gmail.com> | 2017-10-19 13:47:56 +0200 |
---|---|---|
committer | Eric Hartmann <hartmann.eric@gmail.Com> | 2017-10-20 12:26:58 +0200 |
commit | f3de142860a4ebcc91f9f80771964a105f8ed982 (patch) | |
tree | a84e8a2eceb72d0af73fb05a5b62c8f950767087 /tests | |
parent | bf2b385a2e8b9bfbc5cc66efb1356394c431b3e2 (diff) | |
download | sonarqube-f3de142860a4ebcc91f9f80771964a105f8ed982.tar.gz sonarqube-f3de142860a4ebcc91f9f80771964a105f8ed982.zip |
SONAR-9142 Remove 'previous_analysis' option
Diffstat (limited to 'tests')
11 files changed, 15 insertions, 91 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java b/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java index 40a5de1ab18..7b6c4c79f9f 100644 --- a/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java +++ b/tests/src/test/java/org/sonarqube/tests/issue/NewIssuesMeasureTest.java @@ -53,7 +53,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { @Test public void new_issues_measures() throws Exception { - setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_analysis"); + setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_version"); ORCHESTRATOR.getServer().provisionProject("sample", "Sample"); // Execute an analysis in the past with no issue to have a past snapshot @@ -96,7 +96,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { */ @Test public void new_issues_measures_consistent_with_variations() throws Exception { - setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_analysis"); + setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_version"); ORCHESTRATOR.getServer().provisionProject("sample", "Sample"); ItUtils.restoreProfile(ORCHESTRATOR, getClass().getResource("/issue/one-issue-per-line-profile.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line-profile"); @@ -124,7 +124,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { @Test public void new_issues_measures_should_be_correctly_calculated_when_adding_a_new_module() throws Exception { - setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_analysis"); + setServerProperty(ORCHESTRATOR, "sonar.leak.period", "previous_version"); ORCHESTRATOR.getServer().provisionProject("com.sonarsource.it.samples:multi-modules-sample", "com.sonarsource.it.samples:multi-modules-sample"); // First analysis without module b diff --git a/tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java b/tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java index 0597e0e8e97..8df93be6cf6 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java @@ -82,7 +82,7 @@ public class DifferentialPeriodsTest { orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY); // Set a global property and a project property to ensure project property is used - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); setServerProperty(orchestrator, PROJECT_KEY, "sonar.leak.period", "30"); // Execute an analysis in the past to have a past snapshot without any issues @@ -133,7 +133,7 @@ public class DifferentialPeriodsTest { @Test public void compute_no_new_lines_measures_when_changes_but_no_scm() throws Exception { orchestrator.getServer().provisionProject(MULTI_MODULE_PROJECT_KEY, MULTI_MODULE_PROJECT_KEY); - setServerProperty(orchestrator, MULTI_MODULE_PROJECT_KEY, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, MULTI_MODULE_PROJECT_KEY, "sonar.leak.period", "previous_version"); // Execute an analysis 60 days ago without module b orchestrator.getServer().associateProjectToQualityProfile(MULTI_MODULE_PROJECT_KEY, "xoo", "empty"); @@ -156,7 +156,7 @@ public class DifferentialPeriodsTest { public void compute_zero_new_lines_measures_when_no_changes_and_scm_available() throws Exception { String projectKey = "sample-scm"; orchestrator.getServer().provisionProject(projectKey, projectKey); - setServerProperty(orchestrator, projectKey, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, projectKey, "sonar.leak.period", "previous_version"); // Execute an analysis 60 days ago runProjectAnalysis(orchestrator, "scm/xoo-sample-with-scm", "sonar.projectDate", formatDate(addDays(new Date(), -60)), diff --git a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java index 53e20f39bc0..6bbca17f498 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/MeasuresWsTest.java @@ -52,7 +52,7 @@ public class MeasuresWsTest { @BeforeClass public static void initPeriod() throws Exception { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); } @AfterClass diff --git a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java index f95081a24a7..5d5e5afdde1 100644 --- a/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java +++ b/tests/src/test/java/org/sonarqube/tests/measure/TimeMachineTest.java @@ -75,7 +75,7 @@ public class TimeMachineTest { } private static void initPeriod() { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); } @AfterClass diff --git a/tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java b/tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java index 78c56f8bea2..3bbe47d1174 100644 --- a/tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java @@ -56,7 +56,7 @@ public class LeakProjectsPageTest { @BeforeClass public static void beforeClass() { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); } @AfterClass diff --git a/tests/src/test/java/org/sonarqube/tests/projectSearch/SearchProjectsTest.java b/tests/src/test/java/org/sonarqube/tests/projectSearch/SearchProjectsTest.java index 8383935cab8..c466b813e11 100644 --- a/tests/src/test/java/org/sonarqube/tests/projectSearch/SearchProjectsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/projectSearch/SearchProjectsTest.java @@ -220,7 +220,7 @@ public class SearchProjectsTest { @Test public void should_return_facets_on_leak() throws Exception { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); // This project has no duplication on new code String projectKey1 = newProjectKey(); analyzeProject(projectKey1, "shared/xoo-sample", "sonar.projectDate", "2016-12-31"); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java index d946a40e5f2..9df387528bf 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateNotificationTest.java @@ -67,7 +67,7 @@ public class QualityGateNotificationTest { @Test public void status_on_metric_variation_and_send_notifications() throws Exception { - tester.settings().setGlobalSettings("sonar.leak.period", "previous_analysis"); + tester.settings().setGlobalSettings("sonar.leak.period", "previous_version"); tester.settings().setGlobalSettings("email.smtp_host.secured", "localhost"); tester.settings().setGlobalSettings("email.smtp_port.secured", Integer.toString(SMTP_SERVER.getServer().getPort())); @@ -113,7 +113,7 @@ public class QualityGateNotificationTest { .contains("Project: Sample") .contains("Version: 1.0-SNAPSHOT") .contains("Quality gate status: Orange (was Green)") - .contains("Quality gate threshold: Lines of Code variation = 0 since previous analysis") + .contains("Quality gate threshold: Lines of Code variation = 0 since previous version") .contains("/dashboard?id=" + project.getKey()); assertThat(emails.hasNext()).isFalse(); } diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java index 7630cde5922..c1005e3683c 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java @@ -67,7 +67,7 @@ public class QualityGateOnRatingMeasuresTest { Project project = tester.projects().generate(null); WsQualityGates.CreateWsResponse qualityGate = tester.qGates().generate(); tester.qGates().associateProject(qualityGate, project); - tester.settings().setGlobalSetting("sonar.leak.period", "previous_analysis"); + tester.settings().setGlobalSetting("sonar.leak.period", "previous_version"); tester.wsClient().qualityGates().createCondition(CreateConditionRequest.builder() .setQualityGateId(qualityGate.getId()) .setMetricKey("new_security_rating") diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java index 0e89e544925..132e081054c 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java @@ -56,7 +56,7 @@ public class QualityGateUiTest { @Before public void initPeriod() throws Exception { - tester.settings().setGlobalSettings("sonar.leak.period", "previous_analysis"); + tester.settings().setGlobalSettings("sonar.leak.period", "previous_version"); } /** diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/NewDebtRatioMeasureTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/NewDebtRatioMeasureTest.java index 7b24e3e76a9..9279b40d50c 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/NewDebtRatioMeasureTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/NewDebtRatioMeasureTest.java @@ -64,7 +64,7 @@ public class NewDebtRatioMeasureTest { @Test public void new_debt_ratio_is_computed_from_new_debt_and_new_ncloc_count_per_file() throws Exception { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); + setServerProperty(orchestrator, "sonar.leak.period", "previous_version"); // run analysis on the day of after the first commit, with 'one-issue-per-line' profile defineQualityProfile("one-issue-per-line"); diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtAndIssueNewMeasuresTest.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtAndIssueNewMeasuresTest.java index 801b02d3c1e..637a6a982b3 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtAndIssueNewMeasuresTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/TechnicalDebtAndIssueNewMeasuresTest.java @@ -54,82 +54,6 @@ public class TechnicalDebtAndIssueNewMeasuresTest { } @Test - public void since_previous_analysis_with_constant_effort() throws Exception { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); - defineQualityProfile("one-issue-per-line"); - provisionSampleProject(); - - // Execute an analysis in the past to have a past snapshot without any issues - setSampleProjectQualityProfile("empty"); - runSampleProjectAnalysis("v1", "sonar.projectDate", DATE_31_DAYS_AGO); - - // Second analysis issues will be created -> new issues and new technical debt - setSampleProjectQualityProfile("one-issue-per-line"); - runSampleProjectAnalysis("v1"); - assertLeakPeriodForComponent("sample", 26, 26); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 13, 13); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 13, 13); - - // Third analysis, with exactly the same profile -> no new issues so no new technical debt - runSampleProjectAnalysis("v1"); - assertLeakPeriodForComponent("sample", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 0, 0); - - // Fourth analysis, with new files and modified files -> new issues and new technical debt - runSampleProjectAnalysis("v2"); - assertLeakPeriodForComponent("sample", 17, 17); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 4, 4); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassAdded.xoo", 13, 13); - - // Fifth analysis, no change -> no new issues so no new technical debt - runSampleProjectAnalysis("v2"); - assertLeakPeriodForComponent("sample", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassAdded.xoo", 0, 0); - } - - @Test - public void since_previous_analysis_with_effort_change() throws Exception { - setServerProperty(orchestrator, "sonar.leak.period", "previous_analysis"); - defineQualityProfile("one-issue-per-line"); - provisionSampleProject(); - - // Execute an analysis in the past to have a past snapshot without any issues - setSampleProjectQualityProfile("empty"); - runSampleProjectAnalysis("v1", "sonar.projectDate", DATE_31_DAYS_AGO); - - // Second analysis issues will be created -> new issues and new technical debt - setSampleProjectQualityProfile("one-issue-per-line"); - runSampleProjectAnalysis("v1"); - assertLeakPeriodForComponent("sample", 26, 26); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 13, 13); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 13, 13); - - // Third analysis, no change but increased effort is ignored but only new issues are considered -> no new issues so no new technical debt - runSampleProjectAnalysis("v1", "sonar.oneIssuePerLine.effortToFix", "10"); - assertLeakPeriodForComponent("sample", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 0, 0); - - // Fourth analysis, with new files, modified files and increased effort -> new issues and new technical debt - runSampleProjectAnalysis("v2", "sonar.oneIssuePerLine.effortToFix", "10"); - assertLeakPeriodForComponent("sample", 170, 17); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 40, 4); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassAdded.xoo", 130, 13); - - // Fifth analysis, no change -> no new issues so no new technical debt - runSampleProjectAnalysis("v2", "sonar.oneIssuePerLine.effortToFix", "10"); - assertLeakPeriodForComponent("sample", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/UnchangedClass.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassToModify.xoo", 0, 0); - assertLeakPeriodForComponent("sample:src/main/xoo/sample/ClassAdded.xoo", 0, 0); - } - - @Test public void since_30_days_with_constant_effort() throws Exception { setServerProperty(orchestrator, "sonar.leak.period", "30"); defineQualityProfile("one-issue-per-line"); |