diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-09 11:02:45 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2018-01-09 14:25:49 +0100 |
commit | 7af0b945e6772b8e10ee8c7548b78ee12ea88712 (patch) | |
tree | 1e4c35b437361714129a484848f6e5f916ecaec5 /sonar-plugin-api | |
parent | b6f0d5850ecbe4c851a0f218208ae0a1c4aab182 (diff) | |
download | sonarqube-7af0b945e6772b8e10ee8c7548b78ee12ea88712.tar.gz sonarqube-7af0b945e6772b8e10ee8c7548b78ee12ea88712.zip |
Drop deprecated class PersistenceMode
Diffstat (limited to 'sonar-plugin-api')
5 files changed, 3 insertions, 133 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoverageMeasuresBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoverageMeasuresBuilder.java index 4866a8c5594..61012817b82 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoverageMeasuresBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoverageMeasuresBuilder.java @@ -118,7 +118,7 @@ public final class CoverageMeasuresBuilder { if (getLinesToCover() > 0) { measures.add(new Measure(CoreMetrics.LINES_TO_COVER, (double) getLinesToCover())); measures.add(new Measure(CoreMetrics.UNCOVERED_LINES, (double) (getLinesToCover() - getCoveredLines()))); - measures.add(new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA).setData(KeyValueFormat.format(hitsByLine)).setPersistenceMode(PersistenceMode.DATABASE)); + measures.add(new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA).setData(KeyValueFormat.format(hitsByLine))); } if (getConditions() > 0) { measures.add(new Measure(CoreMetrics.CONDITIONS_TO_COVER, (double) getConditions())); @@ -131,14 +131,12 @@ public final class CoverageMeasuresBuilder { private Measure createCoveredConditionsByLine() { return new Measure(CoreMetrics.COVERED_CONDITIONS_BY_LINE) - .setData(KeyValueFormat.format(coveredConditionsByLine)) - .setPersistenceMode(PersistenceMode.DATABASE); + .setData(KeyValueFormat.format(coveredConditionsByLine)); } private Measure createConditionsByLine() { return new Measure(CoreMetrics.CONDITIONS_BY_LINE) - .setData(KeyValueFormat.format(conditionsByLine)) - .setPersistenceMode(PersistenceMode.DATABASE); + .setData(KeyValueFormat.format(conditionsByLine)); } public static CoverageMeasuresBuilder create() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java index 5829848f1c6..8523785a074 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java @@ -60,7 +60,6 @@ public class Measure<G extends Serializable> implements Serializable { protected Double variation4; protected Double variation5; protected String url; - protected PersistenceMode persistenceMode = PersistenceMode.FULL; public Measure(String metricKey) { this.metricKey = metricKey; @@ -148,36 +147,6 @@ public class Measure<G extends Serializable> implements Serializable { } /** - * Gets the persistence mode of the measure. Default persistence mode is FULL, except when instantiating the measure with a String - * parameter. - */ - public PersistenceMode getPersistenceMode() { - return persistenceMode; - } - - /** - * <p> - * Sets the persistence mode of a measure. - * - * <p> - * <b>WARNING : </b>Being able to reuse measures saved in memory is only possible within the same tree. In a multi-module project for - * example, a measure save in memory at the module level will not be accessible by the root project. In that case, database should be - * used. - * - * - * @param mode the mode - * @return the measure object instance - */ - public Measure<G> setPersistenceMode(@Nullable PersistenceMode mode) { - if (mode == null) { - this.persistenceMode = PersistenceMode.FULL; - } else { - this.persistenceMode = mode; - } - return this; - } - - /** * @return return the measures underlying metric */ public Metric<G> getMetric() { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PersistenceMode.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/PersistenceMode.java deleted file mode 100644 index ea5bebd50e7..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/PersistenceMode.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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.api.measures; - -/** - * Mode of persistence for resources and measures. Usage : - * <ul> - * <li>MEMORY : temporary data used only in batch for calculations.</li> - * <li>DATABASE : measures with big data (several kB), like details of code coverage hits</li> - * <li>FULL : both MEMORY and DATABASE (default).</li> - * </ul> - * - * @since 1.10 - * @deprecated since 5.6. No more used since 5.2. - */ -@Deprecated -public enum PersistenceMode { - MEMORY, DATABASE, FULL; - - public boolean useMemory() { - return equals(MEMORY) || equals(FULL); - } - - public boolean useDatabase() { - return equals(DATABASE) || equals(FULL); - } -} diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java index 1c253c828c5..ddf9e4ded72 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java @@ -46,18 +46,6 @@ public class MeasureTest { } @Test - public void defaultPersistenceModeIsFull() { - assertThat(new Measure(CoreMetrics.LINES, 32.0).getPersistenceMode()).isEqualTo(PersistenceMode.FULL); - } - - @Test - public void persistenceModeIsDatabaseForBigDataMeasures() { - Measure bigDataMeasure = new Measure(CoreMetrics.COVERAGE_LINE_HITS_DATA, "long data") - .setPersistenceMode(PersistenceMode.DATABASE); - assertThat(bigDataMeasure.getPersistenceMode()).isEqualTo(PersistenceMode.DATABASE); - } - - @Test public void measureWithLevelValue() { assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getData()).isEqualTo("ERROR"); assertThat(new Measure(CoreMetrics.ALERT_STATUS, Metric.Level.ERROR).getDataAsLevel()).isEqualTo(Metric.Level.ERROR); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/PersistenceModeTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/PersistenceModeTest.java deleted file mode 100644 index a37d2c9add4..00000000000 --- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/PersistenceModeTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 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.api.measures; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class PersistenceModeTest { - - @Test - public void useMemory() { - assertThat(PersistenceMode.MEMORY.useMemory()).isTrue(); - assertThat(PersistenceMode.DATABASE.useMemory()).isFalse(); - assertThat(PersistenceMode.FULL.useMemory()).isTrue(); - } - - @Test - public void useDatabase() { - assertThat(PersistenceMode.MEMORY.useDatabase()).isFalse(); - assertThat(PersistenceMode.DATABASE.useDatabase()).isTrue(); - assertThat(PersistenceMode.FULL.useDatabase()).isTrue(); - } -} |