diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-02-08 14:04:28 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2017-02-10 10:01:22 +0100 |
commit | b34fde05bfe032fbe4fe57f880e3ef673292cc80 (patch) | |
tree | 16e413c1a9215fd1839eb096af8a8153cc4349e5 /server/sonar-server/src | |
parent | 7e59dac3b1a5eeace8f543e8ff9cdf8f1e211725 (diff) | |
download | sonarqube-b34fde05bfe032fbe4fe57f880e3ef673292cc80.tar.gz sonarqube-b34fde05bfe032fbe4fe57f880e3ef673292cc80.zip |
SONAR-8759 Rename setting "sonar.timemachine.period1" to "sonar.leak.period"
Diffstat (limited to 'server/sonar-server/src')
9 files changed, 77 insertions, 77 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolder.java index 6844ce305f3..a298e97e942 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolder.java @@ -22,7 +22,7 @@ package org.sonar.server.computation.task.projectanalysis.period; /** * Repository of period used to compute differential measures. * Here are the steps to retrieve the period : - * - Read the period property ${@link org.sonar.core.config.CorePropertyDefinitions#TIMEMACHINE_PERIOD_PREFIX} + * - Read the period property ${@link org.sonar.core.config.CorePropertyDefinitions#LEAK_PERIOD} * - Try to find the matching snapshots from the property * - If a snapshot is found, the period is added to the repository */ diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStep.java index f2623ead683..c3943217520 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStep.java @@ -45,7 +45,7 @@ import static org.sonar.server.computation.task.projectanalysis.component.Crawle * Populates the {@link PeriodHolder} * <p/> * Here is how these periods are computed : - * - Read the 5 period properties ${@link org.sonar.core.config.CorePropertyDefinitions#TIMEMACHINE_PERIOD_PREFIX} + * - Read the 5 period properties ${@link org.sonar.core.config.CorePropertyDefinitions#LEAK_PERIOD} * - Try to find the matching snapshots from the properties * - If a snapshot is found, a new period is added to the repository */ diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PeriodResolver.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PeriodResolver.java index 6ec616bcc99..bbd5155c659 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PeriodResolver.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PeriodResolver.java @@ -35,12 +35,12 @@ import org.sonar.db.component.SnapshotDto; import org.sonar.db.component.SnapshotQuery; import org.sonar.server.computation.task.projectanalysis.period.Period; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DATE; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DAYS; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_VERSION; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_VERSION; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_PERIOD_PREFIX; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DATE; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DAYS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_VERSION; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_VERSION; import static org.sonar.db.component.SnapshotDto.STATUS_PROCESSED; import static org.sonar.db.component.SnapshotQuery.SORT_FIELD.BY_DATE; import static org.sonar.db.component.SnapshotQuery.SORT_ORDER.ASC; @@ -72,7 +72,7 @@ public class PeriodResolver { } Period period = resolve(propertyValue); if (period == null && StringUtils.isNotBlank(propertyValue)) { - LOG.debug("Property " + TIMEMACHINE_PERIOD_PREFIX + 1 + " is not valid: " + propertyValue); + LOG.debug("Property " + LEAK_PERIOD + " is not valid: " + propertyValue); } return period; } @@ -87,10 +87,10 @@ public class PeriodResolver { if (date != null) { return findByDate(date); } - if (StringUtils.equals(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, property)) { + if (StringUtils.equals(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, property)) { return findByPreviousAnalysis(); } - if (StringUtils.equals(TIMEMACHINE_MODE_PREVIOUS_VERSION, property)) { + if (StringUtils.equals(LEAK_PERIOD_MODE_PREVIOUS_VERSION, property)) { return findByPreviousVersion(); } return findByVersion(property); @@ -102,7 +102,7 @@ public class PeriodResolver { return null; } LOG.debug("Compare to date {} (analysis of {})", formatDate(date.getTime()), formatDate(snapshot.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_DATE, DateUtils.formatDate(date), snapshot.getCreatedAt(), snapshot.getUuid()); + return new Period(LEAK_PERIOD_MODE_DATE, DateUtils.formatDate(date), snapshot.getCreatedAt(), snapshot.getUuid()); } @CheckForNull @@ -114,7 +114,7 @@ public class PeriodResolver { return null; } LOG.debug("Compare over {} days ({}, analysis of {})", String.valueOf(days), formatDate(targetDate), formatDate(snapshot.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_DAYS, String.valueOf(days), snapshot.getCreatedAt(), snapshot.getUuid()); + return new Period(LEAK_PERIOD_MODE_DAYS, String.valueOf(days), snapshot.getCreatedAt(), snapshot.getUuid()); } @CheckForNull @@ -124,7 +124,7 @@ public class PeriodResolver { return null; } LOG.debug("Compare to previous analysis ({})", formatDate(snapshot.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, formatDate(snapshot.getCreatedAt()), snapshot.getCreatedAt(), snapshot.getUuid()); + return new Period(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, formatDate(snapshot.getCreatedAt()), snapshot.getCreatedAt(), snapshot.getUuid()); } @CheckForNull @@ -139,7 +139,7 @@ public class PeriodResolver { } SnapshotDto snapshotDto = snapshotDtos.get(0); LOG.debug("Compare to previous version ({})", formatDate(snapshotDto.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_PREVIOUS_VERSION, snapshotDto.getVersion(), snapshotDto.getCreatedAt(), snapshotDto.getUuid()); + return new Period(LEAK_PERIOD_MODE_PREVIOUS_VERSION, snapshotDto.getVersion(), snapshotDto.getCreatedAt(), snapshotDto.getUuid()); } @CheckForNull @@ -149,7 +149,7 @@ public class PeriodResolver { return null; } LOG.debug("Compare to first analysis ({})", formatDate(snapshotDto.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_PREVIOUS_VERSION, null, snapshotDto.getCreatedAt(), snapshotDto.getUuid()); + return new Period(LEAK_PERIOD_MODE_PREVIOUS_VERSION, null, snapshotDto.getCreatedAt(), snapshotDto.getUuid()); } @CheckForNull @@ -159,7 +159,7 @@ public class PeriodResolver { return null; } LOG.debug("Compare to version ({}) ({})", version, formatDate(snapshot.getCreatedAt())); - return new Period(TIMEMACHINE_MODE_VERSION, version, snapshot.getCreatedAt(), snapshot.getUuid()); + return new Period(LEAK_PERIOD_MODE_VERSION, version, snapshot.getCreatedAt(), snapshot.getUuid()); } @CheckForNull @@ -204,6 +204,6 @@ public class PeriodResolver { } private static String getPropertyValue(Settings settings) { - return settings.getString(TIMEMACHINE_PERIOD_PREFIX + 1); + return settings.getString(LEAK_PERIOD); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregatorTest.java index 34b6b95048a..15eb7aa823d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregatorTest.java @@ -51,11 +51,11 @@ import static org.sonar.api.measures.CoreMetrics.NEW_TECHNICAL_DEBT_KEY; import static org.sonar.api.rules.RuleType.BUG; import static org.sonar.api.rules.RuleType.CODE_SMELL; import static org.sonar.api.rules.RuleType.VULNERABILITY; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS; public class NewEffortAggregatorTest { - private static final Period PERIOD = new Period(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, null, 1_500_000_000L, "U1"); + private static final Period PERIOD = new Period(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, 1_500_000_000L, "U1"); private static final Component FILE = ReportComponent.builder(Component.Type.FILE, 1).setUuid("FILE").build(); private static final Component PROJECT = ReportComponent.builder(Component.Type.PROJECT, 2).addChildren(FILE).build(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculatorTest.java index 65bacc4e30d..60d4cfed93f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculatorTest.java @@ -32,7 +32,7 @@ import org.sonar.server.computation.task.projectanalysis.period.Period; import static java.util.Collections.emptyList; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_VERSION; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_VERSION; public class NewEffortCalculatorTest { @@ -44,7 +44,7 @@ public class NewEffortCalculatorTest { private static final Duration TEN_DAYS = Duration.create(10 * HOURS_IN_DAY * 60 * 60L); private static final long PERIOD_DATE = 150000000L; private static final String ANALYSIS_UUID = "u1"; - private static final Period PERIOD = new Period(TIMEMACHINE_MODE_PREVIOUS_VERSION, null, PERIOD_DATE, ANALYSIS_UUID); + private static final Period PERIOD = new Period(LEAK_PERIOD_MODE_PREVIOUS_VERSION, null, PERIOD_DATE, ANALYSIS_UUID); DefaultIssue issue = new DefaultIssue(); NewEffortCalculator underTest = new NewEffortCalculator(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodTest.java index 373f23ca0b6..33bb242b25f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodTest.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DAYS; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_VERSION; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DAYS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_VERSION; public class PeriodTest { @@ -38,9 +38,9 @@ public class PeriodTest { @Test public void test_some_setters_and_getters() { - Period period = new Period(TIMEMACHINE_MODE_VERSION, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID); + Period period = new Period(LEAK_PERIOD_MODE_VERSION, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_VERSION); assertThat(period.getModeParameter()).isEqualTo(SOME_MODE_PARAM); assertThat(period.getSnapshotDate()).isEqualTo(SOME_SNAPSHOT_DATE); assertThat(period.getAnalysisUuid()).isEqualTo(SOME_ANALYSIS_UUID); @@ -48,22 +48,22 @@ public class PeriodTest { @Test public void verify_to_string() { - assertThat(new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10").toString()) + assertThat(new Period(LEAK_PERIOD_MODE_VERSION, "2.3", 1420034400000L, "U10").toString()) .isEqualTo("Period{mode=version, modeParameter=2.3, snapshotDate=1420034400000, analysisUuid=U10}"); } @Test public void equals_is_done_on_all_fields() { - Period period = new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10"); + Period period = new Period(LEAK_PERIOD_MODE_VERSION, "2.3", 1420034400000L, "U10"); - assertThat(period).isEqualTo(new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10")); + assertThat(period).isEqualTo(new Period(LEAK_PERIOD_MODE_VERSION, "2.3", 1420034400000L, "U10")); assertThat(period).isNotEqualTo(null); assertThat(period).isNotEqualTo("sdsd"); - assertThat(period).isNotEqualTo(new Period(TIMEMACHINE_MODE_DAYS, "2.3", 1420034400000L, "U10")); - assertThat(period).isNotEqualTo(new Period(TIMEMACHINE_MODE_VERSION, "2.4", 1420034400000L, "U10")); - assertThat(period).isNotEqualTo(new Period(TIMEMACHINE_MODE_VERSION, "2.3", 555L, "U10")); - assertThat(period).isNotEqualTo(new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "9632554")); + assertThat(period).isNotEqualTo(new Period(LEAK_PERIOD_MODE_DAYS, "2.3", 1420034400000L, "U10")); + assertThat(period).isNotEqualTo(new Period(LEAK_PERIOD_MODE_VERSION, "2.4", 1420034400000L, "U10")); + assertThat(period).isNotEqualTo(new Period(LEAK_PERIOD_MODE_VERSION, "2.3", 555L, "U10")); + assertThat(period).isNotEqualTo(new Period(LEAK_PERIOD_MODE_VERSION, "2.3", 1420034400000L, "9632554")); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStepTest.java index 644eb7b2d3d..83a1bd118e9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStepTest.java @@ -46,11 +46,11 @@ import org.sonar.server.computation.task.step.ComputationStep; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DATE; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DAYS; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_VERSION; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_VERSION; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DATE; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DAYS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_VERSION; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_VERSION; @RunWith(DataProviderRunner.class) public class LoadPeriodsStepTest extends BaseStepTest { @@ -116,13 +116,13 @@ public class LoadPeriodsStepTest extends BaseStepTest { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); String textDate = "2008-11-22"; - settings.setProperty("sonar.timemachine.period1", textDate); + settings.setProperty("sonar.leak.period", textDate); underTest.execute(); Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_DATE); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE); assertThat(period.getModeParameter()).isEqualTo(textDate); assertThat(period.getSnapshotDate()).isEqualTo(1227358680000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1003"); @@ -133,7 +133,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_when_settings_match_no_analysis(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "UNKNWOWN VERSION"); + settings.setProperty("sonar.leak.period", "UNKNWOWN VERSION"); underTest.execute(); @@ -145,7 +145,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_when_settings_is_empty(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", ""); + settings.setProperty("sonar.leak.period", ""); underTest.execute(); @@ -157,7 +157,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void ignore_unprocessed_snapshots(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "unprocessed_snapshots.xml"); - settings.setProperty("sonar.timemachine.period1", "100"); + settings.setProperty("sonar.leak.period", "100"); underTest.execute(); @@ -170,14 +170,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); String textDate = "2008-11-22"; - settings.setProperty("sonar.timemachine.period1", textDate); + settings.setProperty("sonar.leak.period", textDate); underTest.execute(); // Return analysis from given date 2008-11-22 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_DATE); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE); assertThat(period.getModeParameter()).isEqualTo(textDate); assertThat(period.getSnapshotDate()).isEqualTo(1227358680000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1003"); @@ -192,14 +192,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); String date = "2008-11-24"; - settings.setProperty("sonar.timemachine.period1", date); + settings.setProperty("sonar.leak.period", date); underTest.execute(); // Analysis form 2008-11-29 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_DATE); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DATE); assertThat(period.getModeParameter()).isEqualTo(date); assertThat(period.getSnapshotDate()).isEqualTo(1227934800000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1004"); @@ -211,7 +211,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); // No analysis at and after this date - settings.setProperty("sonar.timemachine.period1", "2008-11-30"); + settings.setProperty("sonar.leak.period", "2008-11-30"); underTest.execute(); @@ -223,14 +223,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_days(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "10"); + settings.setProperty("sonar.leak.period", "10"); underTest.execute(); // return analysis from 2008-11-20 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_DAYS); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_DAYS); assertThat(period.getModeParameter()).isEqualTo("10"); assertThat(period.getSnapshotDate()).isEqualTo(1227157200000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1002"); @@ -244,7 +244,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_by_days(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "empty.xml"); - settings.setProperty("sonar.timemachine.period1", "0"); + settings.setProperty("sonar.leak.period", "0"); underTest.execute(); @@ -256,14 +256,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_analysis(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_analysis"); + settings.setProperty("sonar.leak.period", "previous_analysis"); underTest.execute(); // return analysis from 2008-11-29 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS); assertThat(period.getModeParameter()).isNotNull(); assertThat(period.getSnapshotDate()).isEqualTo(1227934800000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1004"); @@ -277,7 +277,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_by_previous_analysis(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "empty.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_analysis"); + settings.setProperty("sonar.leak.period", "previous_analysis"); underTest.execute(); @@ -288,14 +288,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_version() { setupRoot(PROJECT_ROOT); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); // Analysis form 2008-11-12 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_VERSION); assertThat(period.getModeParameter()).isEqualTo("1.0"); assertThat(period.getSnapshotDate()).isEqualTo(1226494680000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1001"); @@ -308,7 +308,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_version_is_not_supported_for_views() { setupRoot(VIEW_ROOT); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); @@ -319,14 +319,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_version_with_previous_version_deleted() { setupRoot(PROJECT_ROOT); dbTester.prepareDbUnit(getClass(), "previous_version_deleted.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); // Analysis form 2008-11-11 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_VERSION); assertThat(period.getModeParameter()).isEqualTo("0.9"); assertThat(period.getSnapshotDate()).isEqualTo(1226379600000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1000"); @@ -337,7 +337,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_by_previous_version(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "empty.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); @@ -348,13 +348,13 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_version_with_first_analysis_when_no_previous_version_found() { setupRoot(PROJECT_ROOT); dbTester.prepareDbUnit(getClass(), "no_previous_version.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_VERSION); assertThat(period.getModeParameter()).isNull(); assertThat(period.getSnapshotDate()).isEqualTo(1226379600000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1000"); @@ -364,13 +364,13 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_previous_version_with_first_analysis_when_previous_snapshot_is_the_last_one() { setupRoot(PROJECT_ROOT); dbTester.prepareDbUnit(getClass(), "previous_version_is_last_one.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_VERSION); assertThat(period.getModeParameter()).isNull(); assertThat(period.getSnapshotDate()).isEqualTo(1226379600000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1000"); @@ -380,7 +380,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_by_previous_version_when_no_event_version_for_views() { setupRoot(VIEW_ROOT); dbTester.prepareDbUnit(getClass(), "no_previous_version.xml"); - settings.setProperty("sonar.timemachine.period1", "previous_version"); + settings.setProperty("sonar.leak.period", "previous_version"); underTest.execute(); @@ -392,14 +392,14 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void feed_period_by_version(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "shared.xml"); - settings.setProperty("sonar.timemachine.period1", "0.9"); + settings.setProperty("sonar.leak.period", "0.9"); underTest.execute(); // Analysis form 2008-11-11 Period period = periodsHolder.getPeriod(); assertThat(period).isNotNull(); - assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_VERSION); + assertThat(period.getMode()).isEqualTo(LEAK_PERIOD_MODE_VERSION); assertThat(period.getModeParameter()).isEqualTo("0.9"); assertThat(period.getSnapshotDate()).isEqualTo(1226379600000L); assertThat(period.getAnalysisUuid()).isEqualTo("u1000"); @@ -413,7 +413,7 @@ public class LoadPeriodsStepTest extends BaseStepTest { public void no_period_by_version(Component root) { setupRoot(root); dbTester.prepareDbUnit(getClass(), "empty.xml"); - settings.setProperty("sonar.timemachine.period1", "0.8"); + settings.setProperty("sonar.leak.period", "0.8"); underTest.execute(); 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 d71a368b400..5e5b3a6f12e 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 @@ -45,8 +45,8 @@ import org.sonar.server.computation.task.step.ComputationStep; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DATE; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DATE; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS; public class ReportPersistAnalysisStepTest extends BaseStepTest { @@ -146,7 +146,7 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest { SnapshotDto snapshotDto = SnapshotTesting.newAnalysis(projectDto).setCreatedAt(DateUtils.parseDateQuietly("2015-01-01").getTime()); dbClient.snapshotDao().insert(dbTester.getSession(), snapshotDto); dbTester.getSession().commit(); - periodsHolder.setPeriod(new Period(TIMEMACHINE_MODE_DATE, "2015-01-01", analysisDate, "u1")); + periodsHolder.setPeriod(new Period(LEAK_PERIOD_MODE_DATE, "2015-01-01", analysisDate, "u1")); Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid("ABCD").setKey(PROJECT_KEY).build(); treeRootHolder.setRoot(project); @@ -155,14 +155,14 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest { underTest.execute(); SnapshotDto projectSnapshot = getUnprocessedSnapshot(projectDto.uuid()); - assertThat(projectSnapshot.getPeriodMode()).isEqualTo(TIMEMACHINE_MODE_DATE); + assertThat(projectSnapshot.getPeriodMode()).isEqualTo(LEAK_PERIOD_MODE_DATE); assertThat(projectSnapshot.getPeriodDate()).isEqualTo(analysisDate); assertThat(projectSnapshot.getPeriodModeParameter()).isNotNull(); } @Test public void only_persist_snapshots_with_leak_period_on_project_and_module() { - periodsHolder.setPeriod(new Period(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, null, analysisDate, "u1")); + periodsHolder.setPeriod(new Period(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, analysisDate, "u1")); OrganizationDto organizationDto = dbTester.organizations().insert(); ComponentDto projectDto = ComponentTesting.newProjectDto(organizationDto, "ABCD").setKey(PROJECT_KEY).setName("Project"); @@ -195,7 +195,7 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest { underTest.execute(); SnapshotDto newProjectSnapshot = getUnprocessedSnapshot(projectDto.uuid()); - assertThat(newProjectSnapshot.getPeriodMode()).isEqualTo(TIMEMACHINE_MODE_PREVIOUS_ANALYSIS); + assertThat(newProjectSnapshot.getPeriodMode()).isEqualTo(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java index 83c558af29c..5002cbb06b9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java @@ -42,7 +42,7 @@ import org.sonar.server.computation.task.step.ComputationStep; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_DATE; +import static org.sonar.core.config.CorePropertyDefinitions.LEAK_PERIOD_MODE_DATE; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.db.component.ComponentTesting.newSubView; import static org.sonar.db.component.ComponentTesting.newView; @@ -132,12 +132,12 @@ public class ViewsPersistAnalysisStepTest extends BaseStepTest { Component view = ViewsComponent.builder(VIEW, "KEY_VIEW").setUuid("UUID_VIEW").addChildren(subView).build(); treeRootHolder.setRoot(view); - periodsHolder.setPeriod(new Period(TIMEMACHINE_MODE_DATE, "2015-01-01", analysisDate, "u1")); + periodsHolder.setPeriod(new Period(LEAK_PERIOD_MODE_DATE, "2015-01-01", analysisDate, "u1")); underTest.execute(); SnapshotDto viewSnapshot = getUnprocessedSnapshot(viewDto.uuid()); - assertThat(viewSnapshot.getPeriodMode()).isEqualTo(TIMEMACHINE_MODE_DATE); + assertThat(viewSnapshot.getPeriodMode()).isEqualTo(LEAK_PERIOD_MODE_DATE); assertThat(viewSnapshot.getPeriodDate()).isEqualTo(analysisDate); assertThat(viewSnapshot.getPeriodModeParameter()).isNotNull(); } |