]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8743 Rename PeriodsHolder to PeriodHolder 1634/head
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 9 Feb 2017 10:25:12 +0000 (11:25 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 9 Feb 2017 11:15:11 +0000 (12:15 +0100)
41 files changed:
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/container/ProjectAnalysisTaskContainerPopulator.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/formula/FormulaExecutorComponentVisitor.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/IssueCounter.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/NewEffortAggregator.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolder.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderImpl.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolder.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImpl.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/qualitygate/EvaluationResultTextConverterImpl.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitor.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/qualitymodel/NewReliabilityAndSecurityRatingMeasuresVisitor.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ComputeMeasureVariationsStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/NewCoverageMeasuresStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/NewSizeMeasuresStep.java
server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistAnalysisStep.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/AverageFormulaExecutionTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/AverageFormulaTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/DistributionFormulaTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/DumbCreateMeasureContext.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/IntSumFormulaTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/LongSumFormulaTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/ReportFormulaExecutorComponentVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/formula/ViewsFormulaExecutorComponentVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IssueCounterTest.java
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/period/PeriodHolderImplTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderRule.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImplTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderRule.java [deleted file]
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/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/qualitymodel/NewReliabilityAndSecurityRatingMeasuresVisitorTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/LoadPeriodsStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/NewSizeMeasuresStepTest.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/ReportNewCoverageMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ReportPersistAnalysisStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsComputeMeasureVariationsStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsNewCoverageMeasuresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ViewsPersistAnalysisStepTest.java

index 3c32129608dda1601f2ffa00f046229808819e72..97328e250145a7a4f5de4e74eca0f63968b36216 100644 (file)
@@ -85,7 +85,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureComputer
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryImpl;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureToMeasureDto;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricModule;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderImpl;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderImpl;
 import org.sonar.server.computation.task.projectanalysis.qualitygate.EvaluationResultTextConverterImpl;
 import org.sonar.server.computation.task.projectanalysis.qualitygate.QualityGateHolderImpl;
 import org.sonar.server.computation.task.projectanalysis.qualitygate.QualityGateServiceImpl;
@@ -151,7 +151,7 @@ public final class ProjectAnalysisTaskContainerPopulator implements ContainerPop
       CrossProjectDuplicationStatusHolderImpl.class,
       BatchReportDirectoryHolderImpl.class,
       TreeRootHolderImpl.class,
-      PeriodsHolderImpl.class,
+      PeriodHolderImpl.class,
       QualityGateHolderImpl.class,
       QualityGateStatusHolderImpl.class,
       RatingSettings.class,
index 20aff1b0f49bac8b2f6b5e13145a47991f28c406..c6503b1cfb9f35575c1dc9758814a8173defb33f 100644 (file)
@@ -34,7 +34,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static java.util.Objects.requireNonNull;
 
@@ -60,14 +60,14 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitorAdapter<For
   };
 
   @CheckForNull
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final MetricRepository metricRepository;
   private final MeasureRepository measureRepository;
   private final List<Formula> formulas;
 
   private FormulaExecutorComponentVisitor(Builder builder, Iterable<Formula> formulas) {
     super(CrawlerDepthLimit.LEAVES, ComponentVisitor.Order.POST_ORDER, COUNTERS_FACTORY);
-    this.periodsHolder = builder.periodsHolder;
+    this.periodHolder = builder.periodHolder;
     this.measureRepository = builder.measureRepository;
     this.metricRepository = builder.metricRepository;
     this.formulas = ImmutableList.copyOf(formulas);
@@ -81,7 +81,7 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitorAdapter<For
     private final MetricRepository metricRepository;
     private final MeasureRepository measureRepository;
     @CheckForNull
-    private PeriodsHolder periodsHolder;
+    private PeriodHolder periodHolder;
 
     private Builder(MetricRepository metricRepository, MeasureRepository measureRepository) {
       this.metricRepository = requireNonNull(metricRepository);
@@ -92,8 +92,8 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitorAdapter<For
       return new Builder(metricRepository, measureRepository);
     }
 
-    public Builder withVariationSupport(PeriodsHolder periodsHolder) {
-      this.periodsHolder = requireNonNull(periodsHolder);
+    public Builder withVariationSupport(PeriodHolder periodHolder) {
+      this.periodHolder = requireNonNull(periodHolder);
       return this;
     }
 
@@ -207,12 +207,12 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitorAdapter<For
 
     @Override
     public Period getPeriod() {
-      return periodsHolder.getPeriod();
+      return periodHolder.getPeriod();
     }
 
     @Override
     public boolean hasPeriod() {
-      return periodsHolder.hasPeriod();
+      return periodHolder.hasPeriod();
     }
   }
 
@@ -258,12 +258,12 @@ public class FormulaExecutorComponentVisitor extends PathAwareVisitorAdapter<For
 
     @Override
     public Period getPeriod() {
-      return periodsHolder.getPeriod();
+      return periodHolder.getPeriod();
     }
 
     @Override
     public boolean hasPeriod() {
-      return periodsHolder.hasPeriod();
+      return periodHolder.hasPeriod();
     }
   }
 }
index 0807e699aab8607015ca19a42c3cab8d29dc9951..8fd1d48b79527b05d6dad8482decdf23f93425b5 100644 (file)
@@ -35,7 +35,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.sonar.api.issue.Issue.RESOLUTION_FALSE_POSITIVE;
 import static org.sonar.api.issue.Issue.RESOLUTION_WONT_FIX;
@@ -102,16 +102,16 @@ public class IssueCounter extends IssueVisitor {
     .put(RuleType.VULNERABILITY, CoreMetrics.NEW_VULNERABILITIES_KEY)
     .build();
 
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final MetricRepository metricRepository;
   private final MeasureRepository measureRepository;
 
   private final Map<Integer, Counters> countersByComponentRef = new HashMap<>();
   private Counters currentCounters;
 
-  public IssueCounter(PeriodsHolder periodsHolder,
+  public IssueCounter(PeriodHolder periodHolder,
     MetricRepository metricRepository, MeasureRepository measureRepository) {
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.metricRepository = metricRepository;
     this.measureRepository = measureRepository;
   }
@@ -133,10 +133,10 @@ public class IssueCounter extends IssueVisitor {
   @Override
   public void onIssue(Component component, DefaultIssue issue) {
     currentCounters.add(issue);
-    if (!periodsHolder.hasPeriod()) {
+    if (!periodHolder.hasPeriod()) {
       return;
     }
-    Period period = periodsHolder.getPeriod();
+    Period period = periodHolder.getPeriod();
     // Add one second to not take into account issues created during current analysis
     if (issue.creationDate().getTime() >= period.getSnapshotDate() + 1000L) {
       currentCounters.addOnPeriod(issue);
@@ -181,7 +181,7 @@ public class IssueCounter extends IssueVisitor {
   }
 
   private void addMeasuresByPeriod(Component component) {
-    if (!periodsHolder.hasPeriod()) {
+    if (!periodHolder.hasPeriod()) {
       return;
     }
     Double unresolvedVariations = (double) currentCounters.counterForPeriod().unresolved;
index cf9e0bcc60e527698341adc7b9d19ba1d94ecb6e..015cc0c5fab6c237a4e2c62c1efe3baf477ed359 100644 (file)
@@ -35,7 +35,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.sonar.api.measures.CoreMetrics.NEW_RELIABILITY_REMEDIATION_EFFORT_KEY;
 import static org.sonar.api.measures.CoreMetrics.NEW_SECURITY_REMEDIATION_EFFORT_KEY;
@@ -50,7 +50,7 @@ import static org.sonar.api.measures.CoreMetrics.NEW_TECHNICAL_DEBT_KEY;
 public class NewEffortAggregator extends IssueVisitor {
 
   private final NewEffortCalculator calculator;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final DbClient dbClient;
   private final MeasureRepository measureRepository;
 
@@ -62,10 +62,10 @@ public class NewEffortAggregator extends IssueVisitor {
   private Map<Integer, NewEffortCounter> counterByComponentRef = new HashMap<>();
   private NewEffortCounter counter = null;
 
-  public NewEffortAggregator(NewEffortCalculator calculator, PeriodsHolder periodsHolder, DbClient dbClient,
-    MetricRepository metricRepository, MeasureRepository measureRepository) {
+  public NewEffortAggregator(NewEffortCalculator calculator, PeriodHolder periodHolder, DbClient dbClient,
+                             MetricRepository metricRepository, MeasureRepository measureRepository) {
     this.calculator = calculator;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.dbClient = dbClient;
     this.measureRepository = measureRepository;
 
@@ -93,9 +93,9 @@ public class NewEffortAggregator extends IssueVisitor {
 
   @Override
   public void onIssue(Component component, DefaultIssue issue) {
-    if (issue.resolution() == null && issue.effortInMinutes() != null && periodsHolder.hasPeriod()) {
+    if (issue.resolution() == null && issue.effortInMinutes() != null && periodHolder.hasPeriod()) {
       List<IssueChangeDto> changelog = changesByIssueUuid.get(issue.key());
-      counter.add(issue, periodsHolder.getPeriod(), changelog);
+      counter.add(issue, periodHolder.getPeriod(), changelog);
     }
   }
 
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
new file mode 100644 (file)
index 0000000..6844ce3
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+/**
+ * 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}
+ * - Try to find the matching snapshots from the property
+ * - If a snapshot is found, the period is added to the repository
+ */
+public interface PeriodHolder {
+
+  /**
+   * Finds out whether the holder contains a Period
+   *
+   * @throws IllegalStateException if the periods haven't been initialized
+   */
+  boolean hasPeriod();
+
+  /**
+   * Retrieve the period from the Holder.
+   *
+   * @throws IllegalStateException if the periods haven't been initialized
+   */
+  Period getPeriod();
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderImpl.java
new file mode 100644 (file)
index 0000000..fd2a653
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * 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 javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class PeriodHolderImpl implements PeriodHolder {
+
+  @CheckForNull
+  private Period period = null;
+  private boolean initialized = false;
+
+  /**
+   * Initializes the periods in the holder.
+   *
+   * @throws IllegalStateException if the holder has already been initialized
+   */
+  public void setPeriod(@Nullable Period period) {
+    checkState(!initialized, "Period have already been initialized");
+    this.period = period;
+    this.initialized = true;
+  }
+
+  @Override
+  public boolean hasPeriod() {
+    checkHolderIsInitialized();
+    return period != null;
+  }
+
+  @Override
+  public Period getPeriod() {
+    checkHolderIsInitialized();
+    return period;
+  }
+
+  private void checkHolderIsInitialized() {
+    checkState(initialized, "Period have not been initialized yet");
+  }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolder.java
deleted file mode 100644 (file)
index 4099f28..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;
-
-/**
- * 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}
- * - Try to find the matching snapshots from the property
- * - If a snapshot is found, the period is added to the repository
- */
-public interface PeriodsHolder {
-
-  /**
-   * Finds out whether the holder contains a Period
-   *
-   * @throws IllegalStateException if the periods haven't been initialized
-   */
-  boolean hasPeriod();
-
-  /**
-   * Retrieve the period from the Holder.
-   *
-   * @throws IllegalStateException if the periods haven't been initialized
-   */
-  Period getPeriod();
-
-}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImpl.java
deleted file mode 100644 (file)
index f47cd6f..0000000
+++ /dev/null
@@ -1,60 +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 javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static com.google.common.base.Preconditions.checkState;
-
-public class PeriodsHolderImpl implements PeriodsHolder {
-
-  @CheckForNull
-  private Period period = null;
-  private boolean initialized = false;
-
-  /**
-   * Initializes the periods in the holder.
-   *
-   * @throws IllegalStateException if the holder has already been initialized
-   */
-  public void setPeriod(@Nullable Period period) {
-    checkState(!initialized, "Period have already been initialized");
-    this.period = period;
-    this.initialized = true;
-  }
-
-  @Override
-  public boolean hasPeriod() {
-    checkHolderIsInitialized();
-    return period != null;
-  }
-
-  @Override
-  public Period getPeriod() {
-    checkHolderIsInitialized();
-    return period;
-  }
-
-  private void checkHolderIsInitialized() {
-    checkState(initialized, "Period have not been initialized yet");
-  }
-
-}
index 04c6d0fc1be82832c8c6c89c2d0d532b19710ac0..3e16297f44f796ede2008c8da18e827bb19c2e05 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.core.timemachine.Periods;
 import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static java.util.Objects.requireNonNull;
 import static org.sonar.server.computation.task.projectanalysis.measure.Measure.Level.ERROR;
@@ -48,13 +48,13 @@ public final class EvaluationResultTextConverterImpl implements EvaluationResult
   private final I18n i18n;
   private final Durations durations;
   private final Periods periods;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
 
-  public EvaluationResultTextConverterImpl(I18n i18n, Durations durations, Periods periods, PeriodsHolder periodsHolder) {
+  public EvaluationResultTextConverterImpl(I18n i18n, Durations durations, Periods periods, PeriodHolder periodHolder) {
     this.i18n = i18n;
     this.durations = durations;
     this.periods = periods;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
   }
 
   @Override
@@ -84,7 +84,7 @@ public final class EvaluationResultTextConverterImpl implements EvaluationResult
       .append(alertValue(condition, level));
 
     if (hasPeriod) {
-      Period period = periodsHolder.getPeriod();
+      Period period = periodHolder.getPeriod();
       stringBuilder.append(" ").append(periods.label(period.getMode(), period.getModeParameter(), DateUtils.longToDate(period.getSnapshotDate())));
     }
 
index cb91579d406271cb17c88b874ba261afb6da46ba..0e59009e8c3daa56a997e999db57df36eefeaa18 100644 (file)
@@ -36,7 +36,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfo;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepository;
@@ -62,7 +62,7 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
 
   private final ScmInfoRepository scmInfoRepository;
   private final MeasureRepository measureRepository;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final RatingSettings ratingSettings;
   private final RatingGrid ratingGrid;
 
@@ -73,11 +73,11 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
   private final Metric newMaintainabilityRatingMetric;
 
   public NewMaintainabilityMeasuresVisitor(MetricRepository metricRepository, MeasureRepository measureRepository, ScmInfoRepository scmInfoRepository,
-    PeriodsHolder periodsHolder, RatingSettings ratingSettings) {
+                                           PeriodHolder periodHolder, RatingSettings ratingSettings) {
     super(CrawlerDepthLimit.FILE, POST_ORDER, CounterFactory.INSTANCE);
     this.measureRepository = measureRepository;
     this.scmInfoRepository = scmInfoRepository;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.ratingSettings = ratingSettings;
     this.ratingGrid = ratingSettings.getRatingGrid();
 
@@ -116,7 +116,7 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
   }
 
   private void computeAndSaveNewDebtRatioMeasure(Component component, Path<Counter> path) {
-    if (!periodsHolder.hasPeriod()) {
+    if (!periodHolder.hasPeriod()) {
       return;
     }
     double density = computeDensity(path.current());
@@ -153,7 +153,7 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
 
   private void initNewDebtRatioCounter(Component file, Path<Counter> path) {
     // first analysis, no period, no differential value to compute, save processing time and return now
-    if (!periodsHolder.hasPeriod()) {
+    if (!periodHolder.hasPeriod()) {
       return;
     }
 
@@ -178,7 +178,7 @@ public class NewMaintainabilityMeasuresVisitor extends PathAwareVisitorAdapter<N
     long lineDevCost = ratingSettings.getDevCost(file.getFileAttributes().getLanguageKey());
     for (Integer nclocLineIndex : nclocLineIndexes(nclocDataMeasure)) {
       Changeset changeset = scmInfo.getChangesetForLine(nclocLineIndex);
-      Period period = periodsHolder.getPeriod();
+      Period period = periodHolder.getPeriod();
       if (isLineInPeriod(changeset.getDate(), period)) {
         devCostCounter.incrementDevCost(lineDevCost);
         hasDevCost = true;
index c9aa477a7bab4a210d3dff68794000323017202c..a7c88ee8a6be2a442ec59240875022c618d22292 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.sonar.api.measures.CoreMetrics.NEW_RELIABILITY_RATING_KEY;
 import static org.sonar.api.measures.CoreMetrics.NEW_SECURITY_RATING_KEY;
@@ -70,16 +70,16 @@ public class NewReliabilityAndSecurityRatingMeasuresVisitor extends PathAwareVis
 
   private final MeasureRepository measureRepository;
   private final ComponentIssuesRepository componentIssuesRepository;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
 
   private final Map<String, Metric> metricsByKey;
 
   public NewReliabilityAndSecurityRatingMeasuresVisitor(MetricRepository metricRepository, MeasureRepository measureRepository, ComponentIssuesRepository componentIssuesRepository,
-    PeriodsHolder periodsHolder) {
+    PeriodHolder periodHolder) {
     super(LEAVES, POST_ORDER, CounterFactory.INSTANCE);
     this.measureRepository = measureRepository;
     this.componentIssuesRepository = componentIssuesRepository;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
 
     // Output metrics
     this.metricsByKey = ImmutableMap.of(
@@ -108,7 +108,7 @@ public class NewReliabilityAndSecurityRatingMeasuresVisitor extends PathAwareVis
   }
 
   private void computeAndSaveMeasures(Component component, Path<Counter> path) {
-    if (!periodsHolder.hasPeriod()) {
+    if (!periodHolder.hasPeriod()) {
       return;
     }
     initRatingsToA(path);
@@ -133,7 +133,7 @@ public class NewReliabilityAndSecurityRatingMeasuresVisitor extends PathAwareVis
       .stream()
       .filter(issue -> issue.resolution() == null)
       .filter(issue -> issue.type().equals(BUG) || issue.type().equals(VULNERABILITY))
-      .forEach(issue -> path.current().processIssue(issue, periodsHolder.getPeriod()));
+      .forEach(issue -> path.current().processIssue(issue, periodHolder.getPeriod()));
   }
 
   private static void addToParent(Path<Counter> path) {
index 348642b058ea6f1ab2c0be248b0567b96fa42abf..94b27d45ed6b6d195883a33559e2f2a8ccb106ce 100644 (file)
@@ -44,7 +44,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -65,15 +65,15 @@ public class ComputeMeasureVariationsStep implements ComputationStep {
 
   private final DbClient dbClient;
   private final TreeRootHolder treeRootHolder;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final MetricRepository metricRepository;
   private final MeasureRepository measureRepository;
 
-  public ComputeMeasureVariationsStep(DbClient dbClient, TreeRootHolder treeRootHolder, PeriodsHolder periodsHolder, MetricRepository metricRepository,
+  public ComputeMeasureVariationsStep(DbClient dbClient, TreeRootHolder treeRootHolder, PeriodHolder periodHolder, MetricRepository metricRepository,
                                       MeasureRepository measureRepository) {
     this.dbClient = dbClient;
     this.treeRootHolder = treeRootHolder;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.metricRepository = metricRepository;
     this.measureRepository = measureRepository;
   }
@@ -112,8 +112,8 @@ public class ComputeMeasureVariationsStep implements ComputationStep {
 
     private MeasuresWithVariationRepository computeMeasuresWithVariations(Component component) {
       MeasuresWithVariationRepository measuresWithVariationRepository = new MeasuresWithVariationRepository();
-      if (periodsHolder.hasPeriod()) {
-        Period period = periodsHolder.getPeriod();
+      if (periodHolder.hasPeriod()) {
+        Period period = periodHolder.getPeriod();
         List<PastMeasureDto> pastMeasures = dbClient.measureDao()
           .selectPastMeasures(session, component.getUuid(), period.getAnalysisUuid(), metricIds);
         setVariationMeasures(component, pastMeasures, measuresWithVariationRepository);
index 9ef1217fff1bbd9c80f19725bf5d0efac239d61b..f2623ead683b797d586e38cf074d7d35c647d1df 100644 (file)
@@ -32,7 +32,8 @@ import org.sonar.server.computation.task.projectanalysis.component.SettingsRepos
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder;
 import org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderImpl;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderImpl;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static org.sonar.server.computation.task.projectanalysis.component.Component.Type.PROJECT;
@@ -41,7 +42,7 @@ import static org.sonar.server.computation.task.projectanalysis.component.Compon
 import static org.sonar.server.computation.task.projectanalysis.component.CrawlerDepthLimit.reportMaxDepth;
 
 /**
- * Populates the {@link org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder}
+ * 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}
@@ -54,10 +55,10 @@ public class LoadPeriodsStep implements ComputationStep {
   private final SettingsRepository settingsRepository;
   private final TreeRootHolder treeRootHolder;
   private final AnalysisMetadataHolder analysisMetadataHolder;
-  private final PeriodsHolderImpl periodsHolder;
+  private final PeriodHolderImpl periodsHolder;
 
   public LoadPeriodsStep(DbClient dbClient, SettingsRepository settingsRepository, TreeRootHolder treeRootHolder, AnalysisMetadataHolder analysisMetadataHolder,
-    PeriodsHolderImpl periodsHolder) {
+    PeriodHolderImpl periodsHolder) {
     this.dbClient = dbClient;
     this.settingsRepository = settingsRepository;
     this.treeRootHolder = treeRootHolder;
index 94eb9493bbbca41a84e8800152e3d15eb4e05851..ad3b594616f4278a735e5948ad50a008920def78 100644 (file)
@@ -50,7 +50,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfo;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepository;
 import org.sonar.server.computation.task.step.ComputationStep;
@@ -69,7 +69,7 @@ public class NewCoverageMeasuresStep implements ComputationStep {
     new NewLineCoverageFormula());
 
   private final TreeRootHolder treeRootHolder;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final MetricRepository metricRepository;
   private final MeasureRepository measureRepository;
   @CheckForNull
@@ -78,10 +78,10 @@ public class NewCoverageMeasuresStep implements ComputationStep {
   /**
    * Constructor used when processing a Report (ie. a {@link BatchReportReader} instance is available in the container)
    */
-  public NewCoverageMeasuresStep(TreeRootHolder treeRootHolder, PeriodsHolder periodsHolder,
+  public NewCoverageMeasuresStep(TreeRootHolder treeRootHolder, PeriodHolder periodHolder,
     MeasureRepository measureRepository, final MetricRepository metricRepository, ScmInfoRepository scmInfoRepository) {
     this.treeRootHolder = treeRootHolder;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.metricRepository = metricRepository;
     this.measureRepository = measureRepository;
     this.scmInfoRepository = scmInfoRepository;
@@ -90,10 +90,10 @@ public class NewCoverageMeasuresStep implements ComputationStep {
   /**
    * Constructor used when processing Views (ie. no {@link BatchReportReader} instance is available in the container)
    */
-  public NewCoverageMeasuresStep(TreeRootHolder treeRootHolder, PeriodsHolder periodsHolder,
+  public NewCoverageMeasuresStep(TreeRootHolder treeRootHolder, PeriodHolder periodHolder,
     MeasureRepository measureRepository, final MetricRepository metricRepository) {
     this.treeRootHolder = treeRootHolder;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.metricRepository = metricRepository;
     this.measureRepository = measureRepository;
     this.scmInfoRepository = null;
@@ -103,7 +103,7 @@ public class NewCoverageMeasuresStep implements ComputationStep {
   public void execute() {
     new PathAwareCrawler<>(
       FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
-        .withVariationSupport(periodsHolder)
+        .withVariationSupport(periodHolder)
         .buildFor(
           Iterables.concat(NewLinesAndConditionsCoverageFormula.from(scmInfoRepository), FORMULAS)))
             .visit(treeRootHolder.getRoot());
index d54ae239dfa393aed634b91cb3b2673d7a7a8eaa..b9714a5c551815b3eb38f16883fdd31a4335fc39 100644 (file)
@@ -44,7 +44,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepository;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepository;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfo;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepository;
@@ -61,15 +61,15 @@ import static org.sonar.api.measures.CoreMetrics.NEW_LINES_KEY;
 public class NewSizeMeasuresStep implements ComputationStep {
 
   private final TreeRootHolder treeRootHolder;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
   private final MetricRepository metricRepository;
   private final MeasureRepository measureRepository;
   private final NewDuplicationFormula duplicationFormula;
 
-  public NewSizeMeasuresStep(TreeRootHolder treeRootHolder, PeriodsHolder periodsHolder, MetricRepository metricRepository, MeasureRepository measureRepository,
-    ScmInfoRepository scmInfoRepository, DuplicationRepository duplicationRepository) {
+  public NewSizeMeasuresStep(TreeRootHolder treeRootHolder, PeriodHolder periodHolder, MetricRepository metricRepository, MeasureRepository measureRepository,
+                             ScmInfoRepository scmInfoRepository, DuplicationRepository duplicationRepository) {
     this.treeRootHolder = treeRootHolder;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
     this.metricRepository = metricRepository;
     this.measureRepository = measureRepository;
     this.duplicationFormula = new NewDuplicationFormula(scmInfoRepository, duplicationRepository);
@@ -84,7 +84,7 @@ public class NewSizeMeasuresStep implements ComputationStep {
   public void execute() {
     new PathAwareCrawler<>(
       FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository)
-        .withVariationSupport(periodsHolder)
+        .withVariationSupport(periodHolder)
         .buildFor(ImmutableList.of(duplicationFormula)))
           .visit(treeRootHolder.getRoot());
   }
index a81649b1c0d19350ab8f64e93f348af1d40cd312..b30aad99d781ec9a4ff554c5eb1ff4f9974a80af 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.server.computation.task.projectanalysis.component.DepthTraversa
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder;
 import org.sonar.server.computation.task.projectanalysis.component.TypeAwareVisitorAdapter;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 /**
@@ -42,15 +42,15 @@ public class PersistAnalysisStep implements ComputationStep {
   private final DbClient dbClient;
   private final TreeRootHolder treeRootHolder;
   private final AnalysisMetadataHolder analysisMetadataHolder;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
 
   public PersistAnalysisStep(System2 system2, DbClient dbClient, TreeRootHolder treeRootHolder,
-    AnalysisMetadataHolder analysisMetadataHolder, PeriodsHolder periodsHolder) {
+    AnalysisMetadataHolder analysisMetadataHolder, PeriodHolder periodHolder) {
     this.system2 = system2;
     this.dbClient = dbClient;
     this.treeRootHolder = treeRootHolder;
     this.analysisMetadataHolder = analysisMetadataHolder;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
   }
 
   @Override
@@ -92,10 +92,10 @@ public class PersistAnalysisStep implements ComputationStep {
     }
 
     private void updateSnapshotPeriods(SnapshotDto snapshotDto) {
-      if (!periodsHolder.hasPeriod()) {
+      if (!periodHolder.hasPeriod()) {
         return;
       }
-      Period period = periodsHolder.getPeriod();
+      Period period = periodHolder.getPeriod();
       snapshotDto.setPeriodMode(period.getMode());
       snapshotDto.setPeriodParam(period.getModeParameter());
       snapshotDto.setPeriodDate(period.getSnapshotDate());
index b47aea3b827861541fef2da67c4429a14da33fda..48669b35be1f295350a62b0fc92aaed8657a5d6e 100644 (file)
@@ -24,13 +24,13 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.sonar.api.measures.CoreMetrics;
-import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.PathAwareCrawler;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
+import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.guava.api.Assertions.assertThat;
@@ -57,7 +57,7 @@ public class AverageFormulaExecutionTest {
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   FormulaExecutorComponentVisitor underTest;
 
index c5a382ae22b8eabc364b8b2430e098df39290594..9dec8863a0523e13416b6281c2096af7e4f36436 100644 (file)
@@ -28,7 +28,7 @@ import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
 import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Matchers.anyString;
@@ -49,7 +49,7 @@ public class AverageFormulaTest {
 
   CounterInitializationContext counterInitializationContext = mock(CounterInitializationContext.class);
   CreateMeasureContext createMeasureContext = new DumbCreateMeasureContext(
-    ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class));
+    ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodHolder.class));
 
   @Rule
   public ExpectedException thrown = ExpectedException.none();
index 2a61210df6d2c4bbc050c232e88a1ac99b4ac722..1b0f6ff869d2d901cbc6a48e0f34384f2376be87 100644 (file)
@@ -28,7 +28,7 @@ import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
 import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -44,9 +44,9 @@ public class DistributionFormulaTest {
 
   CounterInitializationContext counterInitializationContext = mock(CounterInitializationContext.class);
   CreateMeasureContext projectCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodHolder.class));
   CreateMeasureContext fileCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.FILE, 1).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.FILE, 1).build(), mock(Metric.class), mock(PeriodHolder.class));
 
   @Test
   public void check_new_counter_class() {
index 3010a58a62601422a00b4e47e8536e7d48772e36..c003f95a9014e5d378a0856178042c829c02368a 100644 (file)
@@ -22,17 +22,17 @@ package org.sonar.server.computation.task.projectanalysis.formula;
 import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 public class DumbCreateMeasureContext implements CreateMeasureContext {
   private final Component component;
   private final Metric metric;
-  private final PeriodsHolder periodsHolder;
+  private final PeriodHolder periodHolder;
 
-  public DumbCreateMeasureContext(Component component, Metric metric, PeriodsHolder periodsHolder) {
+  public DumbCreateMeasureContext(Component component, Metric metric, PeriodHolder periodHolder) {
     this.component = component;
     this.metric = metric;
-    this.periodsHolder = periodsHolder;
+    this.periodHolder = periodHolder;
   }
 
   @Override
@@ -47,11 +47,11 @@ public class DumbCreateMeasureContext implements CreateMeasureContext {
 
   @Override
   public Period getPeriod() {
-    return periodsHolder.getPeriod();
+    return periodHolder.getPeriod();
   }
 
   @Override
   public boolean hasPeriod() {
-    return periodsHolder.hasPeriod();
+    return periodHolder.hasPeriod();
   }
 }
index bdcd03ded20d5453b6a43ef9cb65f15140ce3cc6..41617cfc87001f28fbe0e8722cebc5b00a1d925f 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.server.computation.task.projectanalysis.formula.SumFormula.IntS
 import org.sonar.server.computation.task.projectanalysis.formula.counter.IntSumCounter;
 import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -49,9 +49,9 @@ public class IntSumFormulaTest {
   public ExpectedException thrown = ExpectedException.none();
 
   CreateMeasureContext projectCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodHolder.class));
   CreateMeasureContext fileCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodHolder.class));
 
   @Test
   public void check_create_new_counter_class() {
index c5848d79c49808a4619a17a6a90dcd8e6beaa0ad..5f0d50a6a99b9821b0cc349bc5b7560e8975c883 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.server.computation.task.projectanalysis.component.ReportCompone
 import org.sonar.server.computation.task.projectanalysis.formula.counter.LongSumCounter;
 import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolder;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolder;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -48,9 +48,9 @@ public class LongSumFormulaTest {
   public ExpectedException thrown = ExpectedException.none();
 
   CreateMeasureContext projectCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.PROJECT, 1).build(), mock(Metric.class), mock(PeriodHolder.class));
   CreateMeasureContext fileCreateMeasureContext = new DumbCreateMeasureContext(
-      ReportComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodsHolder.class));
+      ReportComponent.builder(Component.Type.FILE, 2).build(), mock(Metric.class), mock(PeriodHolder.class));
 
   @Test
   public void check_create_new_counter_class() {
index 694d0ba768846957b235deabaea249e77f3e8483..c74b7e8d0f45d112c057f0874cdb76410bf1da2b 100644 (file)
@@ -34,7 +34,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.measures.CoreMetrics.LINES_KEY;
@@ -89,7 +89,7 @@ public class ReportFormulaExecutorComponentVisitorTest {
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule().setPeriod(new Period("some mode", null, 95l, "756l"));
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule().setPeriod(new Period("some mode", null, 95l, "756l"));
 
   @Test
   public void verify_aggregation_on_value() throws Exception {
index 3adeb437b3d240e4620b9a4fee9c7910d7a43d7c..8083b8c7d5422244abd52b2c459571eb7e38d1bf 100644 (file)
@@ -35,7 +35,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureReposito
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.guava.api.Assertions.assertThat;
@@ -89,7 +89,7 @@ public class ViewsFormulaExecutorComponentVisitorTest {
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule().setPeriod(new Period("some mode", null, 95l, "u1"));
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule().setPeriod(new Period("some mode", null, 95l, "u1"));
 
   @Test
   public void verify_aggregation_on_value() throws Exception {
index f83a66552723ee2f51855901443be57fcf84a2d6..6d7f5d84cbc7b3c15904bc6f06186c6d23af66ce 100644 (file)
@@ -37,7 +37,7 @@ import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricImpl;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.issue.Issue.RESOLUTION_FALSE_POSITIVE;
@@ -108,7 +108,7 @@ public class IssueCounterTest {
   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
 
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   @Rule
   public MetricRepositoryRule metricRepository = new MetricRepositoryRule()
index 0ad794d59aba1dce09e1e47516cb951a0178da76..34b6b95048a658325c0baacb131baa32139d31c7 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.guava.api.Assertions.assertThat;
@@ -63,7 +63,7 @@ public class NewEffortAggregatorTest {
   private NewEffortCalculator calculator = mock(NewEffortCalculator.class);
 
   @org.junit.Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   @org.junit.Rule
   public MetricRepositoryRule metricRepository = new MetricRepositoryRule()
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderImplTest.java
new file mode 100644 (file)
index 0000000..57fa571
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class PeriodHolderImplTest {
+
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
+
+  private PeriodHolderImpl underTest = new PeriodHolderImpl();
+
+  @Test
+  public void get_period() {
+    Period period = createPeriod();
+    underTest.setPeriod(period);
+
+    assertThat(underTest.getPeriod()).isEqualTo(period);
+  }
+
+  @Test
+  public void get_period_throws_illegal_state_exception_if_not_initialized() {
+    thrown.expect(IllegalStateException.class);
+    thrown.expectMessage("Period have not been initialized yet");
+
+    new PeriodHolderImpl().getPeriod();
+  }
+
+  @Test
+  public void setPeriod_throws_ISE_if_already_initialized() {
+    thrown.expect(IllegalStateException.class);
+    thrown.expectMessage("Period have already been initialized");
+
+    underTest.setPeriod(createPeriod());
+    underTest.setPeriod(createPeriod());
+  }
+
+  @Test
+  public void hasPeriod_returns_false_if_holder_is_empty() {
+    underTest.setPeriod(null);
+    assertThat(underTest.hasPeriod()).isFalse();
+  }
+
+  @Test
+  public void hasPeriod_returns_true_only_if_period_exists_in_holder() {
+    underTest.setPeriod(createPeriod());
+    assertThat(underTest.hasPeriod()).isTrue();
+  }
+
+  @Test
+  public void hasPeriod_throws_ISE_if_not_initialized() {
+    thrown.expect(IllegalStateException.class);
+    thrown.expectMessage("Period have not been initialized yet");
+
+    underTest.hasPeriod();
+  }
+
+  private static Period createPeriod() {
+    return new Period(1 + "mode", null, 1000L, "U1");
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodHolderRule.java
new file mode 100644 (file)
index 0000000..81afedf
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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 javax.annotation.Nullable;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class PeriodHolderRule implements TestRule, PeriodHolder {
+  private PeriodHolderImpl delegate = new PeriodHolderImpl();
+
+  @Override
+  public Statement apply(final Statement statement, Description description) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        try {
+          statement.evaluate();
+        } finally {
+          clear();
+        }
+      }
+    };
+  }
+
+  private void clear() {
+    this.delegate = new PeriodHolderImpl();
+  }
+
+  public PeriodHolderRule setPeriod(@Nullable Period period) {
+    delegate = new PeriodHolderImpl();
+    delegate.setPeriod(period);
+    return this;
+  }
+
+  @Override
+  public boolean hasPeriod() {
+    return delegate.hasPeriod();
+  }
+
+  @Override
+  public Period getPeriod() {
+    return delegate.getPeriod();
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderImplTest.java
deleted file mode 100644 (file)
index 4b3857a..0000000
+++ /dev/null
@@ -1,83 +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.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class PeriodsHolderImplTest {
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  private PeriodsHolderImpl underTest = new PeriodsHolderImpl();
-
-  @Test
-  public void get_period() {
-    Period period = createPeriod();
-    underTest.setPeriod(period);
-
-    assertThat(underTest.getPeriod()).isEqualTo(period);
-  }
-
-  @Test
-  public void get_period_throws_illegal_state_exception_if_not_initialized() {
-    thrown.expect(IllegalStateException.class);
-    thrown.expectMessage("Period have not been initialized yet");
-
-    new PeriodsHolderImpl().getPeriod();
-  }
-
-  @Test
-  public void setPeriod_throws_ISE_if_already_initialized() {
-    thrown.expect(IllegalStateException.class);
-    thrown.expectMessage("Period have already been initialized");
-
-    underTest.setPeriod(createPeriod());
-    underTest.setPeriod(createPeriod());
-  }
-
-  @Test
-  public void hasPeriod_returns_false_if_holder_is_empty() {
-    underTest.setPeriod(null);
-    assertThat(underTest.hasPeriod()).isFalse();
-  }
-
-  @Test
-  public void hasPeriod_returns_true_only_if_period_exists_in_holder() {
-    underTest.setPeriod(createPeriod());
-    assertThat(underTest.hasPeriod()).isTrue();
-  }
-
-  @Test
-  public void hasPeriod_throws_ISE_if_not_initialized() {
-    thrown.expect(IllegalStateException.class);
-    thrown.expectMessage("Period have not been initialized yet");
-
-    underTest.hasPeriod();
-  }
-
-  private static Period createPeriod() {
-    return new Period(1 + "mode", null, 1000L, "U1");
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/period/PeriodsHolderRule.java
deleted file mode 100644 (file)
index 4c13550..0000000
+++ /dev/null
@@ -1,63 +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 javax.annotation.Nullable;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-public class PeriodsHolderRule implements TestRule, PeriodsHolder {
-  private PeriodsHolderImpl delegate = new PeriodsHolderImpl();
-
-  @Override
-  public Statement apply(final Statement statement, Description description) {
-    return new Statement() {
-      @Override
-      public void evaluate() throws Throwable {
-        try {
-          statement.evaluate();
-        } finally {
-          clear();
-        }
-      }
-    };
-  }
-
-  private void clear() {
-    this.delegate = new PeriodsHolderImpl();
-  }
-
-  public PeriodsHolderRule setPeriod(@Nullable Period period) {
-    delegate = new PeriodsHolderImpl();
-    delegate.setPeriod(period);
-    return this;
-  }
-
-  @Override
-  public boolean hasPeriod() {
-    return delegate.hasPeriod();
-  }
-
-  @Override
-  public Period getPeriod() {
-    return delegate.getPeriod();
-  }
-}
index 03d8c7259517c8657259443a0eb915475961d318..5b53205dd5c3a50d2c455e85ab025fa5daeebca1 100644 (file)
@@ -37,7 +37,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricImpl;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
@@ -57,7 +57,7 @@ public class EvaluationResultTextConverterTest {
   private static final String SOME_ANALYSIS_UUID = "u1";
 
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   private I18n i18n = mock(I18n.class);
   private Durations durations = mock(Durations.class);
index 781639920f3deebedd15d5bb410fc18484e736f6..14a4391918337bf112395a57102892e8310b248d 100644 (file)
@@ -38,7 +38,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 import org.sonar.server.computation.task.projectanalysis.qualitymodel.RatingGrid.Rating;
 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRule;
@@ -89,7 +89,7 @@ public class NewMaintainabilityMeasuresVisitorTest {
   @Rule
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   private RatingSettings ratingSettings = mock(RatingSettings.class);
 
index 1c196a3d8c099a597fb39e5c257d34a36f87c0e5..d33af04f2ae6dffc952d30a4e9eb67752e9d7ff8 100644 (file)
@@ -39,7 +39,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureAssert;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.api.issue.Issue.RESOLUTION_FIXED;
@@ -106,7 +106,7 @@ public class NewReliabilityAndSecurityRatingMeasuresVisitorTest {
   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
 
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule().setPeriod(new Period("mode", null, LEAK_PERIOD_SNAPSHOT_IN_MILLISEC, "UUID"));
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule().setPeriod(new Period("mode", null, LEAK_PERIOD_SNAPSHOT_IN_MILLISEC, "UUID"));
 
   @Rule
   public ComponentIssuesRepositoryRule componentIssuesRepositoryRule = new ComponentIssuesRepositoryRule(treeRootHolder);
index efc556e10954d4561300248cd66a6a4595243fdc..644eb7b2d3da8cfdc88823621e5a055504e87f35 100644 (file)
@@ -40,7 +40,7 @@ import org.sonar.server.computation.task.projectanalysis.component.SettingsRepos
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.ViewsComponent;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderImpl;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderImpl;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -69,7 +69,7 @@ public class LoadPeriodsStepTest extends BaseStepTest {
   @Rule
   public LogTester logTester = new LogTester();
 
-  private PeriodsHolderImpl periodsHolder = new PeriodsHolderImpl();
+  private PeriodHolderImpl periodsHolder = new PeriodHolderImpl();
   private DbClient dbClient = dbTester.getDbClient();
   private Settings settings = new MapSettings();
   private SettingsRepository settingsRepository = mock(SettingsRepository.class);
index 9e0ce3c59794ed73474e42f0dfe59fa1be70c123..87274890fa3356e45633637d8c1ffdc1324f1a00 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.server.computation.task.projectanalysis.duplication.TextBlock;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRule;
 
@@ -93,7 +93,7 @@ public class NewSizeMeasuresStepTest {
         .build());
 
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule().setPeriod(
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule().setPeriod(
     new Period("mode_p_1", null, parseDate("2009-12-25").getTime(), "u1"));
 
   @Rule
index afc57e1c847831a821fd87e1f27c1e40c45a4794..83332801827b22e19a962af34bb9b0b109a5f806 100644 (file)
@@ -41,7 +41,7 @@ import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricImpl;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -63,7 +63,7 @@ public class ReportComputeMeasureVariationsStepTest {
   @Rule
   public BatchReportReaderRule reportReader = new BatchReportReaderRule();
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
   @Rule
   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
   @Rule
index 67d24968b062f35c0884162adf6094de58b48c82..6fb5a22fea39b82266ac17aa86744b50e2aabca3 100644 (file)
@@ -33,7 +33,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepoEntr
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
 import org.sonar.server.computation.task.projectanalysis.scm.ScmInfoRepositoryRule;
 
@@ -91,7 +91,7 @@ public class ReportNewCoverageMeasuresStepTest {
   @Rule
   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
   @Rule
   public MetricRepositoryRule metricRepository = new MetricRepositoryRule()
     .add(CoreMetrics.COVERAGE_LINE_HITS_DATA)
index 81aa76364867854e439f492120013be396875c90..d71a368b4003e3b7a6d0ec69492f7c095d7b6ac6 100644 (file)
@@ -39,7 +39,7 @@ import org.sonar.server.computation.task.projectanalysis.component.DbIdsReposito
 import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -60,7 +60,7 @@ public class ReportPersistAnalysisStepTest extends BaseStepTest {
   @Rule
   public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   private System2 system2 = mock(System2.class);
 
index 07e25fddc6356152e151ebec3c2362fc98d5c47a..d6cd8849e7980e1cadc7f6c99ca52628beecf980 100644 (file)
@@ -40,7 +40,7 @@ import org.sonar.server.computation.task.projectanalysis.metric.Metric;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricImpl;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.db.component.SnapshotTesting.newAnalysis;
@@ -61,7 +61,7 @@ public class ViewsComputeMeasureVariationsStepTest {
   public BatchReportReaderRule reportReader = new BatchReportReaderRule();
 
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   @Rule
   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
index 83aeae2c191c96e5c390a716810f5ea693384e28..44537f059fd3ffc63c1c13af1a2fb31cfec1c9bd 100644 (file)
@@ -30,7 +30,7 @@ import org.sonar.server.computation.task.projectanalysis.measure.Measure;
 import org.sonar.server.computation.task.projectanalysis.measure.MeasureRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.metric.MetricRepositoryRule;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.guava.api.Assertions.assertThat;
@@ -74,7 +74,7 @@ public class ViewsNewCoverageMeasuresStepTest {
   @Rule
   public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule();
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
   @Rule
   public MetricRepositoryRule metricRepository = new MetricRepositoryRule()
     .add(CoreMetrics.COVERAGE_LINE_HITS_DATA)
index 4706d39faf2ee4d47e5d5643c132be23bce29e9c..83c558af29c008bcf74bf5480a95a776ea5f18e3 100644 (file)
@@ -36,7 +36,7 @@ import org.sonar.server.computation.task.projectanalysis.component.Component;
 import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
 import org.sonar.server.computation.task.projectanalysis.component.ViewsComponent;
 import org.sonar.server.computation.task.projectanalysis.period.Period;
-import org.sonar.server.computation.task.projectanalysis.period.PeriodsHolderRule;
+import org.sonar.server.computation.task.projectanalysis.period.PeriodHolderRule;
 import org.sonar.server.computation.task.step.ComputationStep;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -61,7 +61,7 @@ public class ViewsPersistAnalysisStepTest extends BaseStepTest {
   @Rule
   public AnalysisMetadataHolderRule analysisMetadataHolder = new AnalysisMetadataHolderRule();
   @Rule
-  public PeriodsHolderRule periodsHolder = new PeriodsHolderRule();
+  public PeriodHolderRule periodsHolder = new PeriodHolderRule();
 
   private System2 system2 = mock(System2.class);