diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-23 11:22:51 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-07-23 18:00:39 +0200 |
commit | d400b1910a3155625ee47c65faea4912a27d0aaf (patch) | |
tree | d5a5c1c1719ee17ce66828be68a6bc98b7cd13d5 | |
parent | ea81f2e905211773a225cb4980576dacc9d32699 (diff) | |
download | sonarqube-d400b1910a3155625ee47c65faea4912a27d0aaf.tar.gz sonarqube-d400b1910a3155625ee47c65faea4912a27d0aaf.zip |
SONAR-6605 Remove CoreFormulaRepository
All formulas are now in a dedicated step
7 files changed, 0 insertions, 217 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainerImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainerImpl.java index 21c2a49dbaa..bdd9c9b9c85 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainerImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainerImpl.java @@ -43,7 +43,6 @@ import org.sonar.server.computation.component.ProjectSettingsRepository; import org.sonar.server.computation.component.TreeRootHolderImpl; import org.sonar.server.computation.debt.DebtModelHolderImpl; import org.sonar.server.computation.event.EventRepositoryImpl; -import org.sonar.server.computation.formula.CoreFormulaRepositoryImpl; import org.sonar.server.computation.issue.BaseIssuesLoader; import org.sonar.server.computation.issue.DebtAggregator; import org.sonar.server.computation.issue.DebtCalculator; @@ -173,7 +172,6 @@ public class ComputeEngineContainerImpl extends ComponentContainer implements Co EventRepositoryImpl.class, ProjectSettingsRepository.class, DbIdsRepository.class, - CoreFormulaRepositoryImpl.class, QualityGateServiceImpl.class, EvaluationResultTextConverterImpl.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepository.java b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepository.java deleted file mode 100644 index 4629cba61d3..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepository.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.formula; - -import java.util.List; - -public interface CoreFormulaRepository { - - List<Formula> getFormulas(); - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java deleted file mode 100644 index 37b3f089df2..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.formula; - -import com.google.common.collect.ImmutableList; -import java.util.List; - - -public class CoreFormulaRepositoryImpl implements CoreFormulaRepository { - - private static final List<Formula> FORMULAS = ImmutableList.<Formula>of( - // TODO When all decorators will be moved to CE, uncomment commented lines to activate all formulas and remove formulas declaration in - // {@link org.sonar.api.measures.CoreMetrics} - - ); - - /** - * Return list of formulas that was previously provided by CoreMetrics - */ - @Override - public List<Formula> getFormulas() { - return FORMULAS; - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputationSteps.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputationSteps.java index 4fa5731b797..22079297a05 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputationSteps.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ComputationSteps.java @@ -60,7 +60,6 @@ public class ComputationSteps { DuplicationMeasuresStep.class, // must be executed after the measures required for common rules (coverage, comment density, duplications) IntegrateIssuesStep.class, - CoreMetricFormulaExecutorStep.class, LanguageDistributionMeasuresStep.class, UnitTestMeasuresStep.class, ComplexityMeasuresStep.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStep.java deleted file mode 100644 index 851e3e1b3d3..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStep.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.step; - -import org.sonar.server.computation.component.TreeRootHolder; -import org.sonar.server.computation.formula.CoreFormulaRepository; -import org.sonar.server.computation.formula.FormulaExecutorComponentVisitor; -import org.sonar.server.computation.measure.MeasureRepository; -import org.sonar.server.computation.metric.MetricRepository; - -public class CoreMetricFormulaExecutorStep implements ComputationStep { - - private final TreeRootHolder treeRootHolder; - private final MetricRepository metricRepository; - private final MeasureRepository measureRepository; - private final CoreFormulaRepository coreFormulaRepository; - - public CoreMetricFormulaExecutorStep(TreeRootHolder treeRootHolder, - MetricRepository metricRepository, MeasureRepository measureRepository, - CoreFormulaRepository coreFormulaRepository) { - this.treeRootHolder = treeRootHolder; - this.metricRepository = metricRepository; - this.measureRepository = measureRepository; - this.coreFormulaRepository = coreFormulaRepository; - } - - @Override - public void execute() { - FormulaExecutorComponentVisitor.newBuilder(metricRepository, measureRepository) - .buildFor(coreFormulaRepository.getFormulas()) - .visit(treeRootHolder.getRoot()); - } - - @Override - public String getDescription() { - return "Execute formula to compute measures of Core metrics"; - } - -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImplTest.java deleted file mode 100644 index f5cec082065..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/formula/CoreFormulaRepositoryImplTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.formula; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class CoreFormulaRepositoryImplTest { - - @Test - public void check_formulas_are_not_empty() { - assertThat(new CoreFormulaRepositoryImpl().getFormulas()).isNotEmpty(); - - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStepTest.java deleted file mode 100644 index a38b736ac1c..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/CoreMetricFormulaExecutorStepTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube 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. - * - * SonarQube 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.step; - -import org.junit.Rule; -import org.junit.Test; -import org.sonar.server.computation.batch.TreeRootHolderRule; -import org.sonar.server.computation.component.Component; -import org.sonar.server.computation.component.DumbComponent; -import org.sonar.server.computation.formula.CoreFormulaRepository; -import org.sonar.server.computation.measure.MeasureRepository; -import org.sonar.server.computation.metric.MetricRepository; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -public class CoreMetricFormulaExecutorStepTest { - @Rule - public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule(); - - @Test - public void verify_execute_formulas_from_CoreFormulaRepository() { - CoreFormulaRepository coreFormulaRepository = mock(CoreFormulaRepository.class); - treeRootHolder.setRoot(DumbComponent.builder(Component.Type.PROJECT, 1).build()); - - CoreMetricFormulaExecutorStep underTest = new CoreMetricFormulaExecutorStep(treeRootHolder, - mock(MetricRepository.class), mock(MeasureRepository.class), coreFormulaRepository); - - underTest.execute(); - - verify(coreFormulaRepository, times(1)).getFormulas(); - } -} |