aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorEric Hartmann <hartmann.eric@gmail.com>2017-10-19 13:47:56 +0200
committerEric Hartmann <hartmann.eric@gmail.Com>2017-10-20 12:26:58 +0200
commitf3de142860a4ebcc91f9f80771964a105f8ed982 (patch)
treea84e8a2eceb72d0af73fb05a5b62c8f950767087 /sonar-core
parentbf2b385a2e8b9bfbc5cc66efb1356394c431b3e2 (diff)
downloadsonarqube-f3de142860a4ebcc91f9f80771964a105f8ed982.tar.gz
sonarqube-f3de142860a4ebcc91f9f80771964a105f8ed982.zip
SONAR-9142 Remove 'previous_analysis' option
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java12
-rw-r--r--sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java38
2 files changed, 1 insertions, 49 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
index 7aaecf3a41f..4b05e3bae42 100644
--- a/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
+++ b/sonar-core/src/main/java/org/sonar/core/timemachine/Periods.java
@@ -33,7 +33,6 @@ import static org.apache.commons.lang.StringUtils.isNotBlank;
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;
@@ -92,8 +91,6 @@ public class Periods {
return labelForDays(param, date, shortLabel);
case LEAK_PERIOD_MODE_VERSION:
return labelForVersion(param, date, shortLabel);
- case LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS:
- return labelForPreviousAnalysis(date, shortLabel);
case LEAK_PERIOD_MODE_PREVIOUS_VERSION:
return labelForPreviousVersion(param, date, shortLabel);
case LEAK_PERIOD_MODE_DATE:
@@ -117,13 +114,6 @@ public class Periods {
return label("since_version_detailed", shortLabel, param, date);
}
- private String labelForPreviousAnalysis(@Nullable String date, boolean shortLabel) {
- if (date == null) {
- return label("since_previous_analysis", shortLabel);
- }
- return label("since_previous_analysis_detailed", shortLabel, date);
- }
-
private String labelForPreviousVersion(@Nullable String param, @Nullable String date, boolean shortLabel) {
if (param == null && date == null) {
return label("since_previous_version", shortLabel);
@@ -156,7 +146,7 @@ public class Periods {
checkArgument(isNotBlank(periodProperty), "Period property should not be empty");
Integer possibleDaysValue = findByDays(periodProperty);
Date possibleDatesValue = findByDate(periodProperty);
- if (LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS.equals(periodProperty) || LEAK_PERIOD_MODE_PREVIOUS_VERSION.equals(periodProperty)) {
+ if (LEAK_PERIOD_MODE_PREVIOUS_VERSION.equals(periodProperty)) {
mode = periodProperty;
} else if (possibleDaysValue != null) {
mode = LEAK_PERIOD_MODE_DAYS;
diff --git a/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java b/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java
index 7c307f066db..c3f137b2a96 100644
--- a/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/timemachine/PeriodsTest.java
@@ -37,7 +37,6 @@ import static org.sonar.api.utils.DateUtils.parseDate;
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;
@@ -129,43 +128,6 @@ public class PeriodsTest {
}
@Test
- public void return_since_previous_analysis_label_when_no_date() {
- periods.label(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, (String) null);
-
- verify(i18n).message(any(Locale.class), eq("since_previous_analysis"), isNull(String.class));
- }
-
- @Test
- public void return_since_previous_analysis_abbreviation_when_no_date() {
- periods.abbreviation(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, null);
-
- verify(i18n).message(any(Locale.class), eq("since_previous_analysis.short"), isNull(String.class));
- }
-
- @Test
- public void return_since_previous_analysis_detailed_label_when_date_is_set() {
- periods.label(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, STRING_DATE);
-
- verify(i18n).message(any(Locale.class), eq("since_previous_analysis_detailed"), isNull(String.class), eq(STRING_DATE));
- }
-
- @Test
- public void return_since_previous_analysis_detailed_abbreviation_when_date_is_set() {
- periods.abbreviation(LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS, null, DATE);
-
- verify(i18n).message(any(Locale.class), eq("since_previous_analysis_detailed.short"), isNull(String.class), anyString());
- }
-
- @Test
- public void return_since_previous_analysis_label_using_settings() {
- settings.setProperty(LEAK_PERIOD + PERIOD_INDEX, LEAK_PERIOD_MODE_PREVIOUS_ANALYSIS);
-
- periods.label(PERIOD_INDEX);
-
- verify(i18n).message(any(Locale.class), eq("since_previous_analysis"), isNull(String.class));
- }
-
- @Test
public void return_since_previous_version_label_when_no_param() {
periods.label(LEAK_PERIOD_MODE_PREVIOUS_VERSION, null, (String) null);