]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8743 Remove index form Period
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 8 Feb 2017 12:25:21 +0000 (13:25 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 9 Feb 2017 11:15:11 +0000 (12:15 +0100)
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/Period.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodPredicates.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregatorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortCalculatorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodPredicatesTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImplTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/qualitygate/EvaluationResultTextConverterTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/PersistMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportComputeMeasureVariationsStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsComputeMeasureVariationsStepTest.java

index 6abf7865a946a644f16be43a2b519be51e996ff2..b2fd07b2098b7378dbac47f22a56a1a4c63054b5 100644 (file)
@@ -30,49 +30,19 @@ import static java.util.Objects.requireNonNull;
 
 @Immutable
 public class Period {
-  private final int index;
   private final String mode;
   @CheckForNull
   private final String modeParameter;
   private final long snapshotDate;
   private final String analysisUuid;
 
-  /**
-   * @deprecated replaced by {@link #Period(String, String, long, String)}
-   */
-  @Deprecated
-  public Period(int index, String mode, @Nullable String modeParameter, long snapshotDate, String analysisUuid) {
-    if (!isValidPeriodIndex(index)) {
-      throw new IllegalArgumentException(String.format("Period index (%s) must be > 0 and < 6", index));
-    }
-    this.index = index;
-    this.mode = requireNonNull(mode);
-    this.modeParameter = modeParameter;
-    this.snapshotDate = snapshotDate;
-    this.analysisUuid = analysisUuid;
-  }
-
   public Period(String mode, @Nullable String modeParameter, long snapshotDate, String analysisUuid) {
-    this.index = 1;
     this.mode = requireNonNull(mode);
     this.modeParameter = modeParameter;
     this.snapshotDate = snapshotDate;
     this.analysisUuid = analysisUuid;
   }
 
-  public static boolean isValidPeriodIndex(int i) {
-    return i > 0 && i < 6;
-  }
-
-  /**
-   * Index of periods is 1-based. It goes from 1 to 5.
-   * @deprecated only leak period can now be defined
-   */
-  @Deprecated
-  public int getIndex() {
-    return index;
-  }
-
   public String getMode() {
     return mode;
   }
@@ -99,8 +69,7 @@ public class Period {
       return false;
     }
     Period period = (Period) o;
-    return index == period.index
-      && snapshotDate == period.snapshotDate
+    return snapshotDate == period.snapshotDate
       && Objects.equals(analysisUuid, period.analysisUuid)
       && mode.equals(period.mode)
       && Objects.equals(modeParameter, period.modeParameter);
@@ -108,13 +77,12 @@ public class Period {
 
   @Override
   public int hashCode() {
-    return hash(index, mode, modeParameter, snapshotDate, analysisUuid);
+    return hash(mode, modeParameter, snapshotDate, analysisUuid);
   }
 
   @Override
   public String toString() {
     return toStringHelper(this)
-      .add("index", index)
       .add("mode", mode)
       .add("modeParameter", modeParameter)
       .add("snapshotDate", snapshotDate)
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodPredicates.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodPredicates.java
deleted file mode 100644 (file)
index ba692fb..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.server.computation.task.projectanalysis.period;
-
-import com.google.common.base.Predicate;
-import javax.annotation.Nonnull;
-
-public final class PeriodPredicates {
-  private PeriodPredicates() {
-    // prevents instantiation
-  }
-
-  /**
-   * Since Periods 4 and 5 can be customized per project and/or per view/subview, aggregating variation on these periods
-   * for NEW_* metrics will only generate garbage data which will make no sense. These Periods should be ignored
-   * when processing views/subviews.
-   */
-  public static Predicate<Period> viewsRestrictedPeriods() {
-    return ViewsSupportedPeriods.INSTANCE;
-  }
-
-  private enum ViewsSupportedPeriods implements Predicate<Period> {
-    INSTANCE;
-
-    @Override
-    public boolean apply(@Nonnull Period input) {
-      return input.getIndex() < 4;
-    }
-  }
-}
index 19a704d2a4342350c5bab425ecb218bb5dd18c77..0ad794d59aba1dce09e1e47516cb951a0178da76 100644 (file)
@@ -55,7 +55,7 @@ import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_PRE
 
 public class NewEffortAggregatorTest {
 
-  private static final Period PERIOD = new Period(1, TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, null, 1_500_000_000L, "U1");
+  private static final Period PERIOD = new Period(TIMEMACHINE_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();
index d578b871ff9e32df698f16b9a76c0afe9227cc42..65bacc4e30d00fe7ef6f2468d35ccbab1a476096 100644 (file)
@@ -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(1, TIMEMACHINE_MODE_PREVIOUS_VERSION, null, PERIOD_DATE, ANALYSIS_UUID);
+  private static final Period PERIOD = new Period(TIMEMACHINE_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/PeriodPredicatesTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodPredicatesTest.java
deleted file mode 100644 (file)
index 352bb06..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact 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.server.computation.task.projectanalysis.period;
-
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class PeriodPredicatesTest {
-
-  @Test(expected = NullPointerException.class)
-  public void viewsRestrictedPeriods_throws_NPE_if_Period_is_null() {
-    PeriodPredicates.viewsRestrictedPeriods().apply(null);
-  }
-
-  @Test
-  public void viewsRestrictedPeriods() {
-    assertThat(PeriodPredicates.viewsRestrictedPeriods().apply(createPeriod(1))).isTrue();
-    assertThat(PeriodPredicates.viewsRestrictedPeriods().apply(createPeriod(2))).isTrue();
-    assertThat(PeriodPredicates.viewsRestrictedPeriods().apply(createPeriod(3))).isTrue();
-    assertThat(PeriodPredicates.viewsRestrictedPeriods().apply(createPeriod(4))).isFalse();
-    assertThat(PeriodPredicates.viewsRestrictedPeriods().apply(createPeriod(5))).isFalse();
-  }
-
-  private Period createPeriod(int index) {
-    return new Period(index, "don't care", null, 1l, "U1");
-  }
-}
index d5bdda36492d26ab5c58b916c7215b44a8b92ebe..373f23ca0b6142b338c3d30dcb343628c73ce2cd 100644 (file)
@@ -29,7 +29,6 @@ import static org.sonar.core.config.CorePropertyDefinitions.TIMEMACHINE_MODE_VER
 
 public class PeriodTest {
 
-  private static final String SOME_MODE = "mode";
   private static final String SOME_MODE_PARAM = "mode_para";
   private static final long SOME_SNAPSHOT_DATE = 1000l;
   private static final String SOME_ANALYSIS_UUID = "U1";
@@ -39,58 +38,32 @@ public class PeriodTest {
 
   @Test
   public void test_some_setters_and_getters() {
-    Period period = new Period(1, TIMEMACHINE_MODE_VERSION, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID);
+    Period period = new Period(TIMEMACHINE_MODE_VERSION, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID);
 
     assertThat(period.getMode()).isEqualTo(TIMEMACHINE_MODE_VERSION);
     assertThat(period.getModeParameter()).isEqualTo(SOME_MODE_PARAM);
-    assertThat(period.getIndex()).isEqualTo(1);
     assertThat(period.getSnapshotDate()).isEqualTo(SOME_SNAPSHOT_DATE);
     assertThat(period.getAnalysisUuid()).isEqualTo(SOME_ANALYSIS_UUID);
   }
 
-  @Test
-  public void constructor_throws_IAE_if_index_is_0() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Period index (0) must be > 0 and < 6");
-
-    new Period(0, SOME_MODE, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID);
-  }
-
-  @Test
-  public void constructor_throws_IAE_if_index_is_6() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Period index (6) must be > 0 and < 6");
-
-    new Period(6, SOME_MODE, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID);
-  }
-
-  @Test
-  public void constructor_throws_IAE_if_index_is_less_then_1() {
-    expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Period index (-156) must be > 0 and < 6");
-
-    new Period(-156, SOME_MODE, SOME_MODE_PARAM, SOME_SNAPSHOT_DATE, SOME_ANALYSIS_UUID);
-  }
-
   @Test
   public void verify_to_string() {
-    assertThat(new Period(1, TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10").toString())
-      .isEqualTo("Period{index=1, mode=version, modeParameter=2.3, snapshotDate=1420034400000, analysisUuid=U10}");
+    assertThat(new Period(TIMEMACHINE_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(1, TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10");
+    Period period = new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10");
 
-    assertThat(period).isEqualTo(new Period(1, TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10"));
+    assertThat(period).isEqualTo(new Period(TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10"));
 
     assertThat(period).isNotEqualTo(null);
     assertThat(period).isNotEqualTo("sdsd");
-    assertThat(period).isNotEqualTo(new Period(2, TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "U10"));
-    assertThat(period).isNotEqualTo(new Period(1, TIMEMACHINE_MODE_DAYS, "2.3", 1420034400000L, "U10"));
-    assertThat(period).isNotEqualTo(new Period(1, TIMEMACHINE_MODE_VERSION, "2.4", 1420034400000L, "U10"));
-    assertThat(period).isNotEqualTo(new Period(1, TIMEMACHINE_MODE_VERSION, "2.3", 555L, "U10"));
-    assertThat(period).isNotEqualTo(new Period(1, TIMEMACHINE_MODE_VERSION, "2.3", 1420034400000L, "9632554"));
+    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"));
 
   }
 }
index e9039d2827be3b39e1edf89b3120db59d7ff6495..4b3857a559e361f6c53a8ed875254b13db01ebc0 100644 (file)
@@ -78,6 +78,6 @@ public class PeriodsHolderImplTest {
   }
 
   private static Period createPeriod() {
-    return new Period(1, 1 + "mode", null, 1000L, "U1");
+    return new Period(1 + "mode", null, 1000L, "U1");
   }
 }
index cafe1266e0e33408c56eb0a206541efa2223c166..03d8c7259517c8657259443a0eb915475961d318 100644 (file)
@@ -133,7 +133,7 @@ public class EvaluationResultTextConverterTest {
       .thenReturn(metricMsg);
 
     Date date = new Date();
-    Period period = new Period(periodIndex, SOME_MODE, null, date.getTime(), SOME_ANALYSIS_UUID);
+    Period period = new Period(SOME_MODE, null, date.getTime(), SOME_ANALYSIS_UUID);
     periodsHolder.setPeriod(period);
     when(periods.label(period.getMode(), period.getModeParameter(), date)).thenReturn(periodLabel);
 
@@ -156,7 +156,7 @@ public class EvaluationResultTextConverterTest {
     when(i18n.message(Locale.ENGLISH, "variation", "variation")).thenReturn(variationMsg);
 
     Date date = new Date();
-    Period period = new Period(periodIndex, SOME_MODE, null, date.getTime(), SOME_ANALYSIS_UUID);
+    Period period = new Period(SOME_MODE, null, date.getTime(), SOME_ANALYSIS_UUID);
     periodsHolder.setPeriod(period);
     when(periods.label(period.getMode(), period.getModeParameter(), date)).thenReturn(periodLabel);
 
index 9f55e3a3707dec53ab5f6ee67f3abbda3b971b82..2dd63250d93056719d56e79bba24f5e3e276ed57 100644 (file)
@@ -41,7 +41,6 @@ import org.sonar.server.computation.task.projectanalysis.component.ViewsComponen
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureToMeasureDto;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
-import org.sonar.server.computation.task.projectanalysis.period.Period;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -391,10 +390,6 @@ public class PersistMeasuresStepTest extends BaseStepTest {
     return componentDto;
   }
 
-  private static Period createPeriod() {
-    return new Period(1, "mode" + 1, null, 1, "1");
-  }
-
   private List<Map<String, Object>> selectSnapshots() {
     return dbTester
       .select(
index ead320828a8e5ef8d57384caa1e3b5d64f107d66..afc57e1c847831a821fd87e1f27c1e40c45a4794 100644 (file)
@@ -96,7 +96,7 @@ public class ReportComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), PROJECT_UUID, period1ProjectSnapshot.getUuid(), 60d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1ProjectSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ProjectSnapshot));
 
     treeRootHolder.setRoot(PROJECT);
 
@@ -129,7 +129,7 @@ public class ReportComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), directoryDto.uuid(), period1Snapshot.getUuid(), 10d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1Snapshot));
+    periodsHolder.setPeriod(newPeriod(period1Snapshot));
 
     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid(directoryDto.uuid()).build();
     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).addChildren(directory).build();
@@ -157,7 +157,7 @@ public class ReportComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), directoryDto.uuid(), period1Snapshot.getUuid(), 10d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1Snapshot));
+    periodsHolder.setPeriod(newPeriod(period1Snapshot));
 
     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid(directoryDto.uuid()).build();
     Component project = ReportComponent.builder(Component.Type.PROJECT, 1).setUuid(PROJECT_UUID).addChildren(directory).build();
@@ -183,7 +183,7 @@ public class ReportComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), PROJECT_UUID, currentProjectSnapshot.getUuid(), 60d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, past1ProjectSnapshot));
+    periodsHolder.setPeriod(newPeriod(past1ProjectSnapshot));
 
     // Directory has just been added => no snapshot
     Component directory = ReportComponent.builder(Component.Type.DIRECTORY, 2).setUuid("DIRECTORY").build();
@@ -211,7 +211,7 @@ public class ReportComputeMeasureVariationsStepTest {
       newMeasureDto(BUILD_BREAKER_METRIC.getId(), PROJECT_UUID, period1ProjectSnapshot.getUuid(), 1d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1ProjectSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ProjectSnapshot));
 
     treeRootHolder.setRoot(PROJECT);
 
@@ -238,7 +238,7 @@ public class ReportComputeMeasureVariationsStepTest {
       newMeasureDto(ISSUES_METRIC.getId(), PROJECT_UUID, period1ProjectSnapshot.getUuid(), 60d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1ProjectSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ProjectSnapshot));
 
     treeRootHolder.setRoot(PROJECT);
 
@@ -258,7 +258,7 @@ public class ReportComputeMeasureVariationsStepTest {
     dbClient.snapshotDao().insert(session, period1ProjectSnapshot);
     dbClient.measureDao().insert(session, newMeasureDto(NEW_DEBT.getId(), PROJECT_UUID, period1ProjectSnapshot.getUuid(), 60d));
     session.commit();
-    periodsHolder.setPeriod(newPeriod(1, period1ProjectSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ProjectSnapshot));
     treeRootHolder.setRoot(PROJECT);
 
     addRawMeasure(PROJECT, NEW_DEBT, newMeasureBuilder().setVariation(10d).createNoValue());
@@ -277,8 +277,8 @@ public class ReportComputeMeasureVariationsStepTest {
       .setValue(value);
   }
 
-  private static Period newPeriod(int index, SnapshotDto snapshotDto) {
-    return new Period(index, "mode", null, snapshotDto.getCreatedAt(), snapshotDto.getUuid());
+  private static Period newPeriod(SnapshotDto snapshotDto) {
+    return new Period("mode", null, snapshotDto.getCreatedAt(), snapshotDto.getUuid());
   }
 
   private void addRawMeasure(Component component, Metric metric, Measure measure) {
index c8461707d5f8f7fcde493c804a696f508289657a..07e25fddc6356152e151ebec3c2362fc98d5c47a 100644 (file)
@@ -96,7 +96,7 @@ public class ViewsComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), VIEW_UUID, period1ViewSnapshot.getUuid(), 60d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1ViewSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ViewSnapshot));
 
     treeRootHolder.setRoot(VIEW);
 
@@ -129,7 +129,7 @@ public class ViewsComputeMeasureVariationsStepTest {
     dbClient.measureDao().insert(session, newMeasureDto(ISSUES_METRIC.getId(), subviewDto.uuid(), period1Snapshot.getUuid(), 10d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1Snapshot));
+    periodsHolder.setPeriod(newPeriod(period1Snapshot));
 
     Component subview = ViewsComponent.builder(Component.Type.SUBVIEW, 2).setUuid(subviewDto.uuid()).build();
     Component view = ViewsComponent.builder(Component.Type.VIEW, 1).setUuid(VIEW_UUID).addChildren(subview).build();
@@ -155,7 +155,7 @@ public class ViewsComputeMeasureVariationsStepTest {
       newMeasureDto(BUILD_BREAKER_METRIC.getId(), VIEW_UUID, period1ViewSnapshot.getUuid(), 1d));
     session.commit();
 
-    periodsHolder.setPeriod(newPeriod(1, period1ViewSnapshot));
+    periodsHolder.setPeriod(newPeriod(period1ViewSnapshot));
 
     treeRootHolder.setRoot(VIEW);
 
@@ -182,8 +182,8 @@ public class ViewsComputeMeasureVariationsStepTest {
       .setValue(value);
   }
 
-  private static Period newPeriod(int index, SnapshotDto snapshotDto) {
-    return new Period(index, "mode", null, snapshotDto.getCreatedAt(), snapshotDto.getUuid());
+  private static Period newPeriod(SnapshotDto snapshotDto) {
+    return new Period("mode", null, snapshotDto.getCreatedAt(), snapshotDto.getUuid());
   }
 
   private void addRawMeasure(Component component, Metric metric, Measure measure) {