]> source.dussan.org Git - sonarqube.git/commitdiff
Drop deprecated class PersistenceMode
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 9 Jan 2018 10:02:45 +0000 (11:02 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 9 Jan 2018 13:25:49 +0000 (14:25 +0100)
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoverageMeasuresBuilder.java
sonar-plugin-api/src/main/java/org/sonar/api/measures/Measure.java
sonar-plugin-api/src/main/java/org/sonar/api/measures/PersistenceMode.java [deleted file]
sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java
sonar-plugin-api/src/test/java/org/sonar/api/measures/PersistenceModeTest.java [deleted file]

index 4866a8c55944afa2d331b07cd50655ee5aba60ae..61012817b82353bb6c34c29f4b1bd231bef31db4 100644 (file)
@@ -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() {
index 5829848f1c6bf967f238e8b557883ad5fabeb6e3..8523785a0746128cfccacc31af8df6c4bb8983b3 100644 (file)
@@ -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;
@@ -147,36 +146,6 @@ public class Measure<G extends Serializable> implements Serializable {
   public Measure() {
   }
 
-  /**
-   * 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
    */
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 (file)
index ea5bebd..0000000
+++ /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);
-  }
-}
index 1c253c828c587d162c67a9102d1027c9ce5de2ea..ddf9e4ded72fa425e3fb76bc0f8dd753ea9de991 100644 (file)
@@ -45,18 +45,6 @@ public class MeasureTest {
     new Measure("metric_key").setValue(Double.NaN);
   }
 
-  @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");
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 (file)
index a37d2c9..0000000
+++ /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();
-  }
-}